aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/cleanup_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/cleanup_command.rb')
-rw-r--r--lib/rubygems/commands/cleanup_command.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index db1bf3a794..79c23c840d 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -8,13 +8,20 @@ class Gem::Commands::CleanupCommand < Gem::Command
def initialize
super 'cleanup',
'Clean up old versions of installed gems',
- :force => false, :install_dir => Gem.dir
+ :force => false, :install_dir => Gem.dir,
+ :check_dev => true
add_option('-n', '-d', '--dryrun',
'Do not uninstall gems') do |value, options|
options[:dryrun] = true
end
+ add_option('-D', '--[no-]check-development',
+ 'Check development dependencies while uninstalling',
+ '(default: true)') do |value, options|
+ options[:check_dev] = value
+ end
+
@candidate_gems = nil
@default_gems = []
@full = nil
@@ -138,7 +145,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
end
def uninstall_dep spec
- return unless @full.ok_to_remove?(spec.full_name)
+ return unless @full.ok_to_remove?(spec.full_name, options[:check_dev])
if options[:dryrun] then
say "Dry Run Mode: Would uninstall #{spec.full_name}"