1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Move empty check earlier

https://github.com/rubygems/rubygems/commit/fc224e9717
This commit is contained in:
David Rodríguez 2019-08-21 20:05:24 +02:00 committed by Hiroshi SHIBATA
parent 7a2bd91ed2
commit d219be4a1c

View file

@ -88,6 +88,10 @@ class Gem::Uninstaller
list << spec
end
if list.empty?
raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
end
default_specs, list = list.partition do |spec|
spec.default_gem?
end
@ -101,9 +105,7 @@ class Gem::Uninstaller
if list.empty?
if other_repo_specs.empty?
if default_specs.empty?
raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
else
if default_specs.any?
message =
"gem #{@gem.inspect} cannot be uninstalled " +
"because it is a default gem"