Class: Gem::Commands::PruneCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
Prune::Util
Defined in:
lib/gem/commands/prune_command.rb

Instance Method Summary collapse

Methods included from Prune::Util

#gems_to_keep, #load_configuration, #save_configuration, #settings_filename

Constructor Details

#initializePruneCommand

Returns a new instance of PruneCommand.



12
13
14
# File 'lib/gem/commands/prune_command.rb', line 12

def initialize
  super 'prune', 'Identify and remove old gems'
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/gem/commands/prune_command.rb', line 16

def execute
  load_configuration
  mark_kept_versions
  versions_to_prune.each do |version|
    ui = Gem::Uninstaller.new(version.name, :version => version.version,
      :ignore => true, :executables => true)
    ui.uninstall
  end
  save_configuration
end