Class Gem::GemRunner
In: lib/rubygems/gem_runner.rb
Parent: Object

Run an instance of the gem program.

Gem::GemRunner is only intended for internal use by RubyGems itself. It does not form any public API and may change at any time for any reason.

If you would like to duplicate functionality of `gem` commands, use the classes they call directly.

Methods

new   run  

Public Class methods

[Source]

    # File lib/rubygems/gem_runner.rb, line 27
27:   def initialize(options={})
28:     # TODO: nuke these options
29:     @command_manager_class = options[:command_manager] || Gem::CommandManager
30:     @config_file_class = options[:config_file] || Gem::ConfigFile
31:     @doc_manager_class = options[:doc_manager] || Gem::DocManager
32:   end

Public Instance methods

Run the gem command with the following arguments.

[Source]

    # File lib/rubygems/gem_runner.rb, line 37
37:   def run(args)
38:     start_time = Time.now
39: 
40:     if args.include?('--')
41:       # We need to preserve the original ARGV to use for passing gem options
42:       # to source gems.  If there is a -- in the line, strip all options after
43:       # it...its for the source building process.
44:       build_args = args[args.index("--") + 1...args.length]
45:       args = args[0...args.index("--")]
46:     end
47: 
48:     Gem::Command.build_args = build_args if build_args
49: 
50:     do_configuration args
51:     cmd = @command_manager_class.instance
52: 
53:     cmd.command_names.each do |command_name|
54:       config_args = Gem.configuration[command_name]
55:       config_args = case config_args
56:                     when String
57:                       config_args.split ' '
58:                     else
59:                       Array(config_args)
60:                     end
61:       Gem::Command.add_specific_extra_args command_name, config_args
62:     end
63: 
64:     cmd.run Gem.configuration.args
65:     end_time = Time.now
66: 
67:     if Gem.configuration.benchmark then
68:       printf "\nExecution time: %0.2f seconds.\n", end_time - start_time
69:       puts "Press Enter to finish"
70:       STDIN.gets
71:     end
72:   end

[Validate]