Parent

Class Index [+]

Quicksearch

Gem::GemRunner

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.

Public Class Methods

new(options={}) click to toggle source
    # File lib/rubygems/gem_runner.rb, line 22
22:   def initialize(options={})
23:     @command_manager_class = options[:command_manager] || Gem::CommandManager
24:     @config_file_class = options[:config_file] || Gem::ConfigFile
25:     @doc_manager_class = options[:doc_manager] || Gem::DocManager
26:   end

Public Instance Methods

run(args) click to toggle source

Run the gem command with the following arguments.

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

Private Instance Methods

do_configuration(args) click to toggle source
    # File lib/rubygems/gem_runner.rb, line 70
70:   def do_configuration(args)
71:     Gem.configuration = @config_file_class.new(args)
72:     Gem.use_paths(Gem.configuration[:gemhome], Gem.configuration[:gempath])
73:     Gem::Command.extra_args = Gem.configuration[:gem]
74:     @doc_manager_class.configured_args = Gem.configuration[:rdoc]
75:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.