Buildr C0 Coverage Information - RCov

lib/buildr/core/shell.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/buildr/core/shell.rb 137 95
24.82%
22.11%

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 # 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 
23   module Shell
24 
25     class BeanShell < Base
26       include Buildr::JRebel
27 
28       VERSION = '2.0b4'
29 
30       specify :name => :bsh, :languages => [:java]
31 
32       class << self
33         def version
34           Buildr.settings.build['bsh'] || VERSION
35         end
36 
37         def artifact
38           "org.beanshell:bsh:jar:#{version}"
39         end
40       end
41 
42       def launch(task)
43         cp = ( project.compile.dependencies +
44                [project.path_to(:target, :classes), Buildr.artifact(BeanShell.artifact)] +
45                task.classpath )
46         Java::Commands.java 'bsh.Console', {
47           :properties => jrebel_props(project).merge(task.properties),
48           :classpath => cp,
49           :java_args => jrebel_args + task.java_args
50         }
51       end
52 
53     end # BeanShell
54 
55 
56     class JIRB < Base
57       include JRebel
58 
59       JRUBY_VERSION = '1.6.2'
60 
61       def launch(task)
62         if jruby_home     # if JRuby is installed, use it
63           cp = project.compile.dependencies +
64             [project.path_to(:target, :classes)] +
65             Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}*.jar") +
66             task.classpath
67 
68           props = {
69             'jruby.home' => jruby_home,
70             'jruby.lib' => "#{jruby_home}#{File::SEPARATOR}lib"
71           }
72           props.merge! jrebel_props(project)
73           props.merge! task.properties
74 
75           if not Util.win_os?
76             uname = `uname -m`
77             cpu = if uname =~ /i[34567]86/
78               'i386'
79             elsif uname == 'i86pc'
80               'x86'
81             elsif uname =~ /amd64|x86_64/
82               'amd64'
83             end
84 
85             os = `uname -s | tr '[A-Z]' '[a-z]'`
86             path = if os == 'darwin'
87               'darwin'
88             else
89               "#{os}-#{cpu}"
90             end
91 
92             props['jna.boot.library.path'] = "#{jruby_home}/lib/native/#{path}"
93           end
94 
95           props['jruby.script'] = if Util.win_os? then 'jruby.bat' else 'jruby' end
96           props['jruby.shell'] = if Util.win_os? then 'cmd.exe' else '/bin/sh' end
97 
98           args = [
99             "-Xbootclasspath/a:#{Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}jruby*.jar").join File::PATH_SEPARATOR}"
100           ] + jrebel_args + task.java_args
101 
102           Java::Commands.java 'org.jruby.Main', "#{jruby_home}#{File::SEPARATOR}bin#{File::SEPARATOR}jirb", {
103             :properties => props,
104             :classpath => cp,
105             :java_args => args
106           }
107         else
108           cp = project.compile.dependencies + [ jruby_artifact, project.path_to(:target, :classes) ] +
109                task.classpath
110           props = jrebel_props(project).merge(task.properties)
111           args = jrebel_args + task.java_args
112 
113           Java::Commands.java 'org.jruby.Main', '--command', 'irb', {
114             :properties => props,
115             :classpath => cp,
116             :java_args => args
117           }
118         end
119       end
120 
121     private
122       def jruby_home
123         @jruby_home ||= RUBY_PLATFORM =~ /java/ ? Config::CONFIG['prefix'] : ENV['JRUBY_HOME']
124       end
125 
126       def jruby_artifact
127         version = Buildr.settings.build['jruby'] || JRUBY_VERSION
128         "org.jruby:jruby-complete:jar:#{version}"
129       end
130 
131     end
132   end
133 end
134 
135 Buildr::Shell.providers << Buildr::Shell::BeanShell
136 Buildr::Shell.providers << Buildr::Shell::JIRB
137 

Generated on 2011-07-06 23:35:37 -0700 with rcov 0.9.8