Class: Gem::Commands::CompileCommand

Inherits:
Gem::Command
  • Object
show all
Defined in:
lib/rubygems/commands/compile_command.rb

Instance Method Summary collapse

Constructor Details

#initializeCompileCommand

Returns a new instance of CompileCommand


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rubygems/commands/compile_command.rb', line 4

def initialize
  super "compile", "Create binary pre-compiled gem",
    :output => Dir.pwd

  add_option "--prune", "Clean non-existing files during re-packaging" do |value, options|
    options[:prune] = true
  end

  add_option "-N", "--no-abi-lock", "Do not lock compiled Gem to Ruby's ABI" do |value, options|
    options[:no_abi_lock] = true
  end
end

Instance Method Details

#argumentsObject


17
18
19
# File 'lib/rubygems/commands/compile_command.rb', line 17

def arguments
  "GEMFILE       path to the gem file to compile"
end

#executeObject


25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rubygems/commands/compile_command.rb', line 25

def execute
  gemfile = options[:args].shift

  # no gem, no binary
  unless gemfile
    raise Gem::CommandLineError,
          "Please specify a gem file on the command line (e.g. #{program_name} foo-0.1.0.gem)"
  end

  require "rubygems/compiler"

  compiler = Gem::Compiler.new(gemfile, options)
  compiler.compile
end

#usageObject


21
22
23
# File 'lib/rubygems/commands/compile_command.rb', line 21

def usage
  "#{program_name} GEMFILE"
end