C0 code coverage information

Generated on Wed Oct 07 08:34:06 -0700 2009 with rcov 0.8.2.1


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.
Name Total lines Lines of code Total coverage Code coverage
lib/buildr/shell.rb 180 134
76.7%  
70.1%  
  1 # Licensed to the Apache Software Foundation (ASF) under one or more
  2 # contributor license agreements.  See the NOTICE file distributed with this
  3 # work for additional information regarding copyright ownership.  The ASF
  4 # licenses this file to you under the Apache License, Version 2.0 (the
  5 # "License"); you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #    http://www.apache.org/licenses/LICENSE-2.0
  9 #
 10 # Unless required by applicable law or agreed to in writing, software
 11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 13 # License for the specific language governing permissions and limitations under
 14 # the License.
 15 
 16 
 17 module Buildr
 18   module ShellProviders
 19     class << self
 20       def add(p)
 21         @providers ||= {}
 22         
 23         if p.lang == :none
 24           @providers[:none] ||= []
 25           @providers[:none] << p
 26         else
 27           @providers[p.lang] = p
 28         end
 29       end
 30       alias :<< :add
 31       
 32       def providers
 33         @providers ||= {}
 34       end
 35       
 36       def each
 37         providers.each do |lang, p|
 38           if lang == :none
 39             p.each do |x|
 40               yield x
 41             end
 42           else
 43             yield p
 44           end
 45         end
 46       end
 47     end
 48   end
 49   
 50   module Shell
 51     class Base
 52       attr_reader :project
 53       
 54       class << self
 55         def lang
 56           :none
 57         end
 58         
 59         def to_sym
 60           @symbol ||= name.split('::').last.downcase.to_sym
 61         end
 62       end
 63       
 64       def initialize(project)
 65         @project = project
 66       end
 67       
 68       def build?
 69         true
 70       end
 71       
 72       def launch
 73         fail 'Not implemented'
 74       end
 75     end
 76     
 77     module JavaRebel
 78       def rebel_home
 79         unless @rebel_home
 80           @rebel_home = ENV['REBEL_HOME'] or ENV['JAVA_REBEL'] or ENV['JAVAREBEL'] or ENV['JAVAREBEL_HOME']
 81           
 82           if @rebel_home and File.directory? @rebel_home
 83             @rebel_home += File::SEPARATOR + 'javarebel.jar'
 84           end
 85         end
 86         
 87         if @rebel_home and File.exists? @rebel_home
 88           @rebel_home
 89         else
 90           nil
 91         end
 92       end
 93       
 94       def rebel_args
 95         if rebel_home
 96           [
 97             '-noverify',
 98             "-javaagent:#{rebel_home}"
 99           ]
100         else
101           []
102         end
103       end
104       
105       def rebel_props(project)
106         {}
107       end
108     end
109   end
110   
111   module ShellExtension
112     include Extension
113     
114     first_time do
115       Project.local_task 'shell'
116       
117       ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" }    # TODO  not working
118     end
119     
120     before_define do |project|
121       ShellProviders.each do |p|
122         name = p.to_sym
123         
124         trace "Defining task #{project.name}:shell:#{name}"
125         
126         p_inst = p.new project
127         deps = if p_inst.build? then [:compile] else [] end
128         
129         project.task "shell:#{name}" => deps do
130           trace "Launching #{name} shell"
131           p_inst.launch
132         end
133       end
134     end
135     
136     after_define do |project|
137       default_shell = project.shell.using
138       
139       if default_shell
140         dep = "shell:#{default_shell.to_sym}"
141         
142         trace "Defining task shell based on #{dep}"
143         project.task :shell => dep
144       else
145         project.task :shell do
146           fail "No shell provider defined for language '#{project.compile.language}'"
147         end
148       end
149     end
150     
151     class ShellConfig
152       def initialize(project)
153         @project = project
154       end
155       
156       def using(*args)
157         if args.size > 0
158           @using ||= args.first
159         else
160           @using ||= find_shell_task
161         end
162       end
163       
164     private
165       def find_shell_task
166         lang = @project.compile.language
167         ShellProviders.providers[lang]
168       end
169     end
170     
171     # TODO  temporary hack
172     def shell
173       @shell ||= ShellConfig.new self
174     end
175   end
176   
177   class Project
178     include ShellExtension
179   end
180 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.2.1.

Valid XHTML 1.0! Valid CSS!