bee_java 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bee2maven +2 -0
- data/bin/gendeps +59 -17
- data/bin/maven2bee +40 -1
- data/build/README +1 -1
- data/egg/lib/build.erb +4 -50
- data/egg/lib/dependencies.yml +5 -4
- data/egg/lib/source.erb +4 -0
- data/egg/lib.yml +12 -12
- data/egg/servlet/build.yml +18 -68
- data/egg/servlet/dependencies.yml +2 -1
- data/egg/servlet/tomcat.yml +0 -1
- data/egg/servlet/web.xml +2 -1
- data/egg/servlet.yml +1 -1
- data/egg/tiny/build.erb +5 -31
- data/egg/tiny/dependencies.yml +6 -0
- data/egg/tiny.yml +12 -11
- data/egg/xmlrpc/build.yml +12 -47
- data/egg/xmlrpc/dependencies.yml +1 -2
- data/egg/xmlrpc.yml +10 -10
- data/java.yml +144 -0
- data/lib/bee_task_java.rb +20 -14
- data/lib/dependency_resolver.rb +94 -66
- data/maven2.yml +15 -0
- metadata +52 -43
- data/bin/beedoc +0 -800
- data/test/build.yml +0 -125
- data/test/dependencies.xml +0 -11
- data/test/dependencies.yml +0 -3
- data/test/manifest.erb +0 -1
- data/test/pom.xml +0 -31
- data/test/src/test/Test.java +0 -28
- data/test/tc_bee_task_java.rb +0 -194
- data/test/tc_dependency_resolver.rb +0 -36
- data/test/test/test/TestTest.java +0 -28
- data/test/test_build.rb +0 -26
- data/test/test_build_listener.rb +0 -110
data/test/build.yml
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
# Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
- build: test_java
|
16
|
-
default: all
|
17
|
-
description: Build file to test Java package
|
18
|
-
|
19
|
-
- properties:
|
20
|
-
- name: "test"
|
21
|
-
- src: "src"
|
22
|
-
- build: "build"
|
23
|
-
- classes: "#{build}/classes"
|
24
|
-
- javadoc: "#{build}/api"
|
25
|
-
- jar: "#{build}/#{name}.jar"
|
26
|
-
- erb: "manifest.erb"
|
27
|
-
- manifest: "#{build}/manifest"
|
28
|
-
- main: "test.Test"
|
29
|
-
- classpath: :jar
|
30
|
-
- junit: "/opt/java/junit-4.4"
|
31
|
-
- test: "test"
|
32
|
-
- test_classes: "#{build}/test-classes"
|
33
|
-
- lib: "#{build}/lib"
|
34
|
-
|
35
|
-
- target: javac
|
36
|
-
description: Test javac task
|
37
|
-
script:
|
38
|
-
- java.javac:
|
39
|
-
src: :src
|
40
|
-
dest: :classes
|
41
|
-
|
42
|
-
- target: jar
|
43
|
-
depends: javac
|
44
|
-
description: Test jar task
|
45
|
-
script:
|
46
|
-
- erb:
|
47
|
-
src: :erb
|
48
|
-
dest: :manifest
|
49
|
-
- java.jar:
|
50
|
-
src: :classes
|
51
|
-
manifest: :manifest
|
52
|
-
dest: :jar
|
53
|
-
|
54
|
-
- target: junit
|
55
|
-
depends: javac
|
56
|
-
description: Run unit tests
|
57
|
-
script:
|
58
|
-
- find:
|
59
|
-
includes: "#{junit}/junit*.jar"
|
60
|
-
excludes: "#{junit}/junit*-src.jar"
|
61
|
-
property: junit_cp
|
62
|
-
- java.javac:
|
63
|
-
src: :test
|
64
|
-
dest: :test_classes
|
65
|
-
classpath: [:junit_cp, :classes]
|
66
|
-
- java.junit:
|
67
|
-
classpath: [:classes, :test_classes, :junit_cp]
|
68
|
-
src: :test
|
69
|
-
|
70
|
-
- target: javadoc
|
71
|
-
description: Document Java source files
|
72
|
-
script:
|
73
|
-
- java.javadoc:
|
74
|
-
src: :src
|
75
|
-
dest: :javadoc
|
76
|
-
|
77
|
-
- target: java
|
78
|
-
depends: jar
|
79
|
-
description: Run java program
|
80
|
-
script:
|
81
|
-
- java.java:
|
82
|
-
main: :main
|
83
|
-
classpath: :classpath
|
84
|
-
properties: { who: World }
|
85
|
-
- java.java:
|
86
|
-
main: :main
|
87
|
-
classpath: :classes
|
88
|
-
properties: { who: World }
|
89
|
-
- java.java:
|
90
|
-
jar: :jar
|
91
|
-
properties: { who: World }
|
92
|
-
|
93
|
-
- target: deps
|
94
|
-
description: Fetch dependencies
|
95
|
-
script:
|
96
|
-
# maven 1 repository
|
97
|
-
- rmdir: :build
|
98
|
-
- java.deps:
|
99
|
-
src: dependencies.yml
|
100
|
-
dest: :lib
|
101
|
-
repos: http://www.ibiblio.org/maven
|
102
|
-
# maven 2 repository
|
103
|
-
- rmdir: :build
|
104
|
-
- java.deps:
|
105
|
-
src: dependencies.xml
|
106
|
-
dest: :lib
|
107
|
-
repos: http://repo1.maven.org/maven2
|
108
|
-
repotype: maven2
|
109
|
-
|
110
|
-
- target: classpath
|
111
|
-
description: Compute a classpath
|
112
|
-
script:
|
113
|
-
#- java.clean:
|
114
|
-
- java.classpath:
|
115
|
-
file: pom.xml
|
116
|
-
property: classpath
|
117
|
-
- print: :classpath
|
118
|
-
|
119
|
-
- target: clean
|
120
|
-
description: Clean generated files
|
121
|
-
script:
|
122
|
-
- rmdir: :build
|
123
|
-
|
124
|
-
- target: all
|
125
|
-
depends: [clean, javac, jar, junit, javadoc, java, deps]
|
data/test/dependencies.xml
DELETED
data/test/dependencies.yml
DELETED
data/test/manifest.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Main-Class: <%= main %>
|
data/test/pom.xml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
|
3
|
-
<project>
|
4
|
-
|
5
|
-
<modelVersion>4.0.0</modelVersion>
|
6
|
-
<groupId>test</groupId>
|
7
|
-
<artifactId>test</artifactId>
|
8
|
-
<name>Test</name>
|
9
|
-
<version>1.0.0</version>
|
10
|
-
|
11
|
-
<repositories>
|
12
|
-
<repository>
|
13
|
-
<id>central</id>
|
14
|
-
<name>Maven Repository Switchboard</name>
|
15
|
-
<layout>default</layout>
|
16
|
-
<url>http://repo1.maven.org/maven2</url>
|
17
|
-
<snapshots>
|
18
|
-
<enabled>false</enabled>
|
19
|
-
</snapshots>
|
20
|
-
</repository>
|
21
|
-
</repositories>
|
22
|
-
|
23
|
-
<dependencies>
|
24
|
-
<dependency>
|
25
|
-
<groupId>ehcache</groupId>
|
26
|
-
<artifactId>ehcache</artifactId>
|
27
|
-
<version>1.2beta4</version>
|
28
|
-
</dependency>
|
29
|
-
</dependencies>
|
30
|
-
|
31
|
-
</project>
|
data/test/src/test/Test.java
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
// Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
|
2
|
-
//
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
// you may not use this file except in compliance with the License.
|
5
|
-
// You may obtain a copy of the License at
|
6
|
-
//
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
//
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
// See the License for the specific language governing permissions and
|
13
|
-
// limitations under the License.
|
14
|
-
|
15
|
-
package test;
|
16
|
-
|
17
|
-
public class Test {
|
18
|
-
|
19
|
-
public static void main(String[] args) {
|
20
|
-
String who = System.getProperty("who");
|
21
|
-
System.out.println(hello(who));
|
22
|
-
}
|
23
|
-
|
24
|
-
public static String hello(String who) {
|
25
|
-
return "Hello "+who+"!";
|
26
|
-
}
|
27
|
-
|
28
|
-
}
|
data/test/tc_bee_task_java.rb
DELETED
@@ -1,194 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'bee_context'
|
18
|
-
require 'test/unit'
|
19
|
-
$:.unshift(File.expand_path(File.dirname(__FILE__)))
|
20
|
-
require 'test_build'
|
21
|
-
require 'test_build_listener'
|
22
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
23
|
-
require 'bee_task_java'
|
24
|
-
|
25
|
-
# Test case for bee task.
|
26
|
-
class TestBeeTaskJava < Test::Unit::TestCase
|
27
|
-
|
28
|
-
# Create a context object and load tasks in it.
|
29
|
-
def setup
|
30
|
-
super
|
31
|
-
@context = Bee::Context.new()
|
32
|
-
@listener = TestBuildListener.new
|
33
|
-
@build = TestBuild.new(@context, @listener)
|
34
|
-
@package = Bee::Task::Java.new(@build)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_javac
|
38
|
-
# change directory to test dir
|
39
|
-
previous_dir = Dir.pwd
|
40
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
41
|
-
begin
|
42
|
-
# run nominal case
|
43
|
-
@package.javac({'src' => 'src', 'dest' => 'build/classes'})
|
44
|
-
assert_equal("Compiling 1 Java source file(s)\n", @listener.output)
|
45
|
-
assert(File.exists?('build/classes/test/Test.class'))
|
46
|
-
# run error case: missing src parameter
|
47
|
-
begin
|
48
|
-
@package.javac({'dest' => 'build/classes'})
|
49
|
-
rescue
|
50
|
-
assert_equal("javac 'src' parameter is mandatory", $!.message)
|
51
|
-
end
|
52
|
-
# run error case: missing dest parameter
|
53
|
-
begin
|
54
|
-
@package.javac({'src' => 'src'})
|
55
|
-
rescue
|
56
|
-
assert_equal("javac 'dest' parameter is mandatory", $!.message)
|
57
|
-
end
|
58
|
-
ensure
|
59
|
-
if File.exists?('build')
|
60
|
-
FileUtils.rm_rf('build')
|
61
|
-
end
|
62
|
-
Dir.chdir(previous_dir)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_jar
|
67
|
-
# change directory to test dir
|
68
|
-
previous_dir = Dir.pwd
|
69
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
70
|
-
begin
|
71
|
-
# run nominal case
|
72
|
-
@package.javac({'src' => 'src', 'dest' => 'build/classes'})
|
73
|
-
@listener.clear()
|
74
|
-
@package.jar({'src' => 'build/classes', 'dest' => 'build/test.jar'})
|
75
|
-
assert_equal("Processing Jar archive 'build/test.jar'\n",
|
76
|
-
@listener.output)
|
77
|
-
assert(File.exists?('build/test.jar'))
|
78
|
-
ensure
|
79
|
-
if File.exists?('build')
|
80
|
-
FileUtils.rm_rf('build')
|
81
|
-
end
|
82
|
-
Dir.chdir(previous_dir)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_java
|
87
|
-
# change directory to test dir
|
88
|
-
previous_dir = Dir.pwd
|
89
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
90
|
-
begin
|
91
|
-
# run nominal case
|
92
|
-
@package.javac({'src' => 'src', 'dest' => 'build/classes'})
|
93
|
-
@listener.clear()
|
94
|
-
@package.java({'classpath' => 'build/classes', 'main' => 'test.Test'})
|
95
|
-
assert_equal("Running java class 'test.Test'\n",
|
96
|
-
@listener.output)
|
97
|
-
ensure
|
98
|
-
if File.exists?('build')
|
99
|
-
FileUtils.rm_rf('build')
|
100
|
-
end
|
101
|
-
Dir.chdir(previous_dir)
|
102
|
-
end
|
103
|
-
1 end
|
104
|
-
|
105
|
-
def test_javadoc
|
106
|
-
# change directory to test dir
|
107
|
-
previous_dir = Dir.pwd
|
108
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
109
|
-
begin
|
110
|
-
# run nominal case
|
111
|
-
@package.javadoc({'src' => 'src', 'dest' => 'build/api'})
|
112
|
-
assert_equal("Running javadoc on 1 Java source file(s)\n",
|
113
|
-
@listener.output)
|
114
|
-
assert(File.exists?('build/api/index.html'))
|
115
|
-
ensure
|
116
|
-
if File.exists?('build')
|
117
|
-
FileUtils.rm_rf('build')
|
118
|
-
end
|
119
|
-
Dir.chdir(previous_dir)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_junit
|
124
|
-
if ENV['NET_TEST'] == 'true'
|
125
|
-
# change directory to test dir
|
126
|
-
previous_dir = Dir.pwd
|
127
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
128
|
-
begin
|
129
|
-
# run nominal case
|
130
|
-
@package.javac({'src' => 'src', 'dest' => 'build/classes'})
|
131
|
-
@package.deps({ 'src' => 'dependencies.yml', 'dest' => 'build/lib',
|
132
|
-
'repos' => 'http://www.ibiblio.org/maven'})
|
133
|
-
@package.javac({ 'src' => 'test',
|
134
|
-
'dest' => 'build/classes',
|
135
|
-
'classpath' => ['build/classes', 'build/lib/*.jar']})
|
136
|
-
@listener.clear()
|
137
|
-
@package.junit({ 'src' => 'test',
|
138
|
-
'classpath' => ['build/classes', 'build/lib/*.jar']})
|
139
|
-
assert_equal("Running JUnit on 1 test file(s)\n",
|
140
|
-
@listener.output)
|
141
|
-
ensure
|
142
|
-
if File.exists?('build')
|
143
|
-
FileUtils.rm_rf('build')
|
144
|
-
end
|
145
|
-
Dir.chdir(previous_dir)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_deps
|
151
|
-
if ENV['NET_TEST'] == 'true'
|
152
|
-
# change directory to test dir
|
153
|
-
previous_dir = Dir.pwd
|
154
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
155
|
-
begin
|
156
|
-
# run nominal case
|
157
|
-
@package.deps({ 'src' => 'dependencies.yml',
|
158
|
-
'dest' => 'build/lib',
|
159
|
-
'repos' => 'http://www.ibiblio.org/maven'})
|
160
|
-
assert_equal("Fetching 1 dependency(ies) to directory 'build/lib'\n",
|
161
|
-
@listener.output)
|
162
|
-
assert(File.exists?('build/lib/junit-4.3.jar'))
|
163
|
-
ensure
|
164
|
-
if File.exists?('build')
|
165
|
-
FileUtils.rm_rf('build')
|
166
|
-
end
|
167
|
-
Dir.chdir(previous_dir)
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def test_classpath
|
173
|
-
if ENV['NET_TEST'] == 'true'
|
174
|
-
# change directory to test dir
|
175
|
-
previous_dir = Dir.pwd
|
176
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
177
|
-
begin
|
178
|
-
@package.classpath( { 'file' => 'pom.xml',
|
179
|
-
'property' => 'classpath' } )
|
180
|
-
dependencies = ['ehcache:ehcache:1.2beta4:jar',
|
181
|
-
'commons-logging-api:commons-logging:1.0.4:jar',
|
182
|
-
'commons-collections:commons-collections:2.1.1:jar']
|
183
|
-
message = dependencies.map { |dep| "Downloading dependency '#{dep}'...\n" }.join
|
184
|
-
assert_equal(messages, @listener.output)
|
185
|
-
root = File.expand('~/.m2/repository')
|
186
|
-
puts 'TEST'
|
187
|
-
puts @package.build.get_property('classpath')
|
188
|
-
ensure
|
189
|
-
Dir.chdir(previous_dir)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'bee_context'
|
18
|
-
require 'test/unit'
|
19
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
20
|
-
require 'dependency_resolver'
|
21
|
-
|
22
|
-
# Test case for dependency resolver.
|
23
|
-
class TestDependencyResolver < Test::Unit::TestCase
|
24
|
-
|
25
|
-
# Create a context object and load tasks in it.
|
26
|
-
def setup
|
27
|
-
super
|
28
|
-
@resolver = Bee::Task::Maven2DependencyResolver.new('test/pom.xml', false)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_classpath
|
32
|
-
classpath = @resolver.classpath
|
33
|
-
# TODO
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
// Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
|
2
|
-
//
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
// you may not use this file except in compliance with the License.
|
5
|
-
// You may obtain a copy of the License at
|
6
|
-
//
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
//
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
// See the License for the specific language governing permissions and
|
13
|
-
// limitations under the License.
|
14
|
-
|
15
|
-
package test;
|
16
|
-
|
17
|
-
import junit.framework.TestCase;
|
18
|
-
|
19
|
-
public class TestTest
|
20
|
-
extends TestCase {
|
21
|
-
|
22
|
-
public void testHello() {
|
23
|
-
String expected = "Hello World!";
|
24
|
-
String actual = Test.hello("World");
|
25
|
-
assertEquals(expected, actual);
|
26
|
-
}
|
27
|
-
|
28
|
-
}
|
data/test/test_build.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# Copyright 2006-2010 Michel Casabianca <michel.casabianca@gmail.com>
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
# Empty build for testing purpose. Contains a single context.
|
16
|
-
class TestBuild
|
17
|
-
|
18
|
-
attr_reader :context
|
19
|
-
attr_reader :listener
|
20
|
-
|
21
|
-
def initialize(context, listener)
|
22
|
-
@context = context
|
23
|
-
@listener = listener
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
data/test/test_build_listener.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# Copyright 2006-2010 Michel Casabianca <michel.casabianca@gmail.com>
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
require 'rubygems'
|
16
|
-
|
17
|
-
class TestBuildListener
|
18
|
-
|
19
|
-
attr_reader :formatter
|
20
|
-
attr_reader :started
|
21
|
-
attr_reader :finished
|
22
|
-
attr_reader :targets
|
23
|
-
attr_reader :tasks
|
24
|
-
attr_reader :success
|
25
|
-
attr_reader :errors
|
26
|
-
attr_accessor :throw_error
|
27
|
-
attr_accessor :prompt
|
28
|
-
|
29
|
-
def initialize()
|
30
|
-
reset
|
31
|
-
end
|
32
|
-
|
33
|
-
def build_started(build, dry=false)
|
34
|
-
@started = true
|
35
|
-
end
|
36
|
-
|
37
|
-
def build_finished()
|
38
|
-
@finished = true
|
39
|
-
end
|
40
|
-
|
41
|
-
def target(target)
|
42
|
-
@targets << target
|
43
|
-
end
|
44
|
-
|
45
|
-
def task(task)
|
46
|
-
@tasks << task
|
47
|
-
end
|
48
|
-
|
49
|
-
def error(exception)
|
50
|
-
if throw_error
|
51
|
-
raise exception
|
52
|
-
else
|
53
|
-
@errors << exception
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def recover
|
58
|
-
@success = true
|
59
|
-
end
|
60
|
-
|
61
|
-
def reset
|
62
|
-
@formatter = TestBuildFormatter.new(self)
|
63
|
-
@started = false
|
64
|
-
@finished = false
|
65
|
-
@targets = []
|
66
|
-
@tasks = []
|
67
|
-
@success = false
|
68
|
-
@errors = []
|
69
|
-
@throw_error = false
|
70
|
-
@prompt = ''
|
71
|
-
end
|
72
|
-
|
73
|
-
def output()
|
74
|
-
return @formatter.output
|
75
|
-
end
|
76
|
-
|
77
|
-
def clear()
|
78
|
-
@formatter.clear()
|
79
|
-
end
|
80
|
-
|
81
|
-
def error?
|
82
|
-
return @errors.length > 0
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
class TestBuildFormatter
|
88
|
-
|
89
|
-
attr_reader :verbose
|
90
|
-
attr_reader :output
|
91
|
-
|
92
|
-
def initialize(listener)
|
93
|
-
@listener = listener
|
94
|
-
@verbose = false
|
95
|
-
@output = ''
|
96
|
-
end
|
97
|
-
|
98
|
-
def print(text)
|
99
|
-
@output << text
|
100
|
-
end
|
101
|
-
|
102
|
-
def puts(text)
|
103
|
-
@output << text + "\n"
|
104
|
-
end
|
105
|
-
|
106
|
-
def clear()
|
107
|
-
@output = ''
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|