Method: Gem::Commands::CleanupCommand#get_gems_to_cleanup

Defined in:
lib/rubygems/commands/cleanup_command.rb

#get_gems_to_cleanupObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/rubygems/commands/cleanup_command.rb', line 122

def get_gems_to_cleanup
  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(&:default_gem?)

  uninstall_from = options[:user_install] ? Gem.user_dir : Gem.dir

  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