Exception: Bundler::PermissionError
Instance Method Summary
collapse
all_errors, status_code
Constructor Details
#initialize(path, permission_type = :write) ⇒ PermissionError
Returns a new instance of PermissionError.
66
67
68
69
|
# File 'lib/bundler/errors.rb', line 66
def initialize(path, permission_type = :write)
@path = path
@permission_type = permission_type
end
|
Instance Method Details
#action ⇒ Object
71
72
73
74
75
76
77
78
|
# File 'lib/bundler/errors.rb', line 71
def action
case @permission_type
when :read then "read from"
when :write then "write to"
when :executable, :exec then "execute"
else @permission_type.to_s
end
end
|
#message ⇒ Object
93
94
95
96
|
# File 'lib/bundler/errors.rb', line 93
def message
"There was an error while trying to #{action} `#{@path}`. " \
"It is likely that you need to grant #{permission_type}."
end
|
#parent_folder ⇒ Object
89
90
91
|
# File 'lib/bundler/errors.rb', line 89
def parent_folder
File.dirname(@path)
end
|
#permission_type ⇒ Object
80
81
82
83
84
85
86
87
|
# File 'lib/bundler/errors.rb', line 80
def permission_type
case @permission_type
when :create
"executable permissions for all parent directories and write permissions for `#{parent_folder}`"
else
"#{@permission_type} permissions for that path"
end
end
|