C0 code coverage information

Generated on Wed Oct 07 08:33:58 -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/core/shell.rb 198 145
49.5%  
39.3%  
  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 require 'buildr/shell'
 18 require 'buildr/java/commands'
 19 require 'buildr/core/util'
 20 
 21 module Buildr
 22   module Shell
 23 
 24     class BeanShell < Base
 25       
 26       include JavaRebel
 27       
 28       VERSION = '2.0b4'
 29 
 30       class << self
 31         def version
 32           Buildr.settings.build['bsh'] || VERSION
 33         end
 34         
 35         def artifact
 36           "org.beanshell:bsh:jar:#{version}"
 37         end
 38         
 39         def lang
 40           :java
 41         end
 42         
 43         def to_sym
 44           :bsh
 45         end
 46       end
 47       
 48       def launch
 49         cp = project.compile.dependencies + [project.path_to(:target, :classes), Buildr.artifact(BeanShell.artifact)]
 50         Java::Commands.java 'bsh.Console', {
 51           :properties => rebel_props(project),
 52           :classpath => cp,
 53           :java_args => rebel_args
 54         }
 55       end
 56       
 57     end # BeanShell
 58 
 59         
 60     class JIRB < Base
 61       include JavaRebel
 62       
 63       JRUBY_VERSION = '1.3.1'
 64       
 65       class << self        
 66         def lang
 67           :none
 68         end
 69       end
 70       
 71       def launch
 72         if jruby_home     # if JRuby is installed, use it
 73           cp = project.compile.dependencies + 
 74             [project.path_to(:target, :classes)] +
 75             Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}*.jar")
 76           
 77           props = {
 78             'jruby.home' => jruby_home,
 79             'jruby.lib' => "#{jruby_home}#{File::SEPARATOR}lib"
 80           }
 81           
 82           if not Util.win_os?
 83             uname = `uname -m`
 84             cpu = if uname =~ /i[34567]86/
 85               'i386'
 86             elsif uname == 'i86pc'
 87               'x86'
 88             elsif uname =~ /amd64|x86_64/
 89               'amd64'
 90             end
 91             
 92             os = `uname -s | tr '[A-Z]' '[a-z]'`
 93             path = if os == 'darwin'
 94               'darwin'
 95             else
 96               "#{os}-#{cpu}"
 97             end
 98             
 99             props['jna.boot.library.path'] = "#{jruby_home}/lib/native/#{path}"
100           end
101           
102           props['jruby.script'] = if Util.win_os? then 'jruby.bat' else 'jruby' end
103           props['jruby.shell'] = if Util.win_os? then 'cmd.exe' else '/bin/sh' end
104           
105           args = [
106             "-Xbootclasspath/a:#{Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}jruby*.jar").join File::PATH_SEPARATOR}"
107           ]
108           
109           Java::Commands.java 'org.jruby.Main', "#{jruby_home}#{File::SEPARATOR}bin#{File::SEPARATOR}jirb", {
110             :properties => props.merge(rebel_props(project)),
111             :classpath => cp,
112             :java_args => args + rebel_args
113           }
114         else
115           cp = project.compile.dependencies + [
116               jruby_artifact,
117               project.path_to(:target, :classes)
118             ]
119           
120           Java::Commands.java 'org.jruby.Main', '--command', 'irb', {
121             :properties => rebel_props(project),
122             :classpath => cp,
123             :java_args => rebel_args
124           }
125         end
126       end
127     private
128       def jruby_home
129         @jruby_home ||= RUBY_PLATFORM =~ /java/ ? Config::CONFIG['prefix'] : ENV['JRUBY_HOME']
130       end
131 
132       def jruby_artifact
133         version = Buildr.settings.build['jruby'] || JRUBY_VERSION
134         "org.jruby:jruby-complete:jar:#{version}"
135       end
136     
137     end
138     
139     class Clojure < Base
140       include JavaRebel
141       
142       JLINE_VERSION = '0.9.94'
143       
144       class << self
145         def lang
146           :none
147         end
148         
149         def to_sym
150           :clj      # more common than `clojure`
151         end
152       end
153       
154       # don't build if it's *only* Clojure sources
155       def build?
156         !has_source?(:clojure) or has_source?(:java) or has_source?(:scala) or has_source?(:groovy)
157       end
158       
159       def launch
160         fail 'Are we forgetting something? CLOJURE_HOME not set.' unless clojure_home
161         
162         cp = project.compile.dependencies + 
163           [
164             if build?
165               project.path_to(:target, :classes)
166             else
167               project.path_to(:src, :main, :clojure)
168             end,
169             File.expand_path('clojure.jar', clojure_home),
170             'jline:jline:jar:0.9.94'
171           ]
172         
173         if build?
174           Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', {
175             :properties => rebel_props(project),
176             :classpath => cp,
177             :java_args => rebel_args
178           }
179         else
180           Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', :classpath => cp
181         end
182       end
183       
184     private
185       def clojure_home
186         @home ||= ENV['CLOJURE_HOME']
187       end
188       
189       def has_source?(lang)
190         File.exists? project.path_to(:src, :main, lang)
191       end
192     end
193   end
194 end
195 
196 Buildr::ShellProviders << Buildr::Shell::BeanShell
197 Buildr::ShellProviders << Buildr::Shell::JIRB
198 Buildr::ShellProviders << Buildr::Shell::Clojure

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

Valid XHTML 1.0! Valid CSS!