Parent

GemInstaller::GemCommandManager

Attributes

gem_spec_manager[W]
gem_runner_proxy[W]
gem_interaction_handler[W]

Public Instance Methods

dependency(name, version, additional_options = []) click to toggle source
    # File lib/geminstaller/gem_command_manager.rb, line 29
29:     def dependency(name, version, additional_options = [])
30:       # rubygems has bug up to 0.9.4 where the pipe options uses 'puts', instead of 'say', so we can't capture it
31:       # with enhanced_stream_ui.  Patched: http://rubyforge.org/tracker/index.php?func=detail&aid=9020&group_id=126&atid=577
32:       # TODO: use pipe option on later versions which support it
33:       
34:       name_regexp = "^#{name}$"
35:       name_regexp = "/#{name_regexp}/" if GemInstaller::RubyGemsVersionChecker.matches?('>=1.2.0')
36:       run_args = ["dependency", name_regexp, "--version", version]
37:       run_args += additional_options
38:       output_lines = @gem_runner_proxy.run(run_args)
39:       # drop the first line which just echoes the dependent gem
40:       output_lines.shift
41:       # drop the line containing 'requires' (rubygems < 0.9.0)
42:       if output_lines[0] == '  Requires'
43:         output_lines.shift
44:       end
45:       # drop all empty lines
46:       output_lines.reject! { |line| line == "" }
47:       # strip leading space
48:       output_lines.each { |line| line.strip! }
49:       # convert into gems
50:       output_gems = output_lines.collect do |line|
51:         name = line.split(' ')[0]
52:         version_spec = line.split(/[(,)]/)[1]
53:         GemInstaller::RubyGem.new(name, :version => version_spec)
54:       end
55:     end
init_gem_interaction_handler(gem) click to toggle source
    # File lib/geminstaller/gem_command_manager.rb, line 25
25:     def init_gem_interaction_handler(gem)
26:       @gem_interaction_handler.dependent_gem = gem if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
27:     end
install_gem(gem, force_reinstall = false) click to toggle source
    # File lib/geminstaller/gem_command_manager.rb, line 19
19:     def install_gem(gem, force_reinstall = false)
20:       return [] if @gem_spec_manager.is_gem_installed?(gem) && !force_reinstall
21:       init_gem_interaction_handler(gem)
22:       run_gem_command('install', gem, gem.install_options)
23:     end
list_remote_gem(gem, additional_options) click to toggle source
    # File lib/geminstaller/gem_command_manager.rb, line 6
 6:     def list_remote_gem(gem, additional_options)
 7:       run_args = ["list",gem.name,"--remote","--details"]
 8:       run_args << "--all" if GemInstaller::RubyGemsVersionChecker.matches?('>1.0.1')
 9:       run_args += additional_options
10:       @gem_runner_proxy.run(run_args)
11:     end
run_gem_command(gem_command, gem, options) click to toggle source
    # File lib/geminstaller/gem_command_manager.rb, line 57
57:     def run_gem_command(gem_command, gem, options)
58:       run_args = [gem_command,gem.name,"--version", "#{gem.version}"]
59:       if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
60:         run_args += ['--platform', "#{gem.platform}"] if gem.platform && !gem.platform.empty?
61:       end
62:       run_args += options
63:       @gem_runner_proxy.run(run_args)
64:     end
uninstall_gem(gem) click to toggle source
    # File lib/geminstaller/gem_command_manager.rb, line 13
13:     def uninstall_gem(gem)
14:       return if !@gem_spec_manager.is_gem_installed?(gem)
15:       init_gem_interaction_handler(gem)
16:       run_gem_command('uninstall', gem, gem.uninstall_options)
17:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.