diff options
Diffstat (limited to 'lib/rubygems/commands/cleanup_command.rb')
-rw-r--r-- | lib/rubygems/commands/cleanup_command.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb index 124c4c203a..dc919e5570 100644 --- a/lib/rubygems/commands/cleanup_command.rb +++ b/lib/rubygems/commands/cleanup_command.rb @@ -26,6 +26,9 @@ class Gem::Commands::CleanupCommand < Gem::Command <<-EOF The cleanup command removes old gems from GEM_HOME. If an older version is installed elsewhere in GEM_PATH the cleanup command won't touch it. + +Older gems that are required to satisify the dependencies of gems +are not removed. EOF end @@ -56,6 +59,8 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it. primary_gems[spec.name].version != spec.version } + full = Gem::DependencyList.from_specs + deplist = Gem::DependencyList.new gems_to_cleanup.uniq.each do |spec| deplist.add spec end @@ -64,6 +69,8 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it. original_path = Gem.path deps.each do |spec| + next unless full.ok_to_remove?(spec.full_name) + if options[:dryrun] then say "Dry Run Mode: Would uninstall #{spec.full_name}" else |