зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Move security exception handling to the only place using it
https://github.com/rubygems/rubygems/commit/ba975b3b7f
This commit is contained in:
Родитель
bf8dc36e40
Коммит
965c314e34
|
@ -205,10 +205,6 @@ module Bundler
|
||||||
|
|
||||||
def spec_from_gem(path, policy = nil)
|
def spec_from_gem(path, policy = nil)
|
||||||
gem_from_path(path, security_policies[policy]).spec
|
gem_from_path(path, security_policies[policy]).spec
|
||||||
rescue Gem::Security::Exception => e
|
|
||||||
raise SecurityError,
|
|
||||||
"The gem #{File.basename(path, ".gem")} can't be installed because " \
|
|
||||||
"the security policy didn't allow it, with the message: #{e.message}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_gem(gem_dir, spec)
|
def build_gem(gem_dir, spec)
|
||||||
|
|
|
@ -157,6 +157,10 @@ module Bundler
|
||||||
path = fetch_gem(spec, options[:previous_spec])
|
path = fetch_gem(spec, options[:previous_spec])
|
||||||
begin
|
begin
|
||||||
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
|
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
|
||||||
|
rescue Gem::Security::Exception => e
|
||||||
|
raise SecurityError,
|
||||||
|
"The gem #{File.basename(path, ".gem")} can't be installed because " \
|
||||||
|
"the security policy didn't allow it, with the message: #{e.message}"
|
||||||
rescue Gem::Package::FormatError
|
rescue Gem::Package::FormatError
|
||||||
Bundler.rm_rf(path)
|
Bundler.rm_rf(path)
|
||||||
raise
|
raise
|
||||||
|
|
Загрузка…
Ссылка в новой задаче