Geminstaller C0 Coverage Information - RCov

/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rake-0.8.7/lib/rake/alt_system.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rake-0.8.7/lib/rake/alt_system.rb 108 64
46.30%
28.12%

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 (c) 2008 James M. Lawrence
3 # 
4 # Permission is hereby granted, free of charge, to any person
5 # obtaining a copy of this software and associated documentation files
6 # (the "Software"), to deal in the Software without restriction,
7 # including without limitation the rights to use, copy, modify, merge,
8 # publish, distribute, sublicense, and/or sell copies of the Software,
9 # and to permit persons to whom the Software is furnished to do so,
10 # subject to the following conditions:
11 # 
12 # The above copyright notice and this permission notice shall be
13 # included in all copies or substantial portions of the Software.
14 # 
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 # SOFTWARE.
23 #
24 
25 require 'rbconfig'
26 
27 #
28 # Alternate implementations of system() and backticks `` on Windows
29 # for ruby-1.8 and earlier.
30 # 
31 module Rake::AltSystem
32   WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
33 
34   class << self
35     def define_module_function(name, &block)
36       define_method(name, &block)
37       module_function(name)
38     end
39   end
40     
41   if WINDOWS and RUBY_VERSION < "1.9.0"
42     RUNNABLE_EXTS = %w[com exe bat cmd]
43     RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
44 
45     define_module_function :kernel_system, &Kernel.method(:system)
46     define_module_function :kernel_backticks, &Kernel.method(:'`')
47 
48     module_function
49 
50     def repair_command(cmd)
51       "call " + (
52         if cmd =~ %r!\A\s*\".*?\"!
53           # already quoted
54           cmd
55         elsif match = cmd.match(%r!\A\s*(\S+)!)
56           if match[1] =~ %r!/!
57             # avoid x/y.bat interpretation as x with option /y
58             %Q!"#{match[1]}"! + match.post_match
59           else
60             # a shell command will fail if quoted
61             cmd
62           end
63         else
64           # empty or whitespace
65           cmd
66         end
67       )
68     end
69 
70     def find_runnable(file)
71       if file =~ RUNNABLE_PATTERN
72         file
73       else
74         RUNNABLE_EXTS.each { |ext|
75           if File.exist?(test = "#{file}.#{ext}")
76             return test
77           end
78         }
79         nil
80       end
81     end
82 
83     def system(cmd, *args)
84       repaired = (
85         if args.empty?
86           [repair_command(cmd)]
87         elsif runnable = find_runnable(cmd)
88           [File.expand_path(runnable), *args]
89         else
90           # non-existent file
91           [cmd, *args]
92         end
93       )
94       kernel_system(*repaired)
95     end
96 
97     def backticks(cmd)
98       kernel_backticks(repair_command(cmd))
99     end
100 
101     define_module_function :'`', &method(:backticks)
102   else
103     # Non-Windows or ruby-1.9+: same as Kernel versions
104     define_module_function :system, &Kernel.method(:system)
105     define_module_function :backticks, &Kernel.method(:'`')
106     define_module_function :'`', &Kernel.method(:'`')
107   end
108 end

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