lib/rubygems/commands/cleanup_command.rb in rubygems-update-3.0.9 vs lib/rubygems/commands/cleanup_command.rb in rubygems-update-3.1.0.pre1

- old
+ new

@@ -97,11 +97,11 @@ get_gems_to_cleanup @full = Gem::DependencyList.from_specs deplist = Gem::DependencyList.new - @gems_to_cleanup.each do |spec| deplist.add spec end + @gems_to_cleanup.each { |spec| deplist.add spec } deps = deplist.strongly_connected_components.flatten deps.reverse_each do |spec| uninstall_dep spec @@ -119,22 +119,22 @@ Gem::Specification.to_a end end def get_gems_to_cleanup - gems_to_cleanup = @candidate_gems.select { |spec| + gems_to_cleanup = @candidate_gems.select do |spec| @primary_gems[spec.name].version != spec.version - } + end - default_gems, gems_to_cleanup = gems_to_cleanup.partition { |spec| + default_gems, gems_to_cleanup = gems_to_cleanup.partition do |spec| spec.default_gem? - } + end uninstall_from = options[:user_install] ? Gem.user_dir : @original_home - gems_to_cleanup = gems_to_cleanup.select { |spec| + gems_to_cleanup = gems_to_cleanup.select do |spec| spec.base_dir == uninstall_from - } + end @default_gems += default_gems @default_gems.uniq! @gems_to_cleanup = gems_to_cleanup.uniq end