summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAgis Anastasopoulos <agis.anast@gmail.com>2015-09-26 15:34:18 +0300
committerAgis Anastasopoulos <agis.anast@gmail.com>2015-09-27 16:53:48 +0300
commit302b4cef21f8e8d97bfb218cc550a7862875babd (patch)
tree0552bb470b1c5b991332051745dc828b97e03801
parent20f04aa8923c0d0f02e7a74d5e9609d772351668 (diff)
downloadbundler-302b4cef21f8e8d97bfb218cc550a7862875babd.tar.gz
Make PermissionError more generic
We also want to display helpful error messages for paths, not just files.
-rw-r--r--lib/bundler.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 3d56adec2b..3708821f6e 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -100,8 +100,8 @@ module Bundler
class MarshalError < StandardError; end
class PermissionError < BundlerError
- def initialize(file, permission_type = :write)
- @file = file
+ def initialize(path, permission_type = :write)
+ @path = path
@permission_type = permission_type
end
@@ -109,12 +109,12 @@ module Bundler
action = case @permission_type
when :read then "read from"
when :write then "write to"
- when :executable then "execute"
+ when :executable, :exec then "execute"
else @permission_type.to_s
end
- "There was an error while trying to #{action} `#{File.basename(@file)}`. " \
- "It is likely that you need to grant #{@permission_type} permissions for " \
- "the file at path: `#{File.expand_path(@file)}`."
+ "There was an error while trying to #{action} `#{@path}`. " \
+ "It is likely that you need to grant #{@permission_type} permissions " \
+ "for that path."
end
status_code(23)