aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-21 20:17:11 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-09-05 18:42:26 +0900
commitfea91d69a3b4aebd5e69058f9ec51adf2896cdfd (patch)
tree7cab5651128ef5f9b311747711c0e454ead7d610 /lib/rubygems
parentf9f6a3d793186bd4b8897f775dcdcc9719361c11 (diff)
downloadruby-fea91d69a3b4aebd5e69058f9ec51adf2896cdfd.tar.gz
[rubygems/rubygems] Don't fail when `uninstall --all` with default gem
Instead, display an informative message saying that uninstallation of specific versions is being skipped because of being default gems. https://github.com/rubygems/rubygems/commit/b44845aa1d
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/uninstaller.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 46d92820cb..20b437d472 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -96,6 +96,10 @@ class Gem::Uninstaller
spec.default_gem?
end
+ default_specs.each do |default_spec|
+ say "Gem #{default_spec.full_name} cannot be uninstalled because it is a default gem"
+ end
+
list, other_repo_specs = list.partition do |spec|
@gem_home == spec.base_dir or
(@user_install and spec.base_dir == Gem.user_dir)
@@ -104,14 +108,7 @@ class Gem::Uninstaller
list.sort!
if list.empty?
- if other_repo_specs.empty?
- if default_specs.any?
- message =
- "gem #{@gem.inspect} cannot be uninstalled " +
- "because it is a default gem"
- raise Gem::InstallError, message
- end
- end
+ return unless other_repo_specs.any?
other_repos = other_repo_specs.map { |spec| spec.base_dir }.uniq