ittayd-buildr 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +62 -9
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +20 -39
- data/_buildr +1 -0
- data/{spec/java/ant.rb → _jbuildr} +11 -15
- metadata +30 -210
- data/DISCLAIMER +0 -7
- data/addon/buildr/antlr.rb +0 -65
- data/addon/buildr/cobertura.rb +0 -22
- data/addon/buildr/drb.rb +0 -281
- data/addon/buildr/emma.rb +0 -22
- data/addon/buildr/hibernate.rb +0 -142
- data/addon/buildr/javacc.rb +0 -85
- data/addon/buildr/jdepend.rb +0 -60
- data/addon/buildr/jetty.rb +0 -248
- data/addon/buildr/jibx.rb +0 -86
- data/addon/buildr/nailgun.rb +0 -221
- data/addon/buildr/openjpa.rb +0 -90
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
- 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/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
- data/addon/buildr/path.rb +0 -136
- data/addon/buildr/xmlbeans.rb +0 -93
- data/buildr.buildfile +0 -53
- data/buildr.gemspec +0 -58
- data/doc/css/default.css +0 -228
- data/doc/css/print.css +0 -100
- data/doc/css/syntax.css +0 -52
- 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/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +0 -207
- data/doc/pages/building.textile +0 -240
- data/doc/pages/contributing.textile +0 -208
- data/doc/pages/download.textile +0 -62
- data/doc/pages/extending.textile +0 -175
- data/doc/pages/getting_started.textile +0 -273
- data/doc/pages/index.textile +0 -42
- data/doc/pages/languages.textile +0 -407
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/more_stuff.textile +0 -314
- data/doc/pages/packaging.textile +0 -427
- data/doc/pages/projects.textile +0 -274
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/settings_profiles.textile +0 -274
- data/doc/pages/testing.textile +0 -212
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/print.toc.yaml +0 -29
- data/doc/scripts/buildr-git.rb +0 -412
- data/doc/scripts/install-jruby.sh +0 -44
- data/doc/scripts/install-linux.sh +0 -64
- data/doc/scripts/install-osx.sh +0 -52
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/KEYS +0 -151
- data/etc/git-svn-authors +0 -16
- data/lib/buildr.rb +0 -33
- data/lib/buildr/core.rb +0 -29
- data/lib/buildr/core/application.rb +0 -665
- data/lib/buildr/core/build.rb +0 -311
- data/lib/buildr/core/checks.rb +0 -254
- data/lib/buildr/core/common.rb +0 -150
- data/lib/buildr/core/compile.rb +0 -590
- data/lib/buildr/core/environment.rb +0 -117
- data/lib/buildr/core/filter.rb +0 -366
- data/lib/buildr/core/generate.rb +0 -195
- data/lib/buildr/core/help.rb +0 -119
- data/lib/buildr/core/osx.rb +0 -49
- data/lib/buildr/core/progressbar.rb +0 -156
- data/lib/buildr/core/project.rb +0 -923
- data/lib/buildr/core/test.rb +0 -715
- data/lib/buildr/core/transports.rb +0 -560
- data/lib/buildr/core/util.rb +0 -294
- data/lib/buildr/groovy.rb +0 -18
- data/lib/buildr/groovy/bdd.rb +0 -106
- data/lib/buildr/groovy/compiler.rb +0 -138
- data/lib/buildr/ide.rb +0 -19
- data/lib/buildr/ide/eclipse.rb +0 -222
- data/lib/buildr/ide/idea.ipr.template +0 -300
- data/lib/buildr/ide/idea.rb +0 -190
- data/lib/buildr/ide/idea7x.ipr.template +0 -290
- data/lib/buildr/ide/idea7x.rb +0 -212
- data/lib/buildr/java.rb +0 -23
- data/lib/buildr/java/ant.rb +0 -92
- data/lib/buildr/java/bdd.rb +0 -451
- data/lib/buildr/java/cobertura.rb +0 -236
- data/lib/buildr/java/commands.rb +0 -211
- data/lib/buildr/java/compiler.rb +0 -348
- data/lib/buildr/java/deprecated.rb +0 -141
- data/lib/buildr/java/emma.rb +0 -238
- data/lib/buildr/java/jruby.rb +0 -117
- data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
- data/lib/buildr/java/packaging.rb +0 -717
- data/lib/buildr/java/pom.rb +0 -174
- data/lib/buildr/java/rjb.rb +0 -155
- data/lib/buildr/java/test_result.rb +0 -307
- data/lib/buildr/java/tests.rb +0 -329
- data/lib/buildr/java/version_requirement.rb +0 -172
- data/lib/buildr/packaging.rb +0 -24
- data/lib/buildr/packaging/archive.rb +0 -488
- data/lib/buildr/packaging/artifact.rb +0 -759
- data/lib/buildr/packaging/artifact_namespace.rb +0 -972
- data/lib/buildr/packaging/artifact_search.rb +0 -140
- data/lib/buildr/packaging/gems.rb +0 -102
- data/lib/buildr/packaging/package.rb +0 -233
- data/lib/buildr/packaging/tar.rb +0 -186
- data/lib/buildr/packaging/version_requirement.rb +0 -172
- data/lib/buildr/packaging/zip.rb +0 -64
- data/lib/buildr/packaging/ziptask.rb +0 -313
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +0 -19
- data/lib/buildr/scala/compiler.rb +0 -109
- data/lib/buildr/scala/tests.rb +0 -203
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/doc.rake +0 -103
- data/rakelib/package.rake +0 -76
- data/rakelib/release.rake +0 -65
- data/rakelib/rspec.rake +0 -83
- data/rakelib/rubyforge.rake +0 -56
- data/rakelib/scm.rake +0 -49
- data/rakelib/setup.rake +0 -81
- data/rakelib/stage.rake +0 -48
- data/spec/addon/drb_spec.rb +0 -328
- data/spec/core/application_spec.rb +0 -419
- data/spec/core/build_spec.rb +0 -423
- data/spec/core/checks_spec.rb +0 -519
- data/spec/core/common_spec.rb +0 -670
- data/spec/core/compile_spec.rb +0 -582
- data/spec/core/generate_spec.rb +0 -33
- data/spec/core/project_spec.rb +0 -776
- data/spec/core/test_spec.rb +0 -1098
- data/spec/core/transport_spec.rb +0 -500
- data/spec/groovy/bdd_spec.rb +0 -80
- data/spec/groovy/compiler_spec.rb +0 -239
- data/spec/ide/eclipse_spec.rb +0 -311
- data/spec/java/bdd_spec.rb +0 -358
- data/spec/java/cobertura_spec.rb +0 -77
- data/spec/java/compiler_spec.rb +0 -446
- data/spec/java/emma_spec.rb +0 -120
- data/spec/java/java_spec.rb +0 -96
- data/spec/java/packaging_spec.rb +0 -1120
- data/spec/java/test_coverage_spec.rb +0 -255
- data/spec/java/tests_spec.rb +0 -471
- data/spec/packaging/archive_spec.rb +0 -503
- data/spec/packaging/artifact_namespace_spec.rb +0 -646
- data/spec/packaging/artifact_spec.rb +0 -795
- data/spec/packaging/packaging_helper.rb +0 -63
- data/spec/packaging/packaging_spec.rb +0 -589
- data/spec/sandbox.rb +0 -139
- data/spec/scala/compiler_spec.rb +0 -228
- data/spec/scala/tests_spec.rb +0 -215
- data/spec/spec_helpers.rb +0 -327
- data/spec/version_requirement_spec.rb +0 -123
data/spec/core/checks_spec.rb
DELETED
@@ -1,519 +0,0 @@
|
|
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
|
-
|
124
|
-
it 'should pass method calls to context' do
|
125
|
-
define 'foo', :version=>'1.0' do
|
126
|
-
subject = self
|
127
|
-
check "should be project" do
|
128
|
-
it.should be(subject)
|
129
|
-
name.should eql(subject.name)
|
130
|
-
package(:jar).should eql(subject.package(:jar))
|
131
|
-
end
|
132
|
-
end
|
133
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
|
138
|
-
describe Buildr::Checks::Expectation, 'matchers' do
|
139
|
-
|
140
|
-
it "should include Buildr matchers exist and contain" do
|
141
|
-
define 'foo' do
|
142
|
-
check do
|
143
|
-
self.should respond_to(:exist)
|
144
|
-
self.should respond_to(:contain)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
148
|
-
end
|
149
|
-
|
150
|
-
it "should include RSpec matchers like be and eql" do
|
151
|
-
define 'foo' do
|
152
|
-
check do
|
153
|
-
self.should respond_to(:be)
|
154
|
-
self.should respond_to(:eql)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
158
|
-
end
|
159
|
-
|
160
|
-
it "should include RSpec predicates like be_nil and be_empty" do
|
161
|
-
define 'foo' do
|
162
|
-
check do
|
163
|
-
nil.should be_nil
|
164
|
-
[].should be_empty
|
165
|
-
end
|
166
|
-
end
|
167
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
|
172
|
-
describe Buildr::Checks::Expectation, 'exist' do
|
173
|
-
|
174
|
-
it "should pass if file exists" do
|
175
|
-
define 'foo' do
|
176
|
-
build file('test') { |task| write task.name }
|
177
|
-
check(file('test')) { it.should exist }
|
178
|
-
end
|
179
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
180
|
-
end
|
181
|
-
|
182
|
-
it "should fail if file does not exist" do
|
183
|
-
define 'foo' do
|
184
|
-
check(file('test')) { it.should exist }
|
185
|
-
end
|
186
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
187
|
-
end
|
188
|
-
|
189
|
-
it "should not attempt to invoke task" do
|
190
|
-
define 'foo' do
|
191
|
-
file('test') { |task| write task.name }
|
192
|
-
check(file('test')) { it.should exist }
|
193
|
-
end
|
194
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
|
199
|
-
describe Buildr::Checks::Expectation, " be_empty" do
|
200
|
-
|
201
|
-
it "should pass if file has no content" do
|
202
|
-
define 'foo' do
|
203
|
-
build file('test') { write 'test' }
|
204
|
-
check(file('test')) { it.should be_empty }
|
205
|
-
end
|
206
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
207
|
-
end
|
208
|
-
|
209
|
-
it "should fail if file has content" do
|
210
|
-
define 'foo' do
|
211
|
-
build file('test') { write 'test', "something" }
|
212
|
-
check(file('test')) { it.should be_empty }
|
213
|
-
end
|
214
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
215
|
-
end
|
216
|
-
|
217
|
-
it "should fail if file does not exist" do
|
218
|
-
define 'foo' do
|
219
|
-
check(file('test')) { it.should be_empty }
|
220
|
-
end
|
221
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
222
|
-
end
|
223
|
-
|
224
|
-
it "should pass if directory is empty" do
|
225
|
-
define 'foo' do
|
226
|
-
build file('test') { mkpath 'test' }
|
227
|
-
check(file('test')) { it.should be_empty }
|
228
|
-
end
|
229
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
230
|
-
end
|
231
|
-
|
232
|
-
it "should fail if directory has any files" do
|
233
|
-
define 'foo' do
|
234
|
-
build file('test') { write 'test/file' }
|
235
|
-
check(file('test')) { it.should be_empty }
|
236
|
-
end
|
237
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
|
242
|
-
describe Buildr::Checks::Expectation, " contain(file)" do
|
243
|
-
|
244
|
-
it "should pass if file content matches string" do
|
245
|
-
define 'foo' do
|
246
|
-
build file('test') { write 'test', 'something' }
|
247
|
-
check(file('test')) { it.should contain('thing') }
|
248
|
-
end
|
249
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
250
|
-
end
|
251
|
-
|
252
|
-
it "should pass if file content matches pattern" do
|
253
|
-
define 'foo' do
|
254
|
-
build file('test') { write 'test', "something\nor\nanother" }
|
255
|
-
check(file('test')) { it.should contain(/or/) }
|
256
|
-
end
|
257
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
258
|
-
end
|
259
|
-
|
260
|
-
it "should pass if file content matches all arguments" do
|
261
|
-
define 'foo' do
|
262
|
-
build file('test') { write 'test', "something\nor\nanother" }
|
263
|
-
check(file('test')) { it.should contain(/or/, /other/) }
|
264
|
-
end
|
265
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
266
|
-
end
|
267
|
-
|
268
|
-
it "should fail unless file content matchs all arguments" do
|
269
|
-
define 'foo' do
|
270
|
-
build file('test') { write 'test', 'something' }
|
271
|
-
check(file('test')) { it.should contain(/some/, /other/) }
|
272
|
-
end
|
273
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
274
|
-
end
|
275
|
-
|
276
|
-
it "should fail if file content does not match" do
|
277
|
-
define 'foo' do
|
278
|
-
build file('test') { write 'test', "something" }
|
279
|
-
check(file('test')) { it.should contain(/other/) }
|
280
|
-
end
|
281
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
282
|
-
end
|
283
|
-
|
284
|
-
it "should fail if file does not exist" do
|
285
|
-
define 'foo' do
|
286
|
-
check(file('test')) { it.should contain(/anything/) }
|
287
|
-
end
|
288
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
|
293
|
-
describe Buildr::Checks::Expectation, 'contain(directory)' do
|
294
|
-
|
295
|
-
it "should pass if directory contains file" do
|
296
|
-
write 'resources/test'
|
297
|
-
define 'foo' do
|
298
|
-
check(file('resources')) { it.should contain('test') }
|
299
|
-
end
|
300
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
301
|
-
end
|
302
|
-
|
303
|
-
it "should pass if directory contains glob pattern" do
|
304
|
-
write 'resources/with/test'
|
305
|
-
define 'foo' do
|
306
|
-
check(file('resources')) { it.should contain('**/t*st') }
|
307
|
-
end
|
308
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
309
|
-
end
|
310
|
-
|
311
|
-
it "should pass if directory contains all arguments" do
|
312
|
-
write 'resources/with/test'
|
313
|
-
define 'foo' do
|
314
|
-
check(file('resources')) { it.should contain('**/test', '**/*') }
|
315
|
-
end
|
316
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
317
|
-
end
|
318
|
-
|
319
|
-
it "should fail unless directory contains all arguments" do
|
320
|
-
write 'resources/test'
|
321
|
-
define 'foo' do
|
322
|
-
check(file('resources')) { it.should contain('test', 'or-not') }
|
323
|
-
end
|
324
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
325
|
-
end
|
326
|
-
|
327
|
-
it "should fail if directory is empty" do
|
328
|
-
mkpath 'resources'
|
329
|
-
define 'foo' do
|
330
|
-
check(file('resources')) { it.should contain('test') }
|
331
|
-
end
|
332
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
333
|
-
end
|
334
|
-
|
335
|
-
it "should fail if directory does not exist" do
|
336
|
-
define 'foo' do
|
337
|
-
check(file('resources')) { it.should contain }
|
338
|
-
end
|
339
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
|
344
|
-
describe Buildr::Checks::Expectation do
|
345
|
-
|
346
|
-
shared_examples_for 'all archive types' do
|
347
|
-
|
348
|
-
before do
|
349
|
-
archive = @archive
|
350
|
-
define 'foo', :version=>'1.0' do
|
351
|
-
package(archive).include('resources')
|
352
|
-
end
|
353
|
-
end
|
354
|
-
|
355
|
-
def check *args, &block
|
356
|
-
project('foo').check *args, &block
|
357
|
-
end
|
358
|
-
|
359
|
-
def package
|
360
|
-
project('foo').package(@archive)
|
361
|
-
end
|
362
|
-
|
363
|
-
describe '#exist' do
|
364
|
-
|
365
|
-
it "should pass if archive path exists" do
|
366
|
-
write 'resources/test'
|
367
|
-
check(package.path('resources')) { it.should exist }
|
368
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
369
|
-
end
|
370
|
-
|
371
|
-
it "should fail if archive path does not exist" do
|
372
|
-
mkpath 'resources'
|
373
|
-
check(package) { it.path('not-resources').should exist }
|
374
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
375
|
-
end
|
376
|
-
|
377
|
-
it "should pass if archive entry exists" do
|
378
|
-
write 'resources/test'
|
379
|
-
check(package.entry('resources/test')) { it.should exist }
|
380
|
-
check(package.path('resources').entry('test')) { it.should exist }
|
381
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
382
|
-
end
|
383
|
-
|
384
|
-
it "should fail if archive path does not exist" do
|
385
|
-
mkpath 'resources'
|
386
|
-
check(package.entry('resources/test')) { it.should exist }
|
387
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
describe '#be_empty' do
|
392
|
-
it "should pass if archive path is empty" do
|
393
|
-
mkpath 'resources'
|
394
|
-
check(package.path('resources')) { it.should be_empty }
|
395
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
396
|
-
end
|
397
|
-
|
398
|
-
it "should fail if archive path has any entries" do
|
399
|
-
write 'resources/test'
|
400
|
-
check(package.path('resources')) { it.should be_empty }
|
401
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
402
|
-
end
|
403
|
-
|
404
|
-
it "should pass if archive entry has no content" do
|
405
|
-
write 'resources/test'
|
406
|
-
check(package.entry('resources/test')) { it.should be_empty }
|
407
|
-
check(package.path('resources').entry('test')) { it.should be_empty }
|
408
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
409
|
-
end
|
410
|
-
|
411
|
-
it "should fail if archive entry has content" do
|
412
|
-
write 'resources/test', 'something'
|
413
|
-
check(package.entry('resources/test')) { it.should be_empty }
|
414
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
415
|
-
end
|
416
|
-
|
417
|
-
it "should fail if archive entry does not exist" do
|
418
|
-
mkpath 'resources'
|
419
|
-
check(package.entry('resources/test')) { it.should be_empty }
|
420
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
421
|
-
end
|
422
|
-
end
|
423
|
-
|
424
|
-
describe '#contain(entry)' do
|
425
|
-
|
426
|
-
it "should pass if archive entry content matches string" do
|
427
|
-
write 'resources/test', 'something'
|
428
|
-
check(package.entry('resources/test')) { it.should contain('thing') }
|
429
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
430
|
-
end
|
431
|
-
|
432
|
-
it "should pass if archive entry content matches pattern" do
|
433
|
-
write 'resources/test', "something\nor\another"
|
434
|
-
check(package.entry('resources/test')) { it.should contain(/or/) }
|
435
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
436
|
-
end
|
437
|
-
|
438
|
-
it "should pass if archive entry content matches all arguments" do
|
439
|
-
write 'resources/test', "something\nor\nanother"
|
440
|
-
check(package.entry('resources/test')) { it.should contain(/or/, /other/) }
|
441
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
442
|
-
end
|
443
|
-
|
444
|
-
it "should fail unless archive path contains all arguments" do
|
445
|
-
write 'resources/test', 'something'
|
446
|
-
check(package.entry('resources/test')) { it.should contain(/some/, /other/) }
|
447
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
448
|
-
end
|
449
|
-
|
450
|
-
it "should fail if archive entry content does not match" do
|
451
|
-
write 'resources/test', 'something'
|
452
|
-
check(package.entry('resources/test')) { it.should contain(/other/) }
|
453
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
454
|
-
end
|
455
|
-
|
456
|
-
it "should fail if archive entry does not exist" do
|
457
|
-
mkpath 'resources'
|
458
|
-
check(package.entry('resources/test')) { it.should contain(/anything/) }
|
459
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
460
|
-
end
|
461
|
-
end
|
462
|
-
|
463
|
-
describe '#contain(path)' do
|
464
|
-
|
465
|
-
it "should pass if archive path contains file" do
|
466
|
-
write 'resources/test'
|
467
|
-
check(package.path('resources')) { it.should contain('test') }
|
468
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
469
|
-
end
|
470
|
-
|
471
|
-
it "should handle deep nesting" do
|
472
|
-
write 'resources/test/test2.efx'
|
473
|
-
check(package) { it.should contain('resources/test/test2.efx') }
|
474
|
-
check(package.path('resources')) { it.should contain('test/test2.efx') }
|
475
|
-
check(package.path('resources/test')) { it.should contain('test2.efx') }
|
476
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
477
|
-
end
|
478
|
-
|
479
|
-
it "should pass if archive path contains pattern" do
|
480
|
-
write 'resources/with/test'
|
481
|
-
check(package.path('resources')) { it.should contain('**/t*st') }
|
482
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
483
|
-
end
|
484
|
-
|
485
|
-
it "should pass if archive path contains all arguments" do
|
486
|
-
write 'resources/with/test'
|
487
|
-
check(package.path('resources')) { it.should contain('**/test', '**/*') }
|
488
|
-
lambda { project('foo').task('package').invoke }.should_not raise_error
|
489
|
-
end
|
490
|
-
|
491
|
-
it "should fail unless archive path contains all arguments" do
|
492
|
-
write 'resources/test'
|
493
|
-
check(package.path('resources')) { it.should contain('test', 'or-not') }
|
494
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
495
|
-
end
|
496
|
-
|
497
|
-
it "should fail if archive path is empty" do
|
498
|
-
mkpath 'resources'
|
499
|
-
check(package.path('resources')) { it.should contain('test') }
|
500
|
-
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
501
|
-
end
|
502
|
-
end
|
503
|
-
end
|
504
|
-
|
505
|
-
describe 'ZIP' do
|
506
|
-
before { @archive = :jar }
|
507
|
-
it_should_behave_like 'all archive types'
|
508
|
-
end
|
509
|
-
|
510
|
-
describe 'tar' do
|
511
|
-
before { @archive = :tar }
|
512
|
-
it_should_behave_like 'all archive types'
|
513
|
-
end
|
514
|
-
|
515
|
-
describe 'tgz' do
|
516
|
-
before { @archive = :tgz }
|
517
|
-
it_should_behave_like 'all archive types'
|
518
|
-
end
|
519
|
-
end
|