Geminstaller C0 Coverage Information - RCov

lib/geminstaller/ruby_gem.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/geminstaller/ruby_gem.rb 58 50
75.86%
76.00%

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 RubyGem
3     include Comparable
4     attr_accessor :name, :version, :platform, :install_options, :check_for_upgrade, :fix_dependencies, :no_autogem, :prefer_binary_platform, :uninstall_options
5 
6     def initialize(name, opts={})
7       @name = name
8       #TODO: the following logic could probably be more concise, but I'm not sure right now
9       @version = GemInstaller::RubyGem.default_version
10       if opts[:version] != "" && opts[:version] != nil 
11         @version = opts[:version] 
12       end
13       if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.5')
14         @platform = 'ruby'
15       end
16       if opts[:platform] != "" && opts[:platform] != nil 
17         @platform = opts[:platform]
18       end
19       @install_options = opts[:install_options] ||= []
20       @uninstall_options = opts[:uninstall_options] ||= []
21       @check_for_upgrade = opts[:check_for_upgrade] == true ? true : false
22       @fix_dependencies = opts[:fix_dependencies] == true ? true : false
23       @no_autogem = opts[:no_autogem] == true ? true : false
24       if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
25         warn("The 'prefer_binary_platform' option is deprecated on RubyGems >= 0.9.5, and has no effect") unless opts[:prefer_binary_platorm].nil?
26       else
27         @prefer_binary_platform = opts[:prefer_binary_platorm] == false ? false : true
28       end
29     end
30 
31     def self.default_version
32       '> 0.0.0'
33     end
34     
35     def self.default_platform
36       if GemInstaller::RubyGemsVersionChecker.matches?('>0.9.5')
37         Gem::Platform::CURRENT
38       else
39         # Not sure if this is actually required for RubyGems <=0.9.5, but it 
40         # was the original value in GemInstaller <=0.3.0, and makes the tests pass
41         'ruby'
42       end
43     end
44 
45     def <=>(other)
46       compare = @name <=> other.name
47       return compare if compare != 0
48       compare = @version <=> other.version # TODO: this should use rubygems version comparison, not string comparison
49       return compare if compare != 0
50       return 0 if (@platform == nil && other.platform == nil)
51       return @platform <=> other.platform
52     end
53     
54     def regexp_escaped_name
55       Regexp.escape(@name)
56     end
57   end
58 end

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