Geminstaller C0 Coverage Information - RCov

spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/version_option.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/version_option.rb 65 38
92.31%
86.84%

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 #--
2 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3 # All rights reserved.
4 # See LICENSE.txt for permissions.
5 #++
6 
7 require 'rubygems'
8 
9 ##
10 # Mixin methods for --version and --platform Gem::Command options.
11 
12 module Gem::VersionOption
13 
14   ##
15   # Add the --platform option to the option parser.
16 
17   def add_platform_option(task = command, *wrap)
18     OptionParser.accept Gem::Platform do |value|
19       if value == Gem::Platform::RUBY then
20         value
21       else
22         Gem::Platform.new value
23       end
24     end
25 
26     add_option('--platform PLATFORM', Gem::Platform,
27                "Specify the platform of gem to #{task}", *wrap) do
28                  |value, options|
29       unless options[:added_platform] then
30         Gem.platforms = [Gem::Platform::RUBY]
31         options[:added_platform] = true
32       end
33 
34       Gem.platforms << value unless Gem.platforms.include? value
35     end
36   end
37 
38   ##
39   # Add the --prerelease option to the option parser.
40 
41   def add_prerelease_option(*wrap)
42     add_option("--[no-]prerelease",
43                "Allow prerelease versions of a gem", *wrap) do |value, options|
44       options[:prerelease] = value
45     end
46   end
47 
48   ##
49   # Add the --version option to the option parser.
50 
51   def add_version_option(task = command, *wrap)
52     OptionParser.accept Gem::Requirement do |value|
53       Gem::Requirement.new value
54     end
55 
56     add_option('-v', '--version VERSION', Gem::Requirement,
57                "Specify version of gem to #{task}", *wrap) do
58                  |value, options|
59       options[:version] = value
60       options[:prerelease] = true if value.prerelease?
61     end
62   end
63 
64 end
65 

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