buildr 1.3.5 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +153 -8
- data/README.rdoc +1 -1
- data/addon/buildr/antlr.rb +5 -5
- data/addon/buildr/drb.rb +18 -18
- data/addon/buildr/hibernate.rb +18 -14
- data/addon/buildr/javacc.rb +4 -4
- data/addon/buildr/jetty.rb +5 -5
- data/addon/buildr/nailgun.rb +23 -23
- data/addon/buildr/openjpa.rb +1 -1
- 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/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/protobuf.rb +75 -0
- data/addon/buildr/xmlbeans.rb +5 -5
- data/buildr.buildfile +2 -2
- data/buildr.gemspec +8 -7
- data/doc/_layouts/default.html +2 -2
- data/doc/artifacts.textile +4 -4
- data/doc/building.textile +35 -3
- data/doc/contributing.textile +5 -0
- data/doc/download.textile +16 -5
- data/doc/extending.textile +38 -12
- data/doc/installing.textile +6 -5
- data/doc/languages.textile +182 -42
- data/doc/more_stuff.textile +2 -2
- data/doc/packaging.textile +14 -15
- data/doc/projects.textile +7 -2
- data/doc/quick_start.textile +4 -4
- data/doc/scripts/buildr-git.rb +63 -63
- data/doc/scripts/gitflow.rb +21 -21
- data/doc/settings_profiles.textile +9 -2
- data/doc/testing.textile +16 -5
- data/etc/KEYS +38 -0
- data/lib/buildr/core/application.rb +33 -27
- data/lib/buildr/core/build.rb +41 -28
- data/lib/buildr/core/cc.rb +172 -0
- data/lib/buildr/core/checks.rb +1 -1
- data/lib/buildr/core/common.rb +7 -6
- data/lib/buildr/core/compile.rb +7 -8
- data/lib/buildr/core/doc.rb +263 -0
- data/lib/buildr/core/environment.rb +6 -6
- data/lib/buildr/core/filter.rb +77 -35
- data/lib/buildr/core/generate.rb +7 -7
- data/lib/buildr/core/help.rb +1 -1
- data/lib/buildr/core/osx.rb +6 -6
- data/lib/buildr/core/progressbar.rb +4 -4
- data/lib/buildr/core/project.rb +144 -36
- data/lib/buildr/core/shell.rb +34 -34
- data/lib/buildr/core/test.rb +89 -20
- data/lib/buildr/core/transports.rb +8 -7
- data/lib/buildr/core/util.rb +77 -23
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/compiler.rb +19 -15
- data/lib/buildr/groovy/shell.rb +6 -6
- data/lib/buildr/ide/eclipse/java.rb +3 -3
- data/lib/buildr/ide/eclipse/plugin.rb +8 -5
- data/lib/buildr/ide/eclipse/scala.rb +4 -2
- data/lib/buildr/ide/eclipse.rb +148 -75
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java/ant.rb +4 -4
- data/lib/buildr/java/bdd.rb +51 -54
- data/lib/buildr/java/cobertura.rb +57 -35
- data/lib/buildr/java/commands.rb +14 -5
- data/lib/buildr/java/compiler.rb +3 -217
- data/lib/buildr/java/deprecated.rb +4 -4
- data/lib/buildr/java/doc.rb +70 -0
- data/lib/buildr/java/emma.rb +22 -22
- data/lib/buildr/java/jruby.rb +4 -4
- data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
- data/lib/buildr/java/packaging.rb +30 -29
- data/lib/buildr/java/pom.rb +4 -4
- data/lib/buildr/java/rjb.rb +6 -6
- data/lib/buildr/java/test_result.rb +61 -85
- data/lib/buildr/java/tests.rb +44 -27
- data/lib/buildr/java/version_requirement.rb +8 -8
- data/lib/buildr/java.rb +1 -0
- data/lib/buildr/packaging/archive.rb +55 -22
- data/lib/buildr/packaging/artifact.rb +75 -36
- data/lib/buildr/packaging/artifact_namespace.rb +90 -78
- data/lib/buildr/packaging/artifact_search.rb +5 -5
- data/lib/buildr/packaging/gems.rb +11 -7
- data/lib/buildr/packaging/package.rb +10 -7
- data/lib/buildr/packaging/tar.rb +14 -14
- data/lib/buildr/packaging/version_requirement.rb +30 -10
- data/lib/buildr/packaging/ziptask.rb +51 -13
- data/lib/buildr/scala/bdd.rb +25 -20
- data/lib/buildr/scala/compiler.rb +87 -40
- data/lib/buildr/scala/doc.rb +106 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +14 -9
- data/lib/buildr/scala/tests.rb +33 -26
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/shell.rb +33 -33
- data/lib/buildr.rb +1 -1
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +1 -1
- data/rakelib/doc.rake +7 -0
- data/rakelib/package.rake +1 -1
- data/rakelib/release.rake +9 -6
- data/rakelib/rspec.rake +26 -7
- data/rakelib/setup.rake +15 -3
- data/rakelib/stage.rake +18 -11
- data/spec/addon/drb_spec.rb +25 -25
- data/spec/core/application_spec.rb +111 -21
- data/spec/core/build_spec.rb +16 -15
- data/spec/core/cc_spec.rb +174 -0
- data/spec/core/checks_spec.rb +34 -34
- data/spec/core/common_spec.rb +51 -5
- data/spec/core/compile_spec.rb +89 -14
- data/spec/core/extension_spec.rb +127 -19
- data/spec/core/generate_spec.rb +2 -2
- data/spec/core/project_spec.rb +10 -10
- data/spec/core/test_spec.rb +144 -35
- data/spec/core/transport_spec.rb +8 -8
- data/spec/core/util_spec.rb +63 -5
- data/spec/groovy/bdd_spec.rb +5 -5
- data/spec/groovy/compiler_spec.rb +29 -18
- data/spec/ide/eclipse_spec.rb +185 -9
- data/spec/ide/idea7x_spec.rb +22 -10
- data/spec/java/ant_spec.rb +9 -5
- data/spec/java/bdd_spec.rb +29 -37
- data/spec/java/cobertura_spec.rb +12 -12
- data/spec/java/commands_spec.rb +34 -0
- data/spec/java/compiler_spec.rb +53 -53
- data/spec/java/emma_spec.rb +11 -11
- data/spec/java/java_spec.rb +10 -10
- data/spec/java/packaging_spec.rb +67 -20
- data/spec/java/test_coverage_helper.rb +18 -18
- data/spec/java/tests_spec.rb +13 -9
- data/spec/packaging/archive_spec.rb +187 -20
- data/spec/packaging/artifact_namespace_spec.rb +172 -83
- data/spec/packaging/artifact_spec.rb +83 -18
- data/spec/packaging/packaging_spec.rb +41 -14
- data/spec/sandbox.rb +23 -12
- data/spec/scala/bdd_spec.rb +13 -8
- data/spec/scala/compiler_spec.rb +18 -13
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +46 -24
- data/spec/spec_helpers.rb +28 -10
- data/spec/version_requirement_spec.rb +25 -11
- metadata +149 -133
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
- data/rakelib/stage.rake~ +0 -213
@@ -72,7 +72,7 @@ describe Buildr::Application do
|
|
72
72
|
Buildr.application.environment.should eql('test')
|
73
73
|
ENV['BUILDR_ENV'].should eql('test')
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
it 'should be echoed to user' do
|
77
77
|
write 'buildfile'
|
78
78
|
ENV['BUILDR_ENV'] = 'spec'
|
@@ -80,12 +80,22 @@ describe Buildr::Application do
|
|
80
80
|
lambda { Buildr.application.send :load_buildfile }.should show(%r{(in .*, spec)})
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
describe 'options' do
|
85
85
|
it "should have 'tasks' as the sole default rakelib" do
|
86
86
|
Buildr.application.send(:handle_options)
|
87
87
|
Buildr.application.options.rakelib.should == ['tasks']
|
88
88
|
end
|
89
|
+
|
90
|
+
it 'should show the version when prompted with -V' do
|
91
|
+
ARGV.push('-V')
|
92
|
+
test_exit(0) { Buildr.application.send(:handle_options) }.should show(/Buildr #{Buildr::VERSION}.*/)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should show the version when prompted with --version' do
|
96
|
+
ARGV.push('--version')
|
97
|
+
test_exit(0) { Buildr.application.send(:handle_options) }.should show(/Buildr #{Buildr::VERSION}.*/)
|
98
|
+
end
|
89
99
|
end
|
90
100
|
|
91
101
|
describe 'gems' do
|
@@ -248,45 +258,45 @@ describe Buildr::Application do
|
|
248
258
|
@original_loaded_features = $LOADED_FEATURES.dup
|
249
259
|
Buildr.application.options.rakelib = ["tasks"]
|
250
260
|
end
|
251
|
-
|
261
|
+
|
252
262
|
after do
|
253
263
|
$taskfiles = nil
|
254
264
|
($LOADED_FEATURES - @original_loaded_features).each do |new_load|
|
255
265
|
$LOADED_FEATURES.delete(new_load)
|
256
266
|
end
|
257
267
|
end
|
258
|
-
|
268
|
+
|
259
269
|
def write_task(filename)
|
260
270
|
write filename, <<-RUBY
|
261
271
|
$taskfiles ||= []
|
262
272
|
$taskfiles << __FILE__
|
263
273
|
RUBY
|
264
274
|
end
|
265
|
-
|
275
|
+
|
266
276
|
def loaded_tasks
|
267
277
|
@loaded ||= Buildr.application.load_tasks
|
268
278
|
$taskfiles
|
269
279
|
end
|
270
|
-
|
280
|
+
|
271
281
|
it "should load {options.rakelib}/foo.rake" do
|
272
282
|
write_task 'tasks/foo.rake'
|
273
283
|
loaded_tasks.should have(1).task
|
274
284
|
loaded_tasks.first.should =~ %r{tasks/foo\.rake$}
|
275
285
|
end
|
276
|
-
|
286
|
+
|
277
287
|
it 'should load all *.rake files from the rakelib' do
|
278
288
|
write_task 'tasks/bar.rake'
|
279
289
|
write_task 'tasks/quux.rake'
|
280
290
|
loaded_tasks.should have(2).tasks
|
281
291
|
end
|
282
|
-
|
292
|
+
|
283
293
|
it 'should not load files which do not have the .rake extension' do
|
284
294
|
write_task 'tasks/foo.rb'
|
285
295
|
write_task 'tasks/bar.rake'
|
286
296
|
loaded_tasks.should have(1).task
|
287
297
|
loaded_tasks.first.should =~ %r{tasks/bar\.rake$}
|
288
298
|
end
|
289
|
-
|
299
|
+
|
290
300
|
it 'should load files only from the directory specified in the rakelib option' do
|
291
301
|
Buildr.application.options.rakelib = ['extensions']
|
292
302
|
write_task 'extensions/amp.rake'
|
@@ -297,7 +307,7 @@ describe Buildr::Application do
|
|
297
307
|
loaded_tasks.select{|x| x =~ %r{extensions/#{filename}\.rake}}.should have(1).entry
|
298
308
|
end
|
299
309
|
end
|
300
|
-
|
310
|
+
|
301
311
|
it 'should load files from all the directories specified in the rakelib option' do
|
302
312
|
Buildr.application.options.rakelib = ['ext', 'more', 'tasks']
|
303
313
|
write_task 'ext/foo.rake'
|
@@ -306,17 +316,71 @@ describe Buildr::Application do
|
|
306
316
|
write_task 'more/baz.rake'
|
307
317
|
loaded_tasks.should have(4).tasks
|
308
318
|
end
|
309
|
-
|
319
|
+
|
310
320
|
it 'should not load files from the rakelib more than once' do
|
311
321
|
write_task 'tasks/new_one.rake'
|
312
322
|
write_task 'tasks/already.rake'
|
313
323
|
$LOADED_FEATURES << 'tasks/already.rake'
|
314
|
-
|
324
|
+
|
315
325
|
loaded_tasks.should have(1).task
|
316
326
|
loaded_tasks.first.should =~ %r{tasks/new_one\.rake$}
|
317
327
|
end
|
318
328
|
end
|
319
329
|
|
330
|
+
describe 'exception handling' do
|
331
|
+
|
332
|
+
it 'should exit when given a SystemExit exception' do
|
333
|
+
test_exit(3) { Buildr.application.standard_exception_handling { raise SystemExit.new(3) } }
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'should exit with status 1 when given an OptionParser::ParseError exception' do
|
337
|
+
test_exit(1) { Buildr.application.standard_exception_handling { raise OptionParser::ParseError.new() } }
|
338
|
+
end
|
339
|
+
|
340
|
+
it 'should exit with status 1 when given any other type of exception exception' do
|
341
|
+
test_exit(1) { Buildr.application.standard_exception_handling { raise Exception.new() } }
|
342
|
+
end
|
343
|
+
|
344
|
+
it 'should print the class name and the message when receiving an exception (except when the exception is named Exception)' do
|
345
|
+
|
346
|
+
# Our fake $stderr for the exercise. We could start it with a matcher instead
|
347
|
+
class FakeStdErr
|
348
|
+
|
349
|
+
attr_accessor :messages
|
350
|
+
|
351
|
+
def puts(*args)
|
352
|
+
@messages ||= []
|
353
|
+
@messages += args
|
354
|
+
end
|
355
|
+
|
356
|
+
alias :write :puts
|
357
|
+
end
|
358
|
+
|
359
|
+
# Save the old $stderr and make sure to restore it in the end.
|
360
|
+
old_stderr = $stderr
|
361
|
+
begin
|
362
|
+
|
363
|
+
$stderr = FakeStdErr.new
|
364
|
+
test_exit(1) {
|
365
|
+
Buildr.application.send :standard_exception_handling do
|
366
|
+
class MyOwnNicelyNamedException < Exception
|
367
|
+
end
|
368
|
+
raise MyOwnNicelyNamedException.new('My message')
|
369
|
+
end
|
370
|
+
}.call
|
371
|
+
$stderr.messages.select {|msg| msg =~ /.*MyOwnNicelyNamedException : My message.*/}.size.should == 1
|
372
|
+
$stderr.messages.clear
|
373
|
+
test_exit(1) {
|
374
|
+
Buildr.application.send :standard_exception_handling do
|
375
|
+
raise Exception.new('My message')
|
376
|
+
end
|
377
|
+
}.call
|
378
|
+
$stderr.messages.select {|msg| msg =~ /.*My message.*/ && !(msg =~ /Exception/)}.size.should == 1
|
379
|
+
end
|
380
|
+
$stderr = old_stderr
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
320
384
|
end
|
321
385
|
|
322
386
|
|
@@ -439,48 +503,55 @@ describe Buildr, 'settings' do
|
|
439
503
|
@buildfile_time = Time.now - 10
|
440
504
|
write 'buildfile'; File.utime(@buildfile_time, @buildfile_time, 'buildfile')
|
441
505
|
end
|
442
|
-
|
506
|
+
|
443
507
|
it 'should point to the buildfile' do
|
444
508
|
Buildr.application.buildfile.should point_to_path('buildfile')
|
445
509
|
end
|
446
|
-
|
510
|
+
|
447
511
|
it 'should be a defined task' do
|
448
512
|
Buildr.application.buildfile.should == file(File.expand_path('buildfile'))
|
449
513
|
end
|
450
|
-
|
514
|
+
|
451
515
|
it 'should ignore any rake namespace' do
|
452
516
|
namespace 'dummy_ns' do
|
453
517
|
Buildr.application.buildfile.should point_to_path('buildfile')
|
454
518
|
end
|
455
519
|
end
|
456
|
-
|
520
|
+
|
457
521
|
it 'should have the same timestamp as the buildfile' do
|
458
522
|
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
|
459
523
|
end
|
460
|
-
|
524
|
+
|
461
525
|
it 'should have the same timestamp as build.yaml if the latter is newer' do
|
462
526
|
write 'build.yaml'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'build.yaml')
|
463
527
|
Buildr.application.run
|
464
528
|
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
|
465
529
|
end
|
466
|
-
|
530
|
+
|
467
531
|
it 'should have the same timestamp as the buildfile if build.yaml is older' do
|
468
532
|
write 'build.yaml'; File.utime(@buildfile_time - 5, @buildfile_time - 5, 'build.yaml')
|
469
533
|
Buildr.application.run
|
470
534
|
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
|
471
535
|
end
|
472
|
-
|
473
|
-
it 'should have the same timestamp as build.rb in home dir if the latter is newer' do
|
536
|
+
|
537
|
+
it 'should have the same timestamp as build.rb in home dir if the latter is newer (until version 1.6)' do
|
538
|
+
Buildr::VERSION.should < '1.6'
|
474
539
|
write 'home/buildr.rb'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'home/buildr.rb')
|
475
540
|
Buildr.application.send :load_tasks
|
476
541
|
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
|
477
542
|
end
|
543
|
+
|
544
|
+
it 'should have the same timestamp as build.rb in home dir if the latter is newer' do
|
545
|
+
write 'home/.buildr/buildr.rb'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'home/.buildr/buildr.rb')
|
546
|
+
Buildr.application.send :load_tasks
|
547
|
+
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
|
548
|
+
end
|
478
549
|
end
|
479
550
|
end
|
480
551
|
|
481
552
|
|
482
553
|
describe Buildr do
|
483
|
-
|
554
|
+
|
484
555
|
describe 'environment' do
|
485
556
|
it 'should be same as Buildr.application.environment' do
|
486
557
|
Buildr.environment.should eql(Buildr.application.environment)
|
@@ -498,5 +569,24 @@ describe Buildr do
|
|
498
569
|
Buildr.settings.should == Buildr.application.settings
|
499
570
|
end
|
500
571
|
end
|
572
|
+
|
573
|
+
end
|
574
|
+
|
575
|
+
describe Rake do
|
576
|
+
describe 'define_task' do
|
577
|
+
it 'should restore call chain when invoke is called' do
|
578
|
+
task1 = Rake::Task.define_task('task1') do
|
579
|
+
end
|
580
|
+
|
581
|
+
task2 = Rake::Task.define_task('task2') do
|
582
|
+
chain1 = Thread.current[:rake_chain]
|
583
|
+
task1.invoke
|
584
|
+
chain2 = Thread.current[:rake_chain]
|
585
|
+
chain2.should == chain1
|
586
|
+
end
|
587
|
+
|
588
|
+
task2.invoke
|
589
|
+
end
|
590
|
+
end
|
501
591
|
end
|
502
592
|
|
data/spec/core/build_spec.rb
CHANGED
@@ -169,7 +169,7 @@ describe Project, '#target' do
|
|
169
169
|
@project.layout[:target] = 'baz'
|
170
170
|
@project.target.should eql('baz')
|
171
171
|
end
|
172
|
-
|
172
|
+
|
173
173
|
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
174
174
|
Buildr::VERSION.should < '1.5'
|
175
175
|
end
|
@@ -194,7 +194,7 @@ describe Project, '#reports' do
|
|
194
194
|
@project.layout[:reports] = 'baz'
|
195
195
|
@project.reports.should eql('baz')
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
199
199
|
Buildr::VERSION.should < '1.5'
|
200
200
|
end
|
@@ -221,7 +221,7 @@ nothing to commit (working directory clean)
|
|
221
221
|
#
|
222
222
|
# modified: lib/buildr.rb
|
223
223
|
# modified: spec/buildr_spec.rb
|
224
|
-
#
|
224
|
+
#
|
225
225
|
# Untracked files:
|
226
226
|
# (use "git add <file>..." to include in what will be committed)
|
227
227
|
#
|
@@ -232,7 +232,7 @@ nothing to commit (working directory clean)
|
|
232
232
|
|
233
233
|
it 'should reject a dirty repository, Git 1.4.3 or higher' do
|
234
234
|
Git.should_receive(:`).with('git status').and_return <<-EOF
|
235
|
-
# On branch master
|
235
|
+
# On branch master
|
236
236
|
# Changed but not updated:
|
237
237
|
# (use "git add <file>..." to update what will be committed)
|
238
238
|
#
|
@@ -381,7 +381,7 @@ describe 'a release process', :shared=>true do
|
|
381
381
|
@release.should_receive(:ruby).with('-S', 'buildr', "_#{Buildr::VERSION}_", '--buildfile', File.expand_path('buildfile.next'),
|
382
382
|
'--environment', 'development', 'clean', 'upload', 'DEBUG=no')
|
383
383
|
end
|
384
|
-
|
384
|
+
|
385
385
|
it 'should tag a release with the release version' do
|
386
386
|
@release.stub!(:update_version_to_next)
|
387
387
|
@release.should_receive(:tag_release).with('1.0.0')
|
@@ -412,7 +412,7 @@ describe 'a release process', :shared=>true do
|
|
412
412
|
@release.stub!(:tag_release)
|
413
413
|
@release.make
|
414
414
|
file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
|
415
|
-
end
|
415
|
+
end
|
416
416
|
end
|
417
417
|
|
418
418
|
describe '#resolve_tag' do
|
@@ -421,15 +421,15 @@ describe 'a release process', :shared=>true do
|
|
421
421
|
end
|
422
422
|
|
423
423
|
it 'should return tag specified by tag_name' do
|
424
|
-
|
424
|
+
Release.tag_name = 'first'
|
425
425
|
@release.send(:resolve_tag).should == 'first'
|
426
426
|
end
|
427
|
-
|
427
|
+
|
428
428
|
it 'should use tag returned by tag_name if tag_name is a proc' do
|
429
|
-
|
429
|
+
Release.tag_name = lambda { |version| "buildr-#{version}" }
|
430
430
|
@release.send(:resolve_tag).should == 'buildr-1.0.0'
|
431
431
|
end
|
432
|
-
after {
|
432
|
+
after { Release.tag_name = nil }
|
433
433
|
end
|
434
434
|
|
435
435
|
describe '#tag_release' do
|
@@ -501,13 +501,13 @@ describe 'a release process', :shared=>true do
|
|
501
501
|
end
|
502
502
|
|
503
503
|
it 'should use the commit message specified by commit_message' do
|
504
|
-
|
504
|
+
Release.commit_message = 'Here is my custom message'
|
505
505
|
@release.should_receive(:message).and_return('Here is my custom message')
|
506
506
|
@release.update_version_to_next
|
507
507
|
end
|
508
|
-
|
508
|
+
|
509
509
|
it 'should use the commit message returned by commit_message if commit_message is a proc' do
|
510
|
-
|
510
|
+
Release.commit_message = lambda { |new_version|
|
511
511
|
new_version.should == '1.0.1-SNAPSHOT'
|
512
512
|
"increment version number to #{new_version}"
|
513
513
|
}
|
@@ -518,6 +518,7 @@ describe 'a release process', :shared=>true do
|
|
518
518
|
it 'should inform the user of the new version' do
|
519
519
|
lambda { @release.update_version_to_next }.should show_info('Current version is now 1.0.1-SNAPSHOT')
|
520
520
|
end
|
521
|
+
after { Release.commit_message = nil }
|
521
522
|
end
|
522
523
|
|
523
524
|
end
|
@@ -542,7 +543,7 @@ describe GitRelease do
|
|
542
543
|
it 'should accept a git repo' do
|
543
544
|
FileUtils.mkdir '.git'
|
544
545
|
FileUtils.touch File.join('.git', 'config')
|
545
|
-
GitRelease.applies_to?.should be_true
|
546
|
+
GitRelease.applies_to?.should be_true
|
546
547
|
end
|
547
548
|
end
|
548
549
|
|
@@ -636,7 +637,7 @@ describe SvnRelease do
|
|
636
637
|
|
637
638
|
it 'should accept a git repo' do
|
638
639
|
FileUtils.touch '.svn'
|
639
|
-
SvnRelease.applies_to?.should be_true
|
640
|
+
SvnRelease.applies_to?.should be_true
|
640
641
|
end
|
641
642
|
end
|
642
643
|
|
@@ -0,0 +1,174 @@
|
|
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
|
+
module CCHelper
|
20
|
+
def setup_cc
|
21
|
+
project = define('foo')
|
22
|
+
|
23
|
+
cc = project.cc
|
24
|
+
project.stub!(:task).with(:cc).and_return(cc)
|
25
|
+
|
26
|
+
compile = mock 'compile'
|
27
|
+
project.stub!(:task).with(:compile).and_return(compile)
|
28
|
+
|
29
|
+
test_compile = mock 'test:compile'
|
30
|
+
project.stub!(:task).with('test:compile').and_return(test_compile)
|
31
|
+
|
32
|
+
filter = mock('resources').tap do |resources|
|
33
|
+
project.stub!(:task).with(:resources).and_return(resources)
|
34
|
+
|
35
|
+
back = mock 'filter'
|
36
|
+
resources.stub!(:filter).and_return(back)
|
37
|
+
|
38
|
+
back
|
39
|
+
end
|
40
|
+
|
41
|
+
sources
|
42
|
+
tests
|
43
|
+
resources
|
44
|
+
|
45
|
+
[ project, compile, test_compile, filter ]
|
46
|
+
end
|
47
|
+
|
48
|
+
def sources
|
49
|
+
@sources ||= ['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java/thepackage', f) }.
|
50
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
51
|
+
end
|
52
|
+
|
53
|
+
def tests
|
54
|
+
@tests ||= ['Test1.java', 'Test2.java'].map { |f| File.join('src/test/java/thepackage', f) }.
|
55
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
56
|
+
end
|
57
|
+
|
58
|
+
def resources
|
59
|
+
@resources ||= ['Test1.html', 'Test2.html'].map { |f| File.join('src/main/resources', f) }.
|
60
|
+
each { |src| write src, '<html></html>' }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe Buildr::CCTask do
|
65
|
+
include CCHelper
|
66
|
+
|
67
|
+
it 'should default to a delay of 0.2' do
|
68
|
+
define('foo').cc.delay.should == 0.2
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should compile and test:compile on initial start' do
|
72
|
+
project, compile, test_compile, filter = setup_cc
|
73
|
+
|
74
|
+
compile.should_receive :invoke
|
75
|
+
test_compile.should_receive :invoke
|
76
|
+
filter.should_not_receive :run
|
77
|
+
|
78
|
+
thread = Thread.new do
|
79
|
+
project.cc.invoke
|
80
|
+
end
|
81
|
+
|
82
|
+
sleep 0.5
|
83
|
+
|
84
|
+
thread.exit
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should detect a file change' do |spec|
|
88
|
+
|
89
|
+
write 'src/main/java/Example.java', "public class Example {}"
|
90
|
+
write 'src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
91
|
+
|
92
|
+
project = define("foo")
|
93
|
+
cc = project.cc
|
94
|
+
|
95
|
+
compile = project.compile
|
96
|
+
|
97
|
+
|
98
|
+
test_compile = project.test.compile
|
99
|
+
|
100
|
+
filter = project.resources
|
101
|
+
|
102
|
+
# After first period:
|
103
|
+
compile.should_receive :invoke
|
104
|
+
test_compile.should_receive :invoke
|
105
|
+
filter.should_not_receive :run
|
106
|
+
|
107
|
+
thread = Thread.new do
|
108
|
+
project.cc.invoke
|
109
|
+
end
|
110
|
+
|
111
|
+
sleep 1
|
112
|
+
|
113
|
+
compile.should_receive :reenable
|
114
|
+
compile.should_receive :invoke
|
115
|
+
|
116
|
+
test_compile.should_receive :reenable
|
117
|
+
test_compile.should_receive :invoke
|
118
|
+
|
119
|
+
filter.should_not_receive :run
|
120
|
+
|
121
|
+
sleep 1 # Wait one sec as the timestamp needs to be different.
|
122
|
+
touch File.join(Dir.pwd, 'src/main/java/Example.java')
|
123
|
+
sleep 0.2# Wait one standard delay
|
124
|
+
|
125
|
+
thread.exit
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
it 'should support subprojects' do |spec|
|
130
|
+
|
131
|
+
write 'foo/src/main/java/Example.java', "public class Example {}"
|
132
|
+
write 'foo/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
133
|
+
|
134
|
+
define 'container' do
|
135
|
+
define('foo')
|
136
|
+
end
|
137
|
+
|
138
|
+
project = project("container:foo")
|
139
|
+
cc = project.cc
|
140
|
+
|
141
|
+
compile = project.compile
|
142
|
+
|
143
|
+
test_compile = project.test.compile
|
144
|
+
|
145
|
+
filter = project.resources
|
146
|
+
|
147
|
+
|
148
|
+
# After first period:
|
149
|
+
compile.should_receive :invoke
|
150
|
+
test_compile.should_receive :invoke
|
151
|
+
filter.should_not_receive :run
|
152
|
+
|
153
|
+
thread = Thread.new do
|
154
|
+
project("container").cc.invoke
|
155
|
+
end
|
156
|
+
|
157
|
+
sleep 0.5
|
158
|
+
|
159
|
+
# After we changed the file:
|
160
|
+
compile.should_receive :reenable
|
161
|
+
compile.should_receive :invoke
|
162
|
+
|
163
|
+
test_compile.should_receive :reenable
|
164
|
+
test_compile.should_receive :invoke
|
165
|
+
|
166
|
+
filter.should_not_receive :run
|
167
|
+
|
168
|
+
sleep 1 # Wait one sec as the timestamp needs to be different.
|
169
|
+
touch File.join(Dir.pwd, 'foo/src/main/java/Example.java')
|
170
|
+
sleep 0.2 # Wait one standard delay
|
171
|
+
|
172
|
+
thread.exit
|
173
|
+
end
|
174
|
+
end
|