Class: Gem::Commands::PrecompileCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::PrecompileCommand
- Defined in:
- lib/rubygems/commands/precompile_command.rb
Instance Method Summary collapse
- #arguments ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ PrecompileCommand
constructor
A new instance of PrecompileCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ PrecompileCommand
Returns a new instance of PrecompileCommand.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rubygems/commands/precompile_command.rb', line 4 def initialize super "precompile", "Create a bundle containing the compiled artifacts for this platform", :output => Dir.pwd, :arch => false add_option('-o PATH', '--output=PATH', 'The output directory for the generated bundle. Defaults to the current directory') do |path,| [:output] = path end add_option('-a','--arch-dirs','Adds the architecture sub-folders to the output directory before writing') do |arch, | [:arch] = true end end |
Instance Method Details
#arguments ⇒ Object
16 17 18 |
# File 'lib/rubygems/commands/precompile_command.rb', line 16 def arguments "GEMFILE path to the gem file to compile" end |
#execute ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rubygems/commands/precompile_command.rb', line 24 def execute gemfiles = [:args] # no gem, no binary if gemfiles.empty? raise Gem::CommandLineError, "Please specify a gem file on the command line, e.g. #{program_name} foo-0.1.0.gem" end require "rubygems/precompiler" gemfiles.each do |gemfile| compiler = Gem::Precompiler.new(gemfile, ) if compiler.has_extension? $stderr.puts "Compiling '#{compiler.gem_name}'... " compiler.compile $stderr.puts "done." else $stderr.puts "The gem '#{compiler.gem_name}' doesn't contain a compiled extension" end end end |
#usage ⇒ Object
20 21 22 |
# File 'lib/rubygems/commands/precompile_command.rb', line 20 def usage "#{program_name} GEMFILE" end |