C0 code coverage information
Generated on Sun Sep 28 16:35:59 -0700 2008 with rcov 0.8.1.2
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.
1 module GemInstaller
2 class InstallProcessor
3 attr_writer :gem_list_checker, :gem_command_manager, :gem_spec_manager, :missing_dependency_finder, :options, :output_filter
4 def process(gems)
5 gems.each do |gem|
6 install_gem(gem)
7 end
8 end
9
10 def install_gem(gem)
11 already_specified = false
12 if gem.check_for_upgrade
13 @gem_list_checker.verify_and_specify_remote_gem!(gem)
14 already_specified = true
15 end
16 gem_is_installed = @gem_spec_manager.is_gem_installed?(gem)
17 if gem_is_installed
18 @output_filter.geminstaller_output(:debug,"Gem #{gem.name}, version #{gem.version} is already installed.\n")
19 else
20 perform_install(gem, already_specified)
21 installation_performed = true
22 end
23 if gem.fix_dependencies
24 if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
25 # RubyGems >=0.9.5 automatically handles missing dependencies, so just perform an install
26 unless installation_performed
27 @output_filter.geminstaller_output(:install,"The 'fix_dependencies' option was specified for #{gem.name}, version #{gem.version}, so it will be reinstalled to fix any missing dependencies.\n")
28 perform_install(gem, already_specified, true)
29 end
30 else
31 # RubyGems <=0.9.4 does not automatically handles missing dependencies, so GemInstaller must find them
32 # manually with missing_dependency_finder
33 fix_dependencies(gem)
34 end
35 end
36 end
37
38 def perform_install(gem, already_specified, force_install = false)
39 @gem_list_checker.verify_and_specify_remote_gem!(gem) unless already_specified
40 @output_filter.geminstaller_output(:install,"Invoking gem install for #{gem.name}, version #{gem.version}.\n")
41 output_lines = @gem_command_manager.install_gem(gem, force_install)
42 print_dependency_install_messages(gem, output_lines) unless @options[:silent]
43 end
44
45 def print_dependency_install_messages(gem, output_lines)
46 output_lines.each do |line|
47 line =~ /Successfully installed /
48 match = $'
49 next unless match
50 next if match =~ /#{gem.name}-/
51 @output_filter.geminstaller_output(:install,"Rubygems automatically installed dependency gem #{match}\n")
52 end
53 end
54
55 def fix_dependencies(gem)
56 missing_dependencies = @missing_dependency_finder.find(gem)
57 while (missing_dependencies.size > 0)
58 missing_dependencies.each do |missing_dependency|
59 @output_filter.geminstaller_output(:install,"Installing #{missing_dependency.name} (#{missing_dependency.version})\n")
60 # recursively call install_gem to install the missing dependency. Since fix_dependencies
61 # should never be set on an auto-created missing dependency gem, there is no risk of an
62 # endless loop or stack overflow.
63 install_gem(missing_dependency)
64 end
65 # continue to look for and install missing dependencies until none are found
66 missing_dependencies = @missing_dependency_finder.find(gem)
67 end
68 end
69
70 end
71 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.2.