Class: Gem::Commands::NukeCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::NukeCommand
- Defined in:
- lib/rubygems/commands/nuke_command.rb
Instance Method Summary collapse
-
#description ⇒ Object
:nodoc:.
- #execute ⇒ Object
-
#initialize ⇒ NukeCommand
constructor
A new instance of NukeCommand.
Constructor Details
#initialize ⇒ NukeCommand
Returns a new instance of NukeCommand.
7 8 9 10 11 12 13 14 |
# File 'lib/rubygems/commands/nuke_command.rb', line 7 def initialize super 'nuke', description add_option('-v', '--vault gemname1,gemname2', Array, "Gems in vault that'll survive this command.") do |vault, | [:vault] = vault.reject(&:nil?).collect(&:strip) end end |
Instance Method Details
#description ⇒ Object
:nodoc:
16 17 18 |
# File 'lib/rubygems/commands/nuke_command.rb', line 16 def description # :nodoc: 'Nukes gems.' end |
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubygems/commands/nuke_command.rb', line 20 def execute raise OptionParser::InvalidArgument, [:args] unless [:args].empty? [:vault] ||= [] specs_to_uninstall = Gem::Specification.reject { |spec| [:vault].include?(spec.name) } specs_to_uninstall.each do |spec| begin Gem::Uninstaller.new(spec.name, { force: true, executables: true }).uninstall rescue StandardError # ignored end end end |