summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2024-08-19 20:18:23 +0200
committergit <svn-admin@ruby-lang.org>2024-08-21 12:07:10 +0000
commit419d3221fb48a6c7eda2f6ddcfef9566516aa703 (patch)
tree5de7bf4e47fd3c31d54f62e3c72317a1a044131a /lib
parent3ebe249ce1f93db9c6178230ae21166e35579da6 (diff)
[rubygems/rubygems] Fix `gem uninstall <name>:<version>` failing on shadowed default gems
https://github.com/rubygems/rubygems/commit/29357a5dd6
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/uninstall_command.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 283bc96ce3..3d6e41e49e 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -157,9 +157,14 @@ that is a dependency of an existing gem. You can use the
gem_specs = Gem::Specification.find_all_by_name(name, original_gem_version[name])
- say("Gem '#{name}' is not installed") if gem_specs.empty?
- gem_specs.each do |spec|
- deplist.add spec
+ if gem_specs.empty?
+ say("Gem '#{name}' is not installed")
+ else
+ gem_specs.reject!(&:default_gem?) if gem_specs.size > 1
+
+ gem_specs.each do |spec|
+ deplist.add spec
+ end
end
end