diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-08-21 20:05:24 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-09-05 18:41:49 +0900 |
commit | d219be4a1c237356670ebafd415e983433362e72 (patch) | |
tree | b4aec6c4f5a9df369582386f91783fc1391e11e8 /lib | |
parent | 7a2bd91ed24cceecc627df574fc109cdd6b258dd (diff) |
[rubygems/rubygems] Move empty check earlier
https://github.com/rubygems/rubygems/commit/fc224e9717
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/uninstaller.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index bbca22154e..46d92820cb 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -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" |