Class: EmptyCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- EmptyCommand
- Defined in:
- lib/gem-empty/command.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
-
#defaults_str ⇒ Object
:nodoc:.
-
#description ⇒ Object
:nodoc:.
- #execute(opts = {}) ⇒ Object
-
#initialize ⇒ EmptyCommand
constructor
A new instance of EmptyCommand.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ EmptyCommand
Returns a new instance of EmptyCommand.
10 11 12 13 |
# File 'lib/gem-empty/command.rb', line 10 def initialize super 'empty', 'Remove all gems from current GEM_HOME.' @default_options = { :install_dir => Gem.dir, :force => true, :executables => true } end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/gem-empty/command.rb', line 8 def @options end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
15 16 17 |
# File 'lib/gem-empty/command.rb', line 15 def arguments # :nodoc: "empty remove all gems from current GEM_HOME." end |
#defaults_str ⇒ Object
:nodoc:
23 24 25 |
# File 'lib/gem-empty/command.rb', line 23 def defaults_str # :nodoc: "" end |
#description ⇒ Object
:nodoc:
27 28 29 30 31 |
# File 'lib/gem-empty/command.rb', line 27 def description # :nodoc: <<-DOC Remove all gems from current 'GEM_HOME'. DOC end |
#execute(opts = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gem-empty/command.rb', line 33 def execute(opts = {}) @options = @default_options.merge(opts) uninstaller = Gem::Uninstaller.new(nil, ) uninstaller.remove_all(gem_dir_specs) # Remove any Git gems installed via bundler FileUtils.rm_rf( File.join( [:install_dir] ,'bundler','gems' ) ) rescue Gem::DependencyRemovalException, Gem::InstallError, Gem::GemNotInHomeException, Gem::FilePermissionError => e alert_error "#{e.class}: #{e.}" end |
#usage ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/gem-empty/command.rb', line 19 def usage # :nodoc: "#{program_name}" end |