Class: EmptyCommand

Inherits:
Gem::Command
  • Object
show all
Defined in:
lib/gem-empty/command.rb

Instance Method Summary collapse

Constructor Details

#initializeEmptyCommand

Returns a new instance of EmptyCommand.



7
8
9
# File 'lib/gem-empty/command.rb', line 7

def initialize
  super 'empty', 'Remove all gems from current GEM_HOME.'
end

Instance Method Details

#argumentsObject

:nodoc:



11
12
13
# File 'lib/gem-empty/command.rb', line 11

def arguments # :nodoc:
  "empty        remove all gems from current GEM_HOME."
end

#defaults_strObject

:nodoc:



19
20
21
# File 'lib/gem-empty/command.rb', line 19

def defaults_str # :nodoc:
  ""
end

#descriptionObject

:nodoc:



23
24
25
26
27
# File 'lib/gem-empty/command.rb', line 23

def description # :nodoc:
  <<-DOC
Remove all gems from current 'GEM_HOME'.
DOC
end

#execute(options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gem-empty/command.rb', line 29

def execute(options = {})
  options = {:force => true, :executables => true }.merge(options)
  uninstaller = Gem::Uninstaller.new(nil, options)
  uninstaller.remove_all(gem_dir_specs)

rescue Gem::DependencyRemovalException,
       Gem::InstallError,
       Gem::GemNotInHomeException,
       Gem::FilePermissionError => e

  alert_error "#{e.class}: #{e.message}"
end

#usageObject

:nodoc:



15
16
17
# File 'lib/gem-empty/command.rb', line 15

def usage # :nodoc:
  "#{program_name}"
end