Geminstaller C0 Coverage Information - RCov

lib/geminstaller/gem_spec_manager.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/geminstaller/gem_spec_manager.rb 53 42
84.91%
80.95%

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 GemSpecManager
3     attr_writer :source_index_search_adapter, :valid_platform_selector, :output_filter
4 
5     def is_gem_installed?(gem)
6       return local_matching_gems(gem).size > 0
7     end
8     
9     def all_local_gems
10       all_local_specs = @source_index_search_adapter.all_local_specs
11       return [] unless all_local_specs
12       all_local_gems = all_local_specs.collect do |spec|
13         gem = GemInstaller::RubyGem.new(spec.name, :version  => spec.version.version)
14       end
15       return all_local_gems
16     end
17     
18     def local_matching_gems(gem, exact_platform_match = true)
19       found_gem_specs = @source_index_search_adapter.search(gem,gem.version)
20       return [] unless found_gem_specs
21 
22       if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
23         found_gem_specs = found_gem_specs.select do |gem_spec|
24           valid_platforms = @valid_platform_selector.select(gem.platform, exact_platform_match)
25           valid_platforms.include?(gem_spec.platform)
26         end
27       else
28         # TODO: this is a hack because source_index#search doesn't allow specification of platform
29         if exact_platform_match
30           found_gem_specs = found_gem_specs.select do |spec|
31             spec_platform_matches?(spec, gem.platform)
32           end
33         end
34       end
35       matching_gems = found_gem_specs.map do |gem_spec|
36         GemInstaller::RubyGem.new(gem_spec.name, {:version => gem_spec.version.version, :platform => gem_spec.platform })
37       end
38       return matching_gems
39     end
40 
41     def spec_platform_matches?(spec, platform)
42       if GemInstaller::RubyGemsVersionChecker.matches?('>0.9.5')
43         return Gem::Platform.new(spec.platform) == Gem::Platform.new(platform)
44       end
45       return spec.platform == platform
46     end
47   end
48 end
49 
50 
51 
52 
53 

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