Geminstaller C0 Coverage Information - RCov

lib/geminstaller/gem_command_manager.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/geminstaller/gem_command_manager.rb 71 51
97.18%
96.08%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 module GemInstaller
2   class GemCommandManager
3     attr_writer :gem_spec_manager, :gem_runner_proxy
4     attr_writer :gem_interaction_handler if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
5     
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
12 
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
18 
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
24     
25     def init_gem_interaction_handler(gem)
26       @gem_interaction_handler.dependent_gem = gem if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
27     end
28     
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
56 
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
65   end
66 end
67 
68 
69 
70 
71 

Generated on Mon May 10 23:40:28 -0700 2010 with rcov 0.9.8