Class: EmptyCommand

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

Overview

rubygems plugin to empty GEM_HOME

Constant Summary collapse

GEM_REMOVAL_ERRORS =
[
  Gem::DependencyRemovalException,
  Gem::InstallError,
  Gem::GemNotInHomeException,
  Gem::FilePermissionError,
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEmptyCommand

Returns a new instance of EmptyCommand.



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

def initialize
  super 'empty', description
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/gem-empty/command.rb', line 9

def options
  @options
end

Instance Method Details

#argumentsObject

:nodoc:



22
23
24
# File 'lib/gem-empty/command.rb', line 22

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

#defaults_strObject

:nodoc:



30
31
32
# File 'lib/gem-empty/command.rb', line 30

def defaults_str # :nodoc:
  ""
end

#descriptionObject

:nodoc:



34
35
36
# File 'lib/gem-empty/command.rb', line 34

def description # :nodoc:
  "Remove all gems from current 'GEM_HOME'."
end

#execute(opts = {}) ⇒ Object



38
39
40
41
42
# File 'lib/gem-empty/command.rb', line 38

def execute(opts = {})
  remove_gems(opts)
rescue *GEM_REMOVAL_ERRORS => exception
  alert_error "#{exception.class}: #{exception.message}"
end

#usageObject

:nodoc:



26
27
28
# File 'lib/gem-empty/command.rb', line 26

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