buildr 1.2.10 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +566 -268
- data/DISCLAIMER +7 -1
- data/KEYS +151 -0
- data/NOTICE +23 -8
- data/README +122 -22
- data/Rakefile +49 -229
- data/{lib → addon}/buildr/antlr.rb +23 -10
- data/addon/buildr/cobertura.rb +232 -0
- data/{lib → addon}/buildr/hibernate.rb +20 -4
- data/{lib → addon}/buildr/javacc.rb +27 -12
- data/addon/buildr/jdepend.rb +60 -0
- data/{lib → addon}/buildr/jetty.rb +34 -18
- data/addon/buildr/nailgun.rb +892 -0
- data/{lib → addon}/buildr/openjpa.rb +23 -6
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/{lib/buildr/jetty → addon/buildr/org/apache/buildr}/JettyWrapper.java +19 -0
- data/{lib → addon}/buildr/xmlbeans.rb +39 -14
- data/bin/buildr +21 -7
- data/buildr.gemspec +50 -0
- data/doc/css/default.css +225 -0
- data/doc/css/print.css +95 -0
- data/doc/css/syntax.css +43 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +317 -0
- data/doc/pages/building.textile +501 -0
- data/doc/pages/contributing.textile +178 -0
- data/doc/pages/download.textile +25 -0
- data/doc/pages/extending.textile +229 -0
- data/doc/pages/getting_started.textile +337 -0
- data/doc/pages/index.textile +63 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +367 -0
- data/doc/pages/packaging.textile +592 -0
- data/doc/pages/projects.textile +449 -0
- data/doc/pages/recipes.textile +127 -0
- data/doc/pages/settings_profiles.textile +339 -0
- data/doc/pages/testing.textile +475 -0
- data/doc/pages/troubleshooting.textile +121 -0
- data/doc/pages/whats_new.textile +389 -0
- data/doc/print.haml +52 -0
- data/doc/print.toc.yaml +28 -0
- data/doc/scripts/buildr-git.rb +411 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +55 -0
- data/doc/site.toc.yaml +44 -0
- data/lib/buildr.rb +28 -45
- data/lib/buildr/core.rb +27 -0
- data/lib/buildr/core/application.rb +373 -0
- data/lib/buildr/core/application_cli.rb +134 -0
- data/lib/{core → buildr/core}/build.rb +91 -77
- data/lib/{core → buildr/core}/checks.rb +116 -95
- data/lib/buildr/core/common.rb +155 -0
- data/lib/buildr/core/compile.rb +594 -0
- data/lib/buildr/core/environment.rb +120 -0
- data/lib/buildr/core/filter.rb +258 -0
- data/lib/{core → buildr/core}/generate.rb +22 -5
- data/lib/buildr/core/help.rb +118 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/{core → buildr/core}/project.rb +468 -213
- data/lib/buildr/core/test.rb +690 -0
- data/lib/{core → buildr/core}/transports.rb +107 -127
- data/lib/buildr/core/util.rb +235 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/{java → buildr/ide}/eclipse.rb +86 -60
- data/lib/{java → buildr/ide}/idea.ipr.template +16 -0
- data/lib/buildr/ide/idea.rb +194 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +210 -0
- data/lib/buildr/java.rb +26 -0
- data/lib/buildr/java/ant.rb +71 -0
- data/lib/buildr/java/bdd_frameworks.rb +267 -0
- data/lib/buildr/java/commands.rb +210 -0
- data/lib/buildr/java/compilers.rb +432 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/groovyc.rb +137 -0
- data/lib/buildr/java/jruby.rb +99 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail.class +0 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail.java +41 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +116 -0
- data/lib/buildr/java/packaging.rb +706 -0
- data/lib/{java → buildr/java}/pom.rb +20 -4
- data/lib/buildr/java/rjb.rb +142 -0
- data/lib/buildr/java/test_frameworks.rb +290 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +21 -0
- data/lib/{java → buildr/packaging}/artifact.rb +170 -179
- data/lib/buildr/packaging/artifact_namespace.rb +957 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/{tasks → buildr/packaging}/tar.rb +18 -1
- data/lib/{tasks → buildr/packaging}/zip.rb +153 -105
- data/rakelib/apache.rake +126 -0
- data/rakelib/changelog.rake +56 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +44 -0
- data/rakelib/release.rake +53 -0
- data/rakelib/rspec.rake +81 -0
- data/rakelib/rubyforge.rake +45 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +59 -0
- data/rakelib/stage.rake +45 -0
- data/spec/application_spec.rb +316 -0
- data/spec/archive_spec.rb +494 -0
- data/spec/artifact_namespace_spec.rb +635 -0
- data/spec/artifact_spec.rb +738 -0
- data/spec/build_spec.rb +193 -0
- data/spec/checks_spec.rb +537 -0
- data/spec/common_spec.rb +579 -0
- data/spec/compile_spec.rb +561 -0
- data/spec/groovy_compilers_spec.rb +239 -0
- data/spec/java_bdd_frameworks_spec.rb +238 -0
- data/spec/java_compilers_spec.rb +446 -0
- data/spec/java_packaging_spec.rb +1042 -0
- data/spec/java_test_frameworks_spec.rb +414 -0
- data/spec/packaging_helper.rb +63 -0
- data/spec/packaging_spec.rb +589 -0
- data/spec/project_spec.rb +739 -0
- data/spec/sandbox.rb +116 -0
- data/spec/scala_compilers_spec.rb +239 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helpers.rb +283 -0
- data/spec/test_spec.rb +871 -0
- data/spec/transport_spec.rb +300 -0
- data/spec/version_requirement_spec.rb +115 -0
- metadata +188 -77
- data/lib/buildr/cobertura.rb +0 -89
- data/lib/buildr/jdepend.rb +0 -40
- data/lib/buildr/jetty/JettyWrapper$1.class +0 -0
- data/lib/buildr/jetty/JettyWrapper$BuildrHandler.class +0 -0
- data/lib/buildr/jetty/JettyWrapper.class +0 -0
- data/lib/buildr/scala.rb +0 -368
- data/lib/core/application.rb +0 -188
- data/lib/core/common.rb +0 -562
- data/lib/core/help.rb +0 -72
- data/lib/core/rake_ext.rb +0 -81
- data/lib/java/ant.rb +0 -71
- data/lib/java/compile.rb +0 -589
- data/lib/java/idea.rb +0 -159
- data/lib/java/java.rb +0 -432
- data/lib/java/packaging.rb +0 -581
- data/lib/java/test.rb +0 -795
- data/lib/tasks/concat.rb +0 -35
data/spec/build_spec.rb
ADDED
@@ -0,0 +1,193 @@
|
|
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 File.join(File.dirname(__FILE__), 'spec_helpers')
|
18
|
+
|
19
|
+
|
20
|
+
describe 'local task', :shared=>true do
|
21
|
+
it "should execute task for project in current directory" do
|
22
|
+
define 'foobar'
|
23
|
+
lambda { @task.invoke }.should run_task("foobar:#{@task.name}")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should not execute task for projects in other directory" do
|
27
|
+
define 'foobar', :base_dir=>'elsewhere'
|
28
|
+
lambda { task('build').invoke }.should_not run_task('foobar:build')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
describe 'build task' do
|
34
|
+
it_should_behave_like 'local task'
|
35
|
+
before(:each) { @task = task('build') }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'clean task' do
|
39
|
+
it_should_behave_like 'local task'
|
40
|
+
before(:each) { @task = task('clean') }
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'package task' do
|
44
|
+
it_should_behave_like 'local task'
|
45
|
+
before(:each) { @task = task('package') }
|
46
|
+
|
47
|
+
it 'should execute build task as prerequisite' do
|
48
|
+
lambda { @task.invoke }.should run_task('build')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'install task' do
|
53
|
+
it_should_behave_like 'local task'
|
54
|
+
before(:each) { @task = task('install') }
|
55
|
+
|
56
|
+
it 'should execute package task as prerequisite' do
|
57
|
+
lambda { @task.invoke }.should run_task('package')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'uninstall task' do
|
62
|
+
it_should_behave_like 'local task'
|
63
|
+
before(:each) { @task = task('uninstall') }
|
64
|
+
end
|
65
|
+
|
66
|
+
describe 'upload task' do
|
67
|
+
it_should_behave_like 'local task'
|
68
|
+
before(:each) { @task = task('upload') }
|
69
|
+
|
70
|
+
it 'should execute package task as prerequisite' do
|
71
|
+
lambda { @task.invoke }.should run_task('package')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
describe Project, '#build' do
|
77
|
+
it 'should return the project\'s build task' do
|
78
|
+
define('foo').build.should eql(task('foo:build'))
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should enhance the project\'s build task' do
|
82
|
+
task 'prereq'
|
83
|
+
task 'action'
|
84
|
+
define 'foo' do
|
85
|
+
build 'prereq' do
|
86
|
+
task('action').invoke
|
87
|
+
end
|
88
|
+
end
|
89
|
+
lambda { project('foo').build.invoke }.should run_tasks('prereq', 'action')
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should execute build task for sub-project' do
|
93
|
+
define 'foo' do
|
94
|
+
define 'bar'
|
95
|
+
end
|
96
|
+
lambda { task('foo:build').invoke }.should run_task('foo:bar:build')
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should not execute build task of other projects' do
|
100
|
+
define 'foo'
|
101
|
+
define 'bar'
|
102
|
+
lambda { task('foo:build').invoke }.should_not run_task('bar:build')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
describe Project, '#clean' do
|
108
|
+
it 'should return the project\'s clean task' do
|
109
|
+
define('foo').clean.should eql(task('foo:clean'))
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should enhance the project\'s clean task' do
|
113
|
+
task 'prereq'
|
114
|
+
task 'action'
|
115
|
+
define 'foo' do
|
116
|
+
clean 'prereq' do
|
117
|
+
task('action').invoke
|
118
|
+
end
|
119
|
+
end
|
120
|
+
lambda { project('foo').clean.invoke }.should run_tasks('prereq', 'action')
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should remove target directory' do
|
124
|
+
define 'foo' do
|
125
|
+
self.layout[:target] = 'targeted'
|
126
|
+
end
|
127
|
+
mkpath 'targeted'
|
128
|
+
lambda { project('foo').clean.invoke }.should change { File.exist?('targeted') }.from(true).to(false)
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should remove reports directory' do
|
132
|
+
define 'foo' do
|
133
|
+
self.layout[:reports] = 'reported'
|
134
|
+
end
|
135
|
+
mkpath 'reported'
|
136
|
+
lambda { project('foo').clean.invoke }.should change { File.exist?('reported') }.from(true).to(false)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should execute clean task for sub-project' do
|
140
|
+
define 'foo' do
|
141
|
+
define 'bar'
|
142
|
+
end
|
143
|
+
lambda { task('foo:clean').invoke }.should run_task('foo:bar:clean')
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should not execute clean task of other projects' do
|
147
|
+
define 'foo'
|
148
|
+
define 'bar'
|
149
|
+
lambda { task('foo:clean').invoke }.should_not run_task('bar:clean')
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
describe Project, '#target' do
|
155
|
+
before :each do
|
156
|
+
@project = define('foo', :layout=>Layout.new)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'should default to target' do
|
160
|
+
@project.target.should eql('target')
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'should set layout :target' do
|
164
|
+
@project.target = 'bar'
|
165
|
+
@project.layout.expand(:target).should point_to_path('bar')
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should come from layout :target' do
|
169
|
+
@project.layout[:target] = 'baz'
|
170
|
+
@project.target.should eql('baz')
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
describe Project, '#reports' do
|
176
|
+
before :each do
|
177
|
+
@project = define('foo', :layout=>Layout.new)
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should default to reports' do
|
181
|
+
@project.reports.should eql('reports')
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'should set layout :reports' do
|
185
|
+
@project.reports = 'bar'
|
186
|
+
@project.layout.expand(:reports).should point_to_path('bar')
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'should come from layout :reports' do
|
190
|
+
@project.layout[:reports] = 'baz'
|
191
|
+
@project.reports.should eql('baz')
|
192
|
+
end
|
193
|
+
end
|
data/spec/checks_spec.rb
ADDED
@@ -0,0 +1,537 @@
|
|
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 File.join(File.dirname(__FILE__), 'spec_helpers')
|
18
|
+
|
19
|
+
|
20
|
+
describe Project, " check task" do
|
21
|
+
|
22
|
+
it "should execute last thing from package task" do
|
23
|
+
task "action"
|
24
|
+
define "foo", :version=>"1.0" do
|
25
|
+
package :jar
|
26
|
+
task("package").enhance { task("action").invoke }
|
27
|
+
end
|
28
|
+
lambda { project("foo").task("package").invoke }.should run_tasks(["foo:package", "action", "foo:check"])
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should execute all project's expectations" do
|
32
|
+
task "expectation"
|
33
|
+
define "foo", :version=>"1.0" do
|
34
|
+
check { task("expectation").invoke }
|
35
|
+
end
|
36
|
+
lambda { project("foo").task("package").invoke }.should run_task("expectation")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should succeed if there are no expectations" do
|
40
|
+
define "foo", :version=>"1.0"
|
41
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should succeed if all expectations passed" do
|
45
|
+
define "foo", :version=>"1.0" do
|
46
|
+
check { true }
|
47
|
+
check { false }
|
48
|
+
end
|
49
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should fail if any expectation failed" do
|
53
|
+
define "foo", :version=>"1.0" do
|
54
|
+
check
|
55
|
+
check { fail "sorry" }
|
56
|
+
check
|
57
|
+
end
|
58
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
describe Project, "#check" do
|
64
|
+
|
65
|
+
it "should add expectation" do
|
66
|
+
define "foo" do
|
67
|
+
expectations.should be_empty
|
68
|
+
check
|
69
|
+
expectations.size.should be(1)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should treat no arguments as expectation against project" do
|
74
|
+
define "foo" do
|
75
|
+
subject = self
|
76
|
+
check do
|
77
|
+
it.should be(subject)
|
78
|
+
description.should eql(subject.to_s)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should treat single string argument as description, expectation against project" do
|
85
|
+
define "foo" do
|
86
|
+
subject = self
|
87
|
+
check "should be project" do
|
88
|
+
it.should be(subject)
|
89
|
+
description.should eql("#{subject} should be project")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should treat single object argument as subject" do
|
96
|
+
define "foo" do
|
97
|
+
subject = Object.new
|
98
|
+
check subject do
|
99
|
+
it.should be(subject)
|
100
|
+
description.should eql(subject.to_s)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should treat first object as subject, second object as description" do
|
107
|
+
define "foo" do
|
108
|
+
subject = Object.new
|
109
|
+
check subject, "should exist" do
|
110
|
+
it.should be(subject)
|
111
|
+
description.should eql("#{subject} should exist")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should work without block" do
|
118
|
+
define "foo" do
|
119
|
+
check "implement later"
|
120
|
+
end
|
121
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
describe Buildr::Checks::Expectation, " matchers" do
|
127
|
+
|
128
|
+
it "should include Buildr matchers exist and contain" do
|
129
|
+
define "foo" do
|
130
|
+
check do
|
131
|
+
self.should respond_to(:exist)
|
132
|
+
self.should respond_to(:contain)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should include RSpec matchers like be and eql" do
|
139
|
+
define "foo" do
|
140
|
+
check do
|
141
|
+
self.should respond_to(:be)
|
142
|
+
self.should respond_to(:eql)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should include RSpec predicates like be_nil and be_empty" do
|
149
|
+
define "foo" do
|
150
|
+
check do
|
151
|
+
nil.should be_nil
|
152
|
+
[].should be_empty
|
153
|
+
end
|
154
|
+
end
|
155
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
describe Buildr::Checks::Expectation, " exist" do
|
161
|
+
|
162
|
+
it "should pass if file exists" do
|
163
|
+
define "foo" do
|
164
|
+
build file("test") { |task| write task.name }
|
165
|
+
check(file("test")) { it.should exist }
|
166
|
+
end
|
167
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should fail if file does not exist" do
|
171
|
+
define "foo" do
|
172
|
+
check(file("test")) { it.should exist }
|
173
|
+
end
|
174
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should not attempt to invoke task" do
|
178
|
+
define "foo" do
|
179
|
+
file("test") { |task| write task.name }
|
180
|
+
check(file("test")) { it.should exist }
|
181
|
+
end
|
182
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should pass if ZIP path exists" do
|
186
|
+
write "resources/test"
|
187
|
+
define "foo", :version=>"1.0" do
|
188
|
+
package(:jar).include("resources")
|
189
|
+
check(package(:jar).path("resources")) { it.should exist }
|
190
|
+
end
|
191
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should fail if ZIP path does not exist" do
|
195
|
+
mkpath "resources"
|
196
|
+
define "foo", :version=>"1.0" do
|
197
|
+
package(:jar).include("resources")
|
198
|
+
check(package(:jar)) { it.path("not-resources").should exist }
|
199
|
+
end
|
200
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should pass if ZIP entry exists" do
|
204
|
+
write "resources/test"
|
205
|
+
define "foo", :version=>"1.0" do
|
206
|
+
package(:jar).include("resources")
|
207
|
+
check(package(:jar).entry("resources/test")) { it.should exist }
|
208
|
+
check(package(:jar).path("resources").entry("test")) { it.should exist }
|
209
|
+
end
|
210
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should fail if ZIP path does not exist" do
|
214
|
+
mkpath "resources"
|
215
|
+
define "foo", :version=>"1.0" do
|
216
|
+
package(:jar).include("resources")
|
217
|
+
check(package(:jar).entry("resources/test")) { it.should exist }
|
218
|
+
end
|
219
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
describe Buildr::Checks::Expectation, " exist" do
|
225
|
+
|
226
|
+
it "should pass if file has no content" do
|
227
|
+
define "foo" do
|
228
|
+
build file("test") { write "test" }
|
229
|
+
check(file("test")) { it.should be_empty }
|
230
|
+
end
|
231
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should fail if file has content" do
|
235
|
+
define "foo" do
|
236
|
+
build file("test") { write "test", "something" }
|
237
|
+
check(file("test")) { it.should be_empty }
|
238
|
+
end
|
239
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should fail if file does not exist" do
|
243
|
+
define "foo" do
|
244
|
+
check(file("test")) { it.should be_empty }
|
245
|
+
end
|
246
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should pass if directory is empty" do
|
250
|
+
define "foo" do
|
251
|
+
build file("test") { mkpath "test" }
|
252
|
+
check(file("test")) { it.should be_empty }
|
253
|
+
end
|
254
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should fail if directory has any files" do
|
258
|
+
define "foo" do
|
259
|
+
build file("test") { write "test/file" }
|
260
|
+
check(file("test")) { it.should be_empty }
|
261
|
+
end
|
262
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should pass if ZIP path is empty" do
|
266
|
+
mkpath "resources"
|
267
|
+
define "foo", :version=>"1.0" do
|
268
|
+
package(:jar).include("resources")
|
269
|
+
check(package(:jar).path("resources")) { it.should be_empty }
|
270
|
+
end
|
271
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should fail if ZIP path has any entries" do
|
275
|
+
write "resources/test"
|
276
|
+
define "foo", :version=>"1.0" do
|
277
|
+
package(:jar).include("resources")
|
278
|
+
check(package(:jar).path("resources")) { it.should be_empty }
|
279
|
+
end
|
280
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should pass if ZIP entry has no content" do
|
284
|
+
write "resources/test"
|
285
|
+
define "foo", :version=>"1.0" do
|
286
|
+
package(:jar).include("resources")
|
287
|
+
check(package(:jar).entry("resources/test")) { it.should be_empty }
|
288
|
+
check(package(:jar).path("resources").entry("test")) { it.should be_empty }
|
289
|
+
end
|
290
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
291
|
+
end
|
292
|
+
|
293
|
+
it "should fail if ZIP entry has content" do
|
294
|
+
write "resources/test", "something"
|
295
|
+
define "foo", :version=>"1.0" do
|
296
|
+
package(:jar).include("resources")
|
297
|
+
check(package(:jar).entry("resources/test")) { it.should be_empty }
|
298
|
+
end
|
299
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
300
|
+
end
|
301
|
+
|
302
|
+
it "should fail if ZIP entry does not exist" do
|
303
|
+
mkpath "resources"
|
304
|
+
define "foo", :version=>"1.0" do
|
305
|
+
package(:jar).include("resources")
|
306
|
+
check(package(:jar).entry("resources/test")) { it.should be_empty }
|
307
|
+
end
|
308
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
|
313
|
+
describe Buildr::Checks::Expectation, " contain(file)" do
|
314
|
+
|
315
|
+
it "should pass if file content matches string" do
|
316
|
+
define "foo" do
|
317
|
+
build file("test") { write "test", "something" }
|
318
|
+
check(file("test")) { it.should contain("thing") }
|
319
|
+
end
|
320
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
321
|
+
end
|
322
|
+
|
323
|
+
it "should pass if file content matches pattern" do
|
324
|
+
define "foo" do
|
325
|
+
build file("test") { write "test", "something\nor\nanother" }
|
326
|
+
check(file("test")) { it.should contain(/or/) }
|
327
|
+
end
|
328
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
329
|
+
end
|
330
|
+
|
331
|
+
it "should pass if file content matches all arguments" do
|
332
|
+
define "foo" do
|
333
|
+
build file("test") { write "test", "something\nor\nanother" }
|
334
|
+
check(file("test")) { it.should contain(/or/, /other/) }
|
335
|
+
end
|
336
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
337
|
+
end
|
338
|
+
|
339
|
+
it "should fail unless file content matchs all arguments" do
|
340
|
+
define "foo" do
|
341
|
+
build file("test") { write "test", "something" }
|
342
|
+
check(file("test")) { it.should contain(/some/, /other/) }
|
343
|
+
end
|
344
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should fail if file content does not match" do
|
348
|
+
define "foo" do
|
349
|
+
build file("test") { write "test", "something" }
|
350
|
+
check(file("test")) { it.should contain(/other/) }
|
351
|
+
end
|
352
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
353
|
+
end
|
354
|
+
|
355
|
+
it "should fail if file does not exist" do
|
356
|
+
define "foo" do
|
357
|
+
check(file("test")) { it.should contain(/anything/) }
|
358
|
+
end
|
359
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
|
364
|
+
describe Buildr::Checks::Expectation, " contain(directory)" do
|
365
|
+
|
366
|
+
it "should pass if directory contains file" do
|
367
|
+
write "resources/test"
|
368
|
+
define "foo" do
|
369
|
+
check(file("resources")) { it.should contain("test") }
|
370
|
+
end
|
371
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
372
|
+
end
|
373
|
+
|
374
|
+
it "should pass if directory contains glob pattern" do
|
375
|
+
write "resources/with/test"
|
376
|
+
define "foo" do
|
377
|
+
check(file("resources")) { it.should contain("**/t*st") }
|
378
|
+
end
|
379
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
380
|
+
end
|
381
|
+
|
382
|
+
it "should pass if directory contains all arguments" do
|
383
|
+
write "resources/with/test"
|
384
|
+
define "foo" do
|
385
|
+
check(file("resources")) { it.should contain("**/test", "**/*") }
|
386
|
+
end
|
387
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should fail unless directory contains all arguments" do
|
391
|
+
write "resources/test"
|
392
|
+
define "foo" do
|
393
|
+
check(file("resources")) { it.should contain("test", "or-not") }
|
394
|
+
end
|
395
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
396
|
+
end
|
397
|
+
|
398
|
+
it "should fail if directory is empty" do
|
399
|
+
mkpath "resources"
|
400
|
+
define "foo" do
|
401
|
+
check(file("resources")) { it.should contain("test") }
|
402
|
+
end
|
403
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should fail if directory does not exist" do
|
407
|
+
define "foo" do
|
408
|
+
check(file("resources")) { it.should contain }
|
409
|
+
end
|
410
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
|
415
|
+
describe Buildr::Checks::Expectation, " contain(zip.entry)" do
|
416
|
+
|
417
|
+
it "should pass if ZIP entry content matches string" do
|
418
|
+
write "resources/test", "something"
|
419
|
+
define "foo", :version=>"1.0" do
|
420
|
+
package(:jar).include("resources")
|
421
|
+
check(package(:jar).entry("resources/test")) { it.should contain("thing") }
|
422
|
+
#check(package(:jar)) { it.entry("resources/test").should contain("thing") }
|
423
|
+
end
|
424
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
425
|
+
end
|
426
|
+
|
427
|
+
it "should pass if ZIP entry content matches pattern" do
|
428
|
+
write "resources/test", "something\nor\another"
|
429
|
+
define "foo", :version=>"1.0" do
|
430
|
+
package(:jar).include("resources")
|
431
|
+
check(package(:jar).entry("resources/test")) { it.should contain(/or/) }
|
432
|
+
#check(package(:jar)) { it.entry("resources/test").should contain(/or/) }
|
433
|
+
end
|
434
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
435
|
+
end
|
436
|
+
|
437
|
+
it "should pass if ZIP entry content matches all arguments" do
|
438
|
+
write "resources/test", "something\nor\nanother"
|
439
|
+
define "foo", :version=>"1.0" do
|
440
|
+
package(:jar).include("resources")
|
441
|
+
check(package(:jar).entry("resources/test")) { it.should contain(/or/, /other/) }
|
442
|
+
#check(package(:jar)) { it.entry("resources/test").should contain(/or/, /other/) }
|
443
|
+
end
|
444
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
445
|
+
end
|
446
|
+
|
447
|
+
it "should fail unless ZIP path contains all arguments" do
|
448
|
+
write "resources/test", "something"
|
449
|
+
define "foo", :version=>"1.0" do
|
450
|
+
package(:jar).include("resources")
|
451
|
+
check(package(:jar).entry("resources/test")) { it.should contain(/some/, /other/) }
|
452
|
+
#check(package(:jar)) { it.entry("resources/test").should contain(/some/, /other/) }
|
453
|
+
end
|
454
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
455
|
+
end
|
456
|
+
|
457
|
+
it "should fail if ZIP entry content does not match" do
|
458
|
+
write "resources/test", "something"
|
459
|
+
define "foo", :version=>"1.0" do
|
460
|
+
package(:jar).include("resources")
|
461
|
+
check(package(:jar).entry("resources/test")) { it.should contain(/other/) }
|
462
|
+
#check(package(:jar)) { it.entry("resources/test").should contain(/other/) }
|
463
|
+
end
|
464
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
465
|
+
end
|
466
|
+
|
467
|
+
it "should fail if ZIP entry does not exist" do
|
468
|
+
mkpath "resources"
|
469
|
+
define "foo", :version=>"1.0" do
|
470
|
+
package(:jar).include("resources")
|
471
|
+
check(package(:jar).entry("resources/test")) { it.should contain(/anything/) }
|
472
|
+
#check(package(:jar)) { it.entry("resources/test").should contain(/anything/) }
|
473
|
+
end
|
474
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
|
479
|
+
describe Buildr::Checks::Expectation, " contain(zip.path)" do
|
480
|
+
|
481
|
+
it "should pass if ZIP path contains file" do
|
482
|
+
write "resources/test"
|
483
|
+
define "foo", :version=>"1.0" do
|
484
|
+
package(:jar).include("resources")
|
485
|
+
check(package(:jar).path("resources")) { it.should contain("test") }
|
486
|
+
end
|
487
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
488
|
+
end
|
489
|
+
|
490
|
+
it "should handle deep nesting" do
|
491
|
+
write "resources/test/test2.efx"
|
492
|
+
define "foo", :version=>"1.0" do
|
493
|
+
package(:jar).include("*")
|
494
|
+
check(package(:jar)) { it.should contain("resources/test/test2.efx") }
|
495
|
+
check(package(:jar).path("resources")) { it.should contain("test/test2.efx") }
|
496
|
+
check(package(:jar).path("resources/test")) { it.should contain("test2.efx") }
|
497
|
+
end
|
498
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
499
|
+
end
|
500
|
+
|
501
|
+
|
502
|
+
it "should pass if ZIP path contains pattern" do
|
503
|
+
write "resources/with/test"
|
504
|
+
define "foo", :version=>"1.0" do
|
505
|
+
package(:jar).include("resources")
|
506
|
+
check(package(:jar).path("resources")) { it.should contain("**/t*st") }
|
507
|
+
end
|
508
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
509
|
+
end
|
510
|
+
|
511
|
+
it "should pass if ZIP path contains all arguments" do
|
512
|
+
write "resources/with/test"
|
513
|
+
define "foo", :version=>"1.0" do
|
514
|
+
package(:jar).include("resources")
|
515
|
+
check(package(:jar).path("resources")) { it.should contain("**/test", "**/*") }
|
516
|
+
end
|
517
|
+
lambda { project("foo").task("package").invoke }.should_not raise_error
|
518
|
+
end
|
519
|
+
|
520
|
+
it "should fail unless ZIP path contains all arguments" do
|
521
|
+
write "resources/test"
|
522
|
+
define "foo", :version=>"1.0" do
|
523
|
+
package(:jar).include("resources")
|
524
|
+
check(package(:jar).path("resources")) { it.should contain("test", "or-not") }
|
525
|
+
end
|
526
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
527
|
+
end
|
528
|
+
|
529
|
+
it "should fail if ZIP path is empty" do
|
530
|
+
mkpath "resources"
|
531
|
+
define "foo", :version=>"1.0" do
|
532
|
+
package(:jar).include("resources")
|
533
|
+
check(package(:jar).path("resources")) { it.should contain("test") }
|
534
|
+
end
|
535
|
+
lambda { project("foo").task("package").invoke }.should raise_error(RuntimeError, /Checks failed/)
|
536
|
+
end
|
537
|
+
end
|