Object
# File lib/geminstaller/gem_runner_proxy.rb, line 61
61: def access_error_message
62: "You don't have permission to install a gem.\nThis is not a problem with GemInstaller.\nYou probably want use the --sudo option or run GemInstaller as sudo,\nor install your gems to a non-root-owned location.\nSee http://geminstaller.rubyforge.org/documentation/documentation.html#dealing_with_sudo\n"
63: end
# File lib/geminstaller/gem_runner_proxy.rb, line 41
41: def create_gem_runner
42: if GemInstaller::RubyGemsVersionChecker.matches?('< 0.9')
43: @gem_runner_class.new()
44: else
45: @gem_runner_class.new(:command_manager => @gem_cmd_manager_class)
46: end
47: end
# File lib/geminstaller/gem_runner_proxy.rb, line 49
49: def raise_error_with_output(exit_error, args, listener)
50: error_class = exit_error.class
51: error_message = exit_error.message
52: gem_command_output = listener.read!
53: if gem_command_output.join('') =~ /Errno::EACCES/
54: error_message = access_error_message + "\n" + error_message
55: error_class = GemInstaller::GemInstallerAccessError
56: end
57: descriptive_exit_message = exit_error.descriptive_exit_message(error_message, 'gem', args, gem_command_output)
58: raise error_class.new(descriptive_exit_message)
59: end
# File lib/geminstaller/gem_runner_proxy.rb, line 6
6: def run(args = [], stdin = [])
7: @output_filter.geminstaller_output(:commandecho,"'gem #{args.join(' ')}'\n")
8: gem_runner = create_gem_runner
9: # We have to manually initialize the configuration here, or else the GemCommandManager singleton
10: # will initialize with the (incorrect) default args when we call GemRunner.run.
11: gem_runner.do_configuration(args)
12: gem_cmd_manager = @gem_cmd_manager_class.instance
13: gem_cmd_manager.ui = @enhanced_stream_ui
14: gem_cmd_manager.commands[:list] = @exact_match_list_command
15:
16: exit_status = nil
17: begin
18: # The call below is to work around RubyGem's behavior of caching (only) the last-used source when
19: # multiple gem commands for gems on different sources are issued via the API
20: Gem.sources.replace Gem.default_sources
21: gem_runner.run(args)
22: rescue SystemExit => system_exit
23: if GemInstaller::RubyGemsVersionChecker.matches?('>1.0.1')
24: raise system_exit unless system_exit.is_a? Gem::SystemExitException
25: exit_status = system_exit.message
26: else
27: raise system_exit
28: end
29: rescue GemInstaller::RubyGemsExit => normal_exit
30: exit_status = normal_exit.message
31: rescue GemInstaller::GemInstallerError => exit_error
32: raise_error_with_output(exit_error, args, @output_listener)
33: end
34: output_lines = @output_listener.read!
35: output_lines.push(exit_status) if exit_status
36: output_lines.collect do |line|
37: line.split("\n")
38: end.flatten
39: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.