Geminstaller C0 Coverage Information - RCov

lib/geminstaller/valid_platform_selector.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/geminstaller/valid_platform_selector.rb 49 39
14.29%
12.82%

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 ValidPlatformSelector
3     attr_writer :options, :ruby_platform, :output_filter
4     
5     def select(gem_platform = nil, exact_platform_match = false)
6       if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
7         # valid_platform_selector is not used for RubyGems >= 0.9.5
8         raise RuntimeError.new("Internal GemInstaller Error: ValidPlatformSelector should not be used for RubyGems >= 0.9.5")
9       end
10 
11       @ruby_platform ||= RUBY_PLATFORM
12       return [@ruby_platform] if gem_platform == Gem::Platform::CURRENT
13       return [gem_platform] if exact_platform_match
14       valid_platforms = []
15       valid_platforms += binary_platform_substring if binary_platform_substring
16       if @options[:prefer_binary_platform] == false
17         # put ruby first if prefer_binary_platform is false
18         valid_platforms.unshift('ruby')
19       else
20         # leave binary platform first if prefer_binary_platform is false or nil
21         valid_platforms << 'ruby'
22       end
23       if gem_platform and 
24         !valid_platforms.include?(gem_platform)
25         # only prepend the gem_platform as the first choice if
26         # 1. it is not nil
27         # 2. it is not already in the list
28         # 3. it is not 'ruby'
29         valid_platforms.unshift(gem_platform)
30       end
31       message = "Selecting valid platform(s): @ruby_platform='#{@ruby_platform}', gem_platform='#{gem_platform}', valid_platforms='#{valid_platforms.inspect}'"
32       @output_filter.geminstaller_output(:debug,"#{message}\n")
33       valid_platforms
34     end
35     
36     def binary_platform_substring
37       return ['686-darwin'] if @ruby_platform =~ /686-darwin/
38       return ['cygwin'] if @ruby_platform =~ /cygwin/
39       return ['powerpc'] if @ruby_platform =~ /powerpc/
40       return ['i386-mswin32','mswin32'] if @ruby_platform =~ /mswin/
41       return ['386-linux'] if @ruby_platform =~ /386-linux/
42       return ['486-linux'] if @ruby_platform =~ /486-linux/
43       return ['586-linux'] if @ruby_platform =~ /586-linux/
44       return ['686-linux'] if @ruby_platform =~ /686-linux/
45       return ['solaris'] if @ruby_platform =~ /solaris/
46       return nil
47     end
48   end
49 end

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