vic-buildr 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +42 -11
- data/Rakefile +5 -3
- data/_buildr +9 -31
- data/addon/buildr/cobertura.rb +5 -218
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -220
- data/addon/buildr/nailgun.rb +94 -686
- data/bin/buildr +0 -9
- data/buildr.gemspec +6 -6
- data/doc/images/favicon.png +0 -0
- data/doc/pages/contributing.textile +6 -4
- data/doc/pages/download.textile +11 -0
- data/doc/pages/extending.textile +2 -2
- data/doc/pages/getting_started.textile +4 -4
- data/doc/pages/index.textile +8 -11
- data/doc/pages/more_stuff.textile +50 -22
- data/doc/pages/packaging.textile +1 -1
- data/doc/pages/projects.textile +2 -2
- data/doc/pages/settings_profiles.textile +2 -2
- data/doc/pages/testing.textile +1 -1
- data/doc/pages/whats_new.textile +12 -0
- data/doc/site.haml +1 -0
- data/lib/buildr.rb +2 -4
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +304 -149
- data/lib/buildr/core/checks.rb +3 -131
- data/lib/buildr/core/common.rb +0 -4
- data/lib/buildr/core/compile.rb +1 -7
- data/lib/buildr/core/environment.rb +0 -3
- data/lib/buildr/core/filter.rb +7 -3
- data/lib/buildr/core/generate.rb +50 -52
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +49 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -9
- data/lib/buildr/core/test.rb +4 -4
- data/lib/buildr/core/transports.rb +13 -30
- data/lib/buildr/core/util.rb +8 -3
- data/lib/buildr/groovy/bdd.rb +1 -0
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +30 -20
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +4 -2
- data/lib/buildr/java/ant.rb +1 -1
- data/lib/buildr/java/bdd.rb +9 -5
- data/lib/buildr/java/cobertura.rb +236 -0
- data/lib/buildr/java/commands.rb +2 -1
- data/lib/buildr/java/emma.rb +238 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +2 -0
- data/lib/buildr/java/packaging.rb +6 -2
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/test_result.rb +45 -15
- data/lib/buildr/java/tests.rb +14 -9
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +36 -7
- data/lib/buildr/packaging/artifact_namespace.rb +2 -2
- data/lib/buildr/packaging/gems.rb +3 -3
- data/lib/buildr/packaging/package.rb +1 -1
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala/compiler.rb +1 -1
- data/lib/buildr/scala/tests.rb +2 -2
- data/rakelib/apache.rake +58 -8
- data/rakelib/package.rake +4 -1
- data/rakelib/rspec.rake +2 -2
- data/rakelib/rubyforge.rake +6 -3
- data/rakelib/scm.rake +1 -1
- data/rakelib/setup.rake +0 -5
- data/rakelib/stage.rake +4 -1
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +29 -22
- data/spec/core/build_spec.rb +8 -0
- data/spec/core/checks_spec.rb +293 -311
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +24 -1
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +4 -4
- data/spec/{addon → java}/cobertura_spec.rb +3 -3
- data/spec/{addon → java}/emma_spec.rb +3 -3
- data/spec/java/java_spec.rb +9 -1
- data/spec/java/packaging_spec.rb +19 -2
- data/spec/{addon → java}/test_coverage_spec.rb +7 -1
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +1 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +2 -2
- data/spec/packaging/artifact_spec.rb +46 -5
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +16 -14
- data/spec/spec_helpers.rb +26 -3
- metadata +20 -11
- data/lib/buildr/core/application_cli.rb +0 -139
data/spec/core/build_spec.rb
CHANGED
@@ -169,6 +169,10 @@ describe Project, '#target' do
|
|
169
169
|
@project.layout[:target] = 'baz'
|
170
170
|
@project.target.should eql('baz')
|
171
171
|
end
|
172
|
+
|
173
|
+
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
174
|
+
Buildr::VERSION.should < '1.5'
|
175
|
+
end
|
172
176
|
end
|
173
177
|
|
174
178
|
|
@@ -190,6 +194,10 @@ describe Project, '#reports' do
|
|
190
194
|
@project.layout[:reports] = 'baz'
|
191
195
|
@project.reports.should eql('baz')
|
192
196
|
end
|
197
|
+
|
198
|
+
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
199
|
+
Buildr::VERSION.should < '1.5'
|
200
|
+
end
|
193
201
|
end
|
194
202
|
|
195
203
|
|
data/spec/core/checks_spec.rb
CHANGED
@@ -17,53 +17,53 @@
|
|
17
17
|
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
18
18
|
|
19
19
|
|
20
|
-
describe Project,
|
20
|
+
describe Project, 'check task' do
|
21
21
|
|
22
22
|
it "should execute last thing from package task" do
|
23
|
-
task
|
24
|
-
define
|
23
|
+
task 'action'
|
24
|
+
define 'foo', :version=>'1.0' do
|
25
25
|
package :jar
|
26
|
-
task(
|
26
|
+
task('package').enhance { task('action').invoke }
|
27
27
|
end
|
28
|
-
lambda { project(
|
28
|
+
lambda { project('foo').task('package').invoke }.should run_tasks(['foo:package', 'action', 'foo:check'])
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should execute all project's expectations" do
|
32
|
-
task
|
33
|
-
define
|
34
|
-
check { task(
|
32
|
+
task 'expectation'
|
33
|
+
define 'foo', :version=>'1.0' do
|
34
|
+
check { task('expectation').invoke }
|
35
35
|
end
|
36
|
-
lambda { project(
|
36
|
+
lambda { project('foo').task('package').invoke }.should run_task('expectation')
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should succeed if there are no expectations" do
|
40
|
-
define
|
41
|
-
lambda { project(
|
40
|
+
define 'foo', :version=>'1.0'
|
41
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should succeed if all expectations passed" do
|
45
|
-
define
|
45
|
+
define 'foo', :version=>'1.0' do
|
46
46
|
check { true }
|
47
47
|
check { false }
|
48
48
|
end
|
49
|
-
lambda { project(
|
49
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should fail if any expectation failed" do
|
53
|
-
define
|
53
|
+
define 'foo', :version=>'1.0' do
|
54
54
|
check
|
55
|
-
check { fail
|
55
|
+
check { fail 'sorry' }
|
56
56
|
check
|
57
57
|
end
|
58
|
-
lambda { project(
|
58
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
|
63
|
-
describe Project,
|
63
|
+
describe Project, '#check' do
|
64
64
|
|
65
65
|
it "should add expectation" do
|
66
|
-
define
|
66
|
+
define 'foo' do
|
67
67
|
expectations.should be_empty
|
68
68
|
check
|
69
69
|
expectations.size.should be(1)
|
@@ -71,241 +71,170 @@ describe Project, "#check" do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should treat no arguments as expectation against project" do
|
74
|
-
define
|
74
|
+
define 'foo' do
|
75
75
|
subject = self
|
76
76
|
check do
|
77
77
|
it.should be(subject)
|
78
78
|
description.should eql(subject.to_s)
|
79
79
|
end
|
80
80
|
end
|
81
|
-
lambda { project(
|
81
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should treat single string argument as description, expectation against project" do
|
85
|
-
define
|
85
|
+
define 'foo' do
|
86
86
|
subject = self
|
87
87
|
check "should be project" do
|
88
88
|
it.should be(subject)
|
89
89
|
description.should eql("#{subject} should be project")
|
90
90
|
end
|
91
91
|
end
|
92
|
-
lambda { project(
|
92
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should treat single object argument as subject" do
|
96
|
-
define
|
96
|
+
define 'foo' do
|
97
97
|
subject = Object.new
|
98
98
|
check subject do
|
99
99
|
it.should be(subject)
|
100
100
|
description.should eql(subject.to_s)
|
101
101
|
end
|
102
102
|
end
|
103
|
-
lambda { project(
|
103
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should treat first object as subject, second object as description" do
|
107
|
-
define
|
107
|
+
define 'foo' do
|
108
108
|
subject = Object.new
|
109
109
|
check subject, "should exist" do
|
110
110
|
it.should be(subject)
|
111
111
|
description.should eql("#{subject} should exist")
|
112
112
|
end
|
113
113
|
end
|
114
|
-
lambda { project(
|
114
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should work without block" do
|
118
|
-
define
|
118
|
+
define 'foo' do
|
119
119
|
check "implement later"
|
120
120
|
end
|
121
|
-
lambda { project(
|
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
|
122
134
|
end
|
123
135
|
end
|
124
136
|
|
125
137
|
|
126
|
-
describe Buildr::Checks::Expectation,
|
138
|
+
describe Buildr::Checks::Expectation, 'matchers' do
|
127
139
|
|
128
140
|
it "should include Buildr matchers exist and contain" do
|
129
|
-
define
|
141
|
+
define 'foo' do
|
130
142
|
check do
|
131
143
|
self.should respond_to(:exist)
|
132
144
|
self.should respond_to(:contain)
|
133
145
|
end
|
134
146
|
end
|
135
|
-
lambda { project(
|
147
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
136
148
|
end
|
137
149
|
|
138
150
|
it "should include RSpec matchers like be and eql" do
|
139
|
-
define
|
151
|
+
define 'foo' do
|
140
152
|
check do
|
141
153
|
self.should respond_to(:be)
|
142
154
|
self.should respond_to(:eql)
|
143
155
|
end
|
144
156
|
end
|
145
|
-
lambda { project(
|
157
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
146
158
|
end
|
147
159
|
|
148
160
|
it "should include RSpec predicates like be_nil and be_empty" do
|
149
|
-
define
|
161
|
+
define 'foo' do
|
150
162
|
check do
|
151
163
|
nil.should be_nil
|
152
164
|
[].should be_empty
|
153
165
|
end
|
154
166
|
end
|
155
|
-
lambda { project(
|
167
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
156
168
|
end
|
157
169
|
end
|
158
170
|
|
159
171
|
|
160
|
-
describe Buildr::Checks::Expectation,
|
172
|
+
describe Buildr::Checks::Expectation, 'exist' do
|
161
173
|
|
162
174
|
it "should pass if file exists" do
|
163
|
-
define
|
164
|
-
build file(
|
165
|
-
check(file(
|
175
|
+
define 'foo' do
|
176
|
+
build file('test') { |task| write task.name }
|
177
|
+
check(file('test')) { it.should exist }
|
166
178
|
end
|
167
|
-
lambda { project(
|
179
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
168
180
|
end
|
169
181
|
|
170
182
|
it "should fail if file does not exist" do
|
171
|
-
define
|
172
|
-
check(file(
|
183
|
+
define 'foo' do
|
184
|
+
check(file('test')) { it.should exist }
|
173
185
|
end
|
174
|
-
lambda { project(
|
186
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
175
187
|
end
|
176
188
|
|
177
189
|
it "should not attempt to invoke task" do
|
178
|
-
define
|
179
|
-
file(
|
180
|
-
check(file(
|
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 }
|
190
|
+
define 'foo' do
|
191
|
+
file('test') { |task| write task.name }
|
192
|
+
check(file('test')) { it.should exist }
|
209
193
|
end
|
210
|
-
lambda { project(
|
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/)
|
194
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
220
195
|
end
|
221
196
|
end
|
222
197
|
|
223
198
|
|
224
|
-
describe Buildr::Checks::Expectation, "
|
199
|
+
describe Buildr::Checks::Expectation, " be_empty" do
|
225
200
|
|
226
201
|
it "should pass if file has no content" do
|
227
|
-
define
|
228
|
-
build file(
|
229
|
-
check(file(
|
202
|
+
define 'foo' do
|
203
|
+
build file('test') { write 'test' }
|
204
|
+
check(file('test')) { it.should be_empty }
|
230
205
|
end
|
231
|
-
lambda { project(
|
206
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
232
207
|
end
|
233
208
|
|
234
209
|
it "should fail if file has content" do
|
235
|
-
define
|
236
|
-
build file(
|
237
|
-
check(file(
|
210
|
+
define 'foo' do
|
211
|
+
build file('test') { write 'test', "something" }
|
212
|
+
check(file('test')) { it.should be_empty }
|
238
213
|
end
|
239
|
-
lambda { project(
|
214
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
240
215
|
end
|
241
216
|
|
242
217
|
it "should fail if file does not exist" do
|
243
|
-
define
|
244
|
-
check(file(
|
218
|
+
define 'foo' do
|
219
|
+
check(file('test')) { it.should be_empty }
|
245
220
|
end
|
246
|
-
lambda { project(
|
221
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
247
222
|
end
|
248
223
|
|
249
224
|
it "should pass if directory is empty" do
|
250
|
-
define
|
251
|
-
build file(
|
252
|
-
check(file(
|
225
|
+
define 'foo' do
|
226
|
+
build file('test') { mkpath 'test' }
|
227
|
+
check(file('test')) { it.should be_empty }
|
253
228
|
end
|
254
|
-
lambda { project(
|
229
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
255
230
|
end
|
256
231
|
|
257
232
|
it "should fail if directory has any files" do
|
258
|
-
define
|
259
|
-
build file(
|
260
|
-
check(file(
|
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 }
|
233
|
+
define 'foo' do
|
234
|
+
build file('test') { write 'test/file' }
|
235
|
+
check(file('test')) { it.should be_empty }
|
270
236
|
end
|
271
|
-
lambda { project(
|
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/)
|
237
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
309
238
|
end
|
310
239
|
end
|
311
240
|
|
@@ -313,225 +242,278 @@ end
|
|
313
242
|
describe Buildr::Checks::Expectation, " contain(file)" do
|
314
243
|
|
315
244
|
it "should pass if file content matches string" do
|
316
|
-
define
|
317
|
-
build file(
|
318
|
-
check(file(
|
245
|
+
define 'foo' do
|
246
|
+
build file('test') { write 'test', 'something' }
|
247
|
+
check(file('test')) { it.should contain('thing') }
|
319
248
|
end
|
320
|
-
lambda { project(
|
249
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
321
250
|
end
|
322
251
|
|
323
252
|
it "should pass if file content matches pattern" do
|
324
|
-
define
|
325
|
-
build file(
|
326
|
-
check(file(
|
253
|
+
define 'foo' do
|
254
|
+
build file('test') { write 'test', "something\nor\nanother" }
|
255
|
+
check(file('test')) { it.should contain(/or/) }
|
327
256
|
end
|
328
|
-
lambda { project(
|
257
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
329
258
|
end
|
330
259
|
|
331
260
|
it "should pass if file content matches all arguments" do
|
332
|
-
define
|
333
|
-
build file(
|
334
|
-
check(file(
|
261
|
+
define 'foo' do
|
262
|
+
build file('test') { write 'test', "something\nor\nanother" }
|
263
|
+
check(file('test')) { it.should contain(/or/, /other/) }
|
335
264
|
end
|
336
|
-
lambda { project(
|
265
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
337
266
|
end
|
338
267
|
|
339
268
|
it "should fail unless file content matchs all arguments" do
|
340
|
-
define
|
341
|
-
build file(
|
342
|
-
check(file(
|
269
|
+
define 'foo' do
|
270
|
+
build file('test') { write 'test', 'something' }
|
271
|
+
check(file('test')) { it.should contain(/some/, /other/) }
|
343
272
|
end
|
344
|
-
lambda { project(
|
273
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
345
274
|
end
|
346
275
|
|
347
276
|
it "should fail if file content does not match" do
|
348
|
-
define
|
349
|
-
build file(
|
350
|
-
check(file(
|
277
|
+
define 'foo' do
|
278
|
+
build file('test') { write 'test', "something" }
|
279
|
+
check(file('test')) { it.should contain(/other/) }
|
351
280
|
end
|
352
|
-
lambda { project(
|
281
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
353
282
|
end
|
354
283
|
|
355
284
|
it "should fail if file does not exist" do
|
356
|
-
define
|
357
|
-
check(file(
|
285
|
+
define 'foo' do
|
286
|
+
check(file('test')) { it.should contain(/anything/) }
|
358
287
|
end
|
359
|
-
lambda { project(
|
288
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
360
289
|
end
|
361
290
|
end
|
362
291
|
|
363
292
|
|
364
|
-
describe Buildr::Checks::Expectation,
|
293
|
+
describe Buildr::Checks::Expectation, 'contain(directory)' do
|
365
294
|
|
366
295
|
it "should pass if directory contains file" do
|
367
|
-
write
|
368
|
-
define
|
369
|
-
check(file(
|
296
|
+
write 'resources/test'
|
297
|
+
define 'foo' do
|
298
|
+
check(file('resources')) { it.should contain('test') }
|
370
299
|
end
|
371
|
-
lambda { project(
|
300
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
372
301
|
end
|
373
302
|
|
374
303
|
it "should pass if directory contains glob pattern" do
|
375
|
-
write
|
376
|
-
define
|
377
|
-
check(file(
|
304
|
+
write 'resources/with/test'
|
305
|
+
define 'foo' do
|
306
|
+
check(file('resources')) { it.should contain('**/t*st') }
|
378
307
|
end
|
379
|
-
lambda { project(
|
308
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
380
309
|
end
|
381
310
|
|
382
311
|
it "should pass if directory contains all arguments" do
|
383
|
-
write
|
384
|
-
define
|
385
|
-
check(file(
|
312
|
+
write 'resources/with/test'
|
313
|
+
define 'foo' do
|
314
|
+
check(file('resources')) { it.should contain('**/test', '**/*') }
|
386
315
|
end
|
387
|
-
lambda { project(
|
316
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
388
317
|
end
|
389
318
|
|
390
319
|
it "should fail unless directory contains all arguments" do
|
391
|
-
write
|
392
|
-
define
|
393
|
-
check(file(
|
320
|
+
write 'resources/test'
|
321
|
+
define 'foo' do
|
322
|
+
check(file('resources')) { it.should contain('test', 'or-not') }
|
394
323
|
end
|
395
|
-
lambda { project(
|
324
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
396
325
|
end
|
397
326
|
|
398
327
|
it "should fail if directory is empty" do
|
399
|
-
mkpath
|
400
|
-
define
|
401
|
-
check(file(
|
328
|
+
mkpath 'resources'
|
329
|
+
define 'foo' do
|
330
|
+
check(file('resources')) { it.should contain('test') }
|
402
331
|
end
|
403
|
-
lambda { project(
|
332
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
404
333
|
end
|
405
334
|
|
406
335
|
it "should fail if directory does not exist" do
|
407
|
-
define
|
408
|
-
check(file(
|
336
|
+
define 'foo' do
|
337
|
+
check(file('resources')) { it.should contain }
|
409
338
|
end
|
410
|
-
lambda { project(
|
339
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
411
340
|
end
|
412
341
|
end
|
413
342
|
|
414
343
|
|
415
|
-
describe Buildr::Checks::Expectation
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
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/) }
|
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
|
473
353
|
end
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
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
|
486
422
|
end
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
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
|
497
461
|
end
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
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
|
507
502
|
end
|
508
|
-
lambda { project("foo").task("package").invoke }.should_not raise_error
|
509
503
|
end
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
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
|
504
|
+
|
505
|
+
describe 'ZIP' do
|
506
|
+
before { @archive = :jar }
|
507
|
+
it_should_behave_like 'all archive types'
|
518
508
|
end
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
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/)
|
509
|
+
|
510
|
+
describe 'tar' do
|
511
|
+
before { @archive = :tar }
|
512
|
+
it_should_behave_like 'all archive types'
|
527
513
|
end
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
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/)
|
514
|
+
|
515
|
+
describe 'tgz' do
|
516
|
+
before { @archive = :tgz }
|
517
|
+
it_should_behave_like 'all archive types'
|
536
518
|
end
|
537
519
|
end
|