Class: Gem::Commands::UncompileCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
Gem::CompileMethods, VersionOption
Defined in:
lib/rubygems-compile/commands/uncompile_command.rb

Instance Method Summary collapse

Methods included from Gem::CompileMethods

#execution_list

Constructor Details

#initializeUncompileCommand

Returns a new instance of UncompileCommand.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rubygems-compile/commands/uncompile_command.rb', line 8

def initialize
  super 'uncompile', 'Uncompile installed gems',
        ignore: true, all: false

  add_version_option
  add_option(
             '-a', '--all', 'Uncompile all installed gem'
             ) do |all,opts| opts[:all] = all end
  add_option(
             '-I', '--[no-]ignore-dependencies', 'Also uncompile dependencies'
             ) do |value, options| options[:ignore] = value end
end

Instance Method Details

#argumentsObject

:nodoc:



21
22
23
# File 'lib/rubygems-compile/commands/uncompile_command.rb', line 21

def arguments # :nodoc:
  'GEMNAME          name of the gem to uncompile'
end

#defaults_strObject

:nodoc:



25
26
27
# File 'lib/rubygems-compile/commands/uncompile_command.rb', line 25

def defaults_str # :nodoc:
  super + '--ignore-dependencies'
end

#executeObject

Determine which gems need to be uncompiled, then create and run an uncompiler object for each of them.



37
38
39
40
# File 'lib/rubygems-compile/commands/uncompile_command.rb', line 37

def execute
  require 'rubygems-compile/uncompiler'
  execution_list.each { |gem| Gem::Uncompiler.uncompile(gem) }
end

#usageObject

:nodoc:



29
30
31
# File 'lib/rubygems-compile/commands/uncompile_command.rb', line 29

def usage # :nodoc:
  "#{program_name} GEMNAME [GEMNAME ...]"
end