Class: Gem::Commands::CompileCommand

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

Overview

Use the MacRuby compiler to compile installed gems.

Instance Method Summary collapse

Methods included from Gem::CompileMethods

#execution_list

Constructor Details

#initializeCompileCommand

Returns a new instance of CompileCommand.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubygems-compile/commands/compile_command.rb', line 13

def initialize
  super 'compile', 'Compile (or recompile) installed gems',
        ignore: true, all: false

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

Instance Method Details

#argumentsObject

:nodoc:



26
27
28
# File 'lib/rubygems-compile/commands/compile_command.rb', line 26

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

#defaults_strObject

:nodoc:



30
31
32
# File 'lib/rubygems-compile/commands/compile_command.rb', line 30

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

#executeObject

Determine which gems need to be compiled, then create and run a compiler object for each of them.



42
43
44
45
46
47
48
49
50
# File 'lib/rubygems-compile/commands/compile_command.rb', line 42

def execute
  gems = execution_list
  if gems.count >= 10
    alert 'This could take a while...'
  end

  require 'rubygems-compile/compiler'
  gems.each { |gem| Gem::Compiler.compile gem }
end

#usageObject

:nodoc:



34
35
36
# File 'lib/rubygems-compile/commands/compile_command.rb', line 34

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