aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/cleanup_command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-27 10:05:04 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-27 10:05:04 +0000
commit85d461456c154d7b4a72b20369e0d65d7880ce02 (patch)
tree21e1be2c786c8040a426841768e046fb4dc365b1 /lib/rubygems/commands/cleanup_command.rb
parent3a83ba90c35833bab757998def36cfe872dec461 (diff)
downloadruby-85d461456c154d7b4a72b20369e0d65d7880ce02.tar.gz
Merge master branch from rubygems upstream.
* It's preparation to release RubyGems 3.0.0.beta2 and Ruby 2.6.0 preview 3. * https://github.com/rubygems/rubygems/compare/v3.0.0.beta1...fad2eb15a282b19dfcb4b48bc95b8b39ebb4511f git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/cleanup_command.rb')
-rw-r--r--lib/rubygems/commands/cleanup_command.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index 79c23c840d..fe85deddda 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -22,6 +22,12 @@ class Gem::Commands::CleanupCommand < Gem::Command
options[:check_dev] = value
end
+ add_option('--[no-]user-install',
+ 'Cleanup in user\'s home directory instead',
+ 'of GEM_HOME.') do |value, options|
+ options[:user_install] = value
+ end
+
@candidate_gems = nil
@default_gems = []
@full = nil
@@ -124,8 +130,10 @@ If no gems are named all gems in GEM_HOME are cleaned.
spec.default_gem?
}
+ uninstall_from = options[:user_install] ? Gem.user_dir : @original_home
+
gems_to_cleanup = gems_to_cleanup.select { |spec|
- spec.base_dir == @original_home
+ spec.base_dir == uninstall_from
}
@default_gems += default_gems