buildr 1.3.5 → 1.4.0
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 +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
data/spec/core/checks_spec.rb
CHANGED
|
@@ -31,7 +31,7 @@ describe Project, 'check task' do
|
|
|
31
31
|
it "should execute all project's expectations" do
|
|
32
32
|
task 'expectation'
|
|
33
33
|
define 'foo', :version=>'1.0' do
|
|
34
|
-
check { task('expectation').invoke }
|
|
34
|
+
check { task('expectation').invoke }
|
|
35
35
|
end
|
|
36
36
|
lambda { project('foo').task('package').invoke }.should run_task('expectation')
|
|
37
37
|
end
|
|
@@ -52,7 +52,7 @@ describe Project, 'check task' do
|
|
|
52
52
|
it "should fail if any expectation failed" do
|
|
53
53
|
define 'foo', :version=>'1.0' do
|
|
54
54
|
check
|
|
55
|
-
check { fail 'sorry' }
|
|
55
|
+
check { fail 'sorry' }
|
|
56
56
|
check
|
|
57
57
|
end
|
|
58
58
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
@@ -342,132 +342,132 @@ end
|
|
|
342
342
|
|
|
343
343
|
|
|
344
344
|
describe Buildr::Checks::Expectation do
|
|
345
|
-
|
|
345
|
+
|
|
346
346
|
shared_examples_for 'all archive types' do
|
|
347
|
-
|
|
347
|
+
|
|
348
348
|
before do
|
|
349
349
|
archive = @archive
|
|
350
350
|
define 'foo', :version=>'1.0' do
|
|
351
351
|
package(archive).include('resources')
|
|
352
352
|
end
|
|
353
353
|
end
|
|
354
|
-
|
|
354
|
+
|
|
355
355
|
def check *args, &block
|
|
356
356
|
project('foo').check *args, &block
|
|
357
357
|
end
|
|
358
|
-
|
|
358
|
+
|
|
359
359
|
def package
|
|
360
360
|
project('foo').package(@archive)
|
|
361
361
|
end
|
|
362
|
-
|
|
362
|
+
|
|
363
363
|
describe '#exist' do
|
|
364
|
-
|
|
364
|
+
|
|
365
365
|
it "should pass if archive path exists" do
|
|
366
366
|
write 'resources/test'
|
|
367
367
|
check(package.path('resources')) { it.should exist }
|
|
368
368
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
369
369
|
end
|
|
370
|
-
|
|
370
|
+
|
|
371
371
|
it "should fail if archive path does not exist" do
|
|
372
372
|
mkpath 'resources'
|
|
373
373
|
check(package) { it.path('not-resources').should exist }
|
|
374
374
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
375
375
|
end
|
|
376
|
-
|
|
376
|
+
|
|
377
377
|
it "should pass if archive entry exists" do
|
|
378
378
|
write 'resources/test'
|
|
379
379
|
check(package.entry('resources/test')) { it.should exist }
|
|
380
380
|
check(package.path('resources').entry('test')) { it.should exist }
|
|
381
381
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
382
382
|
end
|
|
383
|
-
|
|
383
|
+
|
|
384
384
|
it "should fail if archive path does not exist" do
|
|
385
385
|
mkpath 'resources'
|
|
386
386
|
check(package.entry('resources/test')) { it.should exist }
|
|
387
387
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
388
|
-
end
|
|
388
|
+
end
|
|
389
389
|
end
|
|
390
|
-
|
|
390
|
+
|
|
391
391
|
describe '#be_empty' do
|
|
392
392
|
it "should pass if archive path is empty" do
|
|
393
393
|
mkpath 'resources'
|
|
394
394
|
check(package.path('resources')) { it.should be_empty }
|
|
395
395
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
396
396
|
end
|
|
397
|
-
|
|
397
|
+
|
|
398
398
|
it "should fail if archive path has any entries" do
|
|
399
399
|
write 'resources/test'
|
|
400
400
|
check(package.path('resources')) { it.should be_empty }
|
|
401
401
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
402
402
|
end
|
|
403
|
-
|
|
403
|
+
|
|
404
404
|
it "should pass if archive entry has no content" do
|
|
405
405
|
write 'resources/test'
|
|
406
406
|
check(package.entry('resources/test')) { it.should be_empty }
|
|
407
407
|
check(package.path('resources').entry('test')) { it.should be_empty }
|
|
408
408
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
409
409
|
end
|
|
410
|
-
|
|
410
|
+
|
|
411
411
|
it "should fail if archive entry has content" do
|
|
412
412
|
write 'resources/test', 'something'
|
|
413
413
|
check(package.entry('resources/test')) { it.should be_empty }
|
|
414
414
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
415
415
|
end
|
|
416
|
-
|
|
416
|
+
|
|
417
417
|
it "should fail if archive entry does not exist" do
|
|
418
418
|
mkpath 'resources'
|
|
419
419
|
check(package.entry('resources/test')) { it.should be_empty }
|
|
420
420
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
421
421
|
end
|
|
422
422
|
end
|
|
423
|
-
|
|
423
|
+
|
|
424
424
|
describe '#contain(entry)' do
|
|
425
|
-
|
|
425
|
+
|
|
426
426
|
it "should pass if archive entry content matches string" do
|
|
427
427
|
write 'resources/test', 'something'
|
|
428
428
|
check(package.entry('resources/test')) { it.should contain('thing') }
|
|
429
429
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
430
430
|
end
|
|
431
|
-
|
|
431
|
+
|
|
432
432
|
it "should pass if archive entry content matches pattern" do
|
|
433
433
|
write 'resources/test', "something\nor\another"
|
|
434
434
|
check(package.entry('resources/test')) { it.should contain(/or/) }
|
|
435
435
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
436
436
|
end
|
|
437
|
-
|
|
437
|
+
|
|
438
438
|
it "should pass if archive entry content matches all arguments" do
|
|
439
439
|
write 'resources/test', "something\nor\nanother"
|
|
440
440
|
check(package.entry('resources/test')) { it.should contain(/or/, /other/) }
|
|
441
441
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
442
442
|
end
|
|
443
|
-
|
|
443
|
+
|
|
444
444
|
it "should fail unless archive path contains all arguments" do
|
|
445
445
|
write 'resources/test', 'something'
|
|
446
446
|
check(package.entry('resources/test')) { it.should contain(/some/, /other/) }
|
|
447
447
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
448
448
|
end
|
|
449
|
-
|
|
449
|
+
|
|
450
450
|
it "should fail if archive entry content does not match" do
|
|
451
451
|
write 'resources/test', 'something'
|
|
452
452
|
check(package.entry('resources/test')) { it.should contain(/other/) }
|
|
453
453
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
454
454
|
end
|
|
455
|
-
|
|
455
|
+
|
|
456
456
|
it "should fail if archive entry does not exist" do
|
|
457
457
|
mkpath 'resources'
|
|
458
458
|
check(package.entry('resources/test')) { it.should contain(/anything/) }
|
|
459
459
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
460
460
|
end
|
|
461
461
|
end
|
|
462
|
-
|
|
462
|
+
|
|
463
463
|
describe '#contain(path)' do
|
|
464
|
-
|
|
464
|
+
|
|
465
465
|
it "should pass if archive path contains file" do
|
|
466
466
|
write 'resources/test'
|
|
467
467
|
check(package.path('resources')) { it.should contain('test') }
|
|
468
468
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
469
469
|
end
|
|
470
|
-
|
|
470
|
+
|
|
471
471
|
it "should handle deep nesting" do
|
|
472
472
|
write 'resources/test/test2.efx'
|
|
473
473
|
check(package) { it.should contain('resources/test/test2.efx') }
|
|
@@ -475,25 +475,25 @@ describe Buildr::Checks::Expectation do
|
|
|
475
475
|
check(package.path('resources/test')) { it.should contain('test2.efx') }
|
|
476
476
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
477
477
|
end
|
|
478
|
-
|
|
478
|
+
|
|
479
479
|
it "should pass if archive path contains pattern" do
|
|
480
480
|
write 'resources/with/test'
|
|
481
481
|
check(package.path('resources')) { it.should contain('**/t*st') }
|
|
482
482
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
483
483
|
end
|
|
484
|
-
|
|
484
|
+
|
|
485
485
|
it "should pass if archive path contains all arguments" do
|
|
486
486
|
write 'resources/with/test'
|
|
487
487
|
check(package.path('resources')) { it.should contain('**/test', '**/*') }
|
|
488
488
|
lambda { project('foo').task('package').invoke }.should_not raise_error
|
|
489
489
|
end
|
|
490
|
-
|
|
490
|
+
|
|
491
491
|
it "should fail unless archive path contains all arguments" do
|
|
492
492
|
write 'resources/test'
|
|
493
493
|
check(package.path('resources')) { it.should contain('test', 'or-not') }
|
|
494
494
|
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
|
495
495
|
end
|
|
496
|
-
|
|
496
|
+
|
|
497
497
|
it "should fail if archive path is empty" do
|
|
498
498
|
mkpath 'resources'
|
|
499
499
|
check(package.path('resources')) { it.should contain('test') }
|
|
@@ -501,17 +501,17 @@ describe Buildr::Checks::Expectation do
|
|
|
501
501
|
end
|
|
502
502
|
end
|
|
503
503
|
end
|
|
504
|
-
|
|
504
|
+
|
|
505
505
|
describe 'ZIP' do
|
|
506
506
|
before { @archive = :jar }
|
|
507
507
|
it_should_behave_like 'all archive types'
|
|
508
508
|
end
|
|
509
|
-
|
|
509
|
+
|
|
510
510
|
describe 'tar' do
|
|
511
511
|
before { @archive = :tar }
|
|
512
512
|
it_should_behave_like 'all archive types'
|
|
513
513
|
end
|
|
514
|
-
|
|
514
|
+
|
|
515
515
|
describe 'tgz' do
|
|
516
516
|
before { @archive = :tgz }
|
|
517
517
|
it_should_behave_like 'all archive types'
|
data/spec/core/common_spec.rb
CHANGED
|
@@ -218,7 +218,7 @@ describe Buildr.method(:filter) do
|
|
|
218
218
|
def source
|
|
219
219
|
File.expand_path('src')
|
|
220
220
|
end
|
|
221
|
-
|
|
221
|
+
|
|
222
222
|
it 'should return a Filter for the source' do
|
|
223
223
|
filter(source).should be_kind_of(Filter)
|
|
224
224
|
end
|
|
@@ -309,6 +309,21 @@ describe Buildr::Filter do
|
|
|
309
309
|
Dir['target/*'].sort.should eql(['target/file2', 'target/file3'])
|
|
310
310
|
end
|
|
311
311
|
|
|
312
|
+
it 'should respond to :include with regular expressions and use these inclusion patterns' do
|
|
313
|
+
@filter.from('src').into('target').include(/file[2|3]/).run
|
|
314
|
+
Dir['target/*'].sort.should eql(['target/file2', 'target/file3'])
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
it 'should respond to :include with a Proc and use these inclusion patterns' do
|
|
318
|
+
@filter.from('src').into('target').include(lambda {|file| file[-1, 1].to_i%2 == 0}).run
|
|
319
|
+
Dir['target/*'].sort.should eql(['target/file2', 'target/file4'])
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
it 'should respond to :include with a FileTask and use these inclusion patterns' do
|
|
323
|
+
@filter.from('src').into('target').include(file('target/file2'), file('target/file4')).run
|
|
324
|
+
Dir['target/*'].sort.should eql(['target/file2', 'target/file4'])
|
|
325
|
+
end
|
|
326
|
+
|
|
312
327
|
it 'should respond to :exclude and return self' do
|
|
313
328
|
@filter.exclude('file').should be(@filter)
|
|
314
329
|
end
|
|
@@ -318,6 +333,31 @@ describe Buildr::Filter do
|
|
|
318
333
|
Dir['target/*'].sort.should eql(['target/file1', 'target/file4'])
|
|
319
334
|
end
|
|
320
335
|
|
|
336
|
+
it 'should respond to :exclude with regular expressions and use these exclusion patterns' do
|
|
337
|
+
@filter.from('src').into('target').exclude(/file[2|3]/).run
|
|
338
|
+
Dir['target/*'].sort.should eql(['target/file1', 'target/file4'])
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
it 'should respond to :exclude with a Proc and use these exclusion patterns' do
|
|
342
|
+
@filter.from('src').into('target').exclude(lambda {|file| file[-1, 1].to_i%2 == 0}).run
|
|
343
|
+
Dir['target/*'].sort.should eql(['target/file1', 'target/file3'])
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
it 'should respond to :exclude with a FileTask and use these exclusion patterns' do
|
|
347
|
+
@filter.from('src').into('target').exclude(file('target/file1'), file('target/file3')).run
|
|
348
|
+
Dir['target/*'].sort.should eql(['target/file2', 'target/file4'])
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
it 'should respond to :exclude with a FileTask, use these exclusion patterns and depend on those tasks' do
|
|
352
|
+
file1 = false
|
|
353
|
+
file2 = false
|
|
354
|
+
@filter.from('src').into('target').exclude(file('target/file1').enhance { file1 = true }, file('target/file3').enhance {file2 = true }).run
|
|
355
|
+
Dir['target/*'].sort.should eql(['target/file2', 'target/file4'])
|
|
356
|
+
@filter.target.invoke
|
|
357
|
+
file1.should be_true
|
|
358
|
+
file2.should be_true
|
|
359
|
+
end
|
|
360
|
+
|
|
321
361
|
it 'should copy files over' do
|
|
322
362
|
@filter.from('src').into('target').run
|
|
323
363
|
Dir['target/*'].sort.each do |file|
|
|
@@ -419,6 +459,12 @@ describe Buildr::Filter do
|
|
|
419
459
|
@filter.using('key1'=>'value1', 'key2'=>'value2').mapper.should eql(:maven)
|
|
420
460
|
end
|
|
421
461
|
|
|
462
|
+
it 'should apply hash mapping with boolean values' do
|
|
463
|
+
write "src/file", "${key1} and ${key2}"
|
|
464
|
+
@filter.from('src').into('target').using(:key1=>true, :key2=>false).run
|
|
465
|
+
read("target/file").should eql("true and false")
|
|
466
|
+
end
|
|
467
|
+
|
|
422
468
|
it 'should apply hash mapping using regular expression' do
|
|
423
469
|
1.upto(4) { |i| write "src/file#{i}", "file#{i} with #key1# and #key2#" }
|
|
424
470
|
@filter.from('src').into('target').using(/#(.*?)#/, 'key1'=>'value1', 'key2'=>'value2').run
|
|
@@ -495,14 +541,14 @@ describe Buildr::Filter do
|
|
|
495
541
|
end
|
|
496
542
|
end
|
|
497
543
|
|
|
498
|
-
describe Filter::Mapper do
|
|
499
|
-
|
|
544
|
+
describe Filter::Mapper do
|
|
545
|
+
|
|
500
546
|
module MooMapper
|
|
501
547
|
def moo_config(*args, &block)
|
|
502
548
|
raise ArgumentError, "Expected moo block" unless block_given?
|
|
503
549
|
{ :moos => args, :callback => block }
|
|
504
550
|
end
|
|
505
|
-
|
|
551
|
+
|
|
506
552
|
def moo_transform(content, path = nil)
|
|
507
553
|
content.gsub(/moo+/i) do |str|
|
|
508
554
|
moos = yield :moos # same than config[:moos]
|
|
@@ -645,7 +691,7 @@ name3=double\\\\hash
|
|
|
645
691
|
PROPS
|
|
646
692
|
hash.should == {'name1'=>"with\tand", 'name2'=>"with\nand\f", 'name3'=>'double\hash'}
|
|
647
693
|
end
|
|
648
|
-
|
|
694
|
+
|
|
649
695
|
it 'should ignore whitespace' do
|
|
650
696
|
hash = Hash.from_java_properties('name1 = value1')
|
|
651
697
|
hash.should == {'name1'=>'value1'}
|
data/spec/core/compile_spec.rb
CHANGED
|
@@ -22,6 +22,14 @@ module CompilerHelper
|
|
|
22
22
|
@compile_task ||= define('foo').compile.using(:javac)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def compile_task_without_compiler
|
|
26
|
+
@compile_task ||= define('foo').compile
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def file_task
|
|
30
|
+
@file_taks ||= define('bar').file('src')
|
|
31
|
+
end
|
|
32
|
+
|
|
25
33
|
def sources
|
|
26
34
|
@sources ||= ['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java/thepackage', f) }.
|
|
27
35
|
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
|
@@ -47,6 +55,10 @@ describe Buildr::CompileTask do
|
|
|
47
55
|
compile_task.from(sources).should be(compile_task)
|
|
48
56
|
end
|
|
49
57
|
|
|
58
|
+
it 'should respond to from() with FileTask having no compiler set and return self' do
|
|
59
|
+
compile_task_without_compiler.from(file_task).should be(compile_task)
|
|
60
|
+
end
|
|
61
|
+
|
|
50
62
|
it 'should respond to from() and add sources' do
|
|
51
63
|
compile_task.from sources, File.dirname(sources.first)
|
|
52
64
|
compile_task.sources.should == sources + [File.dirname(sources.first)]
|
|
@@ -90,8 +102,17 @@ describe Buildr::CompileTask do
|
|
|
90
102
|
lambda { define('foo') { compile.using(:unknown) } }.should raise_error(ArgumentError, /unknown compiler/i)
|
|
91
103
|
end
|
|
92
104
|
|
|
93
|
-
it 'should
|
|
94
|
-
|
|
105
|
+
it 'should allow overriding the guessed compiler' do
|
|
106
|
+
write "src/main/java/com/example/Hello.java", ""
|
|
107
|
+
old_compiler = nil
|
|
108
|
+
new_compiler = nil
|
|
109
|
+
define('foo') {
|
|
110
|
+
old_compiler = compile.compiler
|
|
111
|
+
compile.using(:scalac)
|
|
112
|
+
new_compiler = compile.compiler
|
|
113
|
+
}
|
|
114
|
+
old_compiler.should == :javac
|
|
115
|
+
new_compiler.should == :scalac
|
|
95
116
|
end
|
|
96
117
|
end
|
|
97
118
|
|
|
@@ -100,7 +121,7 @@ describe Buildr::CompileTask, '#compiler' do
|
|
|
100
121
|
it 'should be nil if no compiler identifier' do
|
|
101
122
|
define('foo').compile.compiler.should be_nil
|
|
102
123
|
end
|
|
103
|
-
|
|
124
|
+
|
|
104
125
|
it 'should return the selected compiler' do
|
|
105
126
|
define('foo') { compile.using(:javac) }
|
|
106
127
|
project('foo').compile.compiler.should eql(:javac)
|
|
@@ -128,7 +149,7 @@ describe Buildr::CompileTask, '#language' do
|
|
|
128
149
|
it 'should be nil if no compiler identifier' do
|
|
129
150
|
define('foo').compile.language.should be_nil
|
|
130
151
|
end
|
|
131
|
-
|
|
152
|
+
|
|
132
153
|
it 'should return the appropriate language' do
|
|
133
154
|
define('foo') { compile.using(:javac) }
|
|
134
155
|
project('foo').compile.language.should eql(:java)
|
|
@@ -242,7 +263,7 @@ describe Buildr::CompileTask, '#options' do
|
|
|
242
263
|
compile_task.options.foo = 'bar'
|
|
243
264
|
compile_task.options.foo.should eql('bar')
|
|
244
265
|
end
|
|
245
|
-
|
|
266
|
+
|
|
246
267
|
it 'should have bracket accessors' do
|
|
247
268
|
compile_task.options[:foo] = 'bar'
|
|
248
269
|
compile_task.options[:foo].should eql('bar')
|
|
@@ -337,6 +358,15 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
337
358
|
lambda { compile_task.from(sources).invoke }.should_not run_task('foo:compile')
|
|
338
359
|
end
|
|
339
360
|
|
|
361
|
+
it 'should not force compilation if dependencies older than compiled' do
|
|
362
|
+
jars; project('jars').task("package").invoke
|
|
363
|
+
time = Time.now
|
|
364
|
+
jars.each { |jar| File.utime(time - 1 , time - 1, jar) }
|
|
365
|
+
sources.map { |src| File.utime(time, time, src); src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
|
|
366
|
+
each { |kls| write kls ; File.utime(time, time, kls) }
|
|
367
|
+
lambda { compile_task.from(sources).with(jars).invoke }.should_not run_task('foo:compile')
|
|
368
|
+
end
|
|
369
|
+
|
|
340
370
|
it 'should force compilation if dependencies newer than compiled' do
|
|
341
371
|
jars; project('jars').task("package").invoke
|
|
342
372
|
# On my machine the times end up the same, so need to push dependencies in the past.
|
|
@@ -348,15 +378,6 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
348
378
|
lambda { compile_task.from(sources).with(jars).invoke }.should run_task('foo:compile')
|
|
349
379
|
end
|
|
350
380
|
|
|
351
|
-
it 'should not force compilation if dependencies older than compiled' do
|
|
352
|
-
jars; project('jars').task("package").invoke
|
|
353
|
-
time = Time.now
|
|
354
|
-
jars.each { |jar| File.utime(time - 1 , time - 1, jar) }
|
|
355
|
-
sources.map { |src| File.utime(time, time, src); src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
|
|
356
|
-
each { |kls| write kls ; File.utime(time, time, kls) }
|
|
357
|
-
lambda { compile_task.from(sources).with(jars).invoke }.should_not run_task('foo:compile')
|
|
358
|
-
end
|
|
359
|
-
|
|
360
381
|
it 'should timestamp target directory if specified' do
|
|
361
382
|
time = Time.now - 10
|
|
362
383
|
mkpath compile_task.target.to_s
|
|
@@ -551,6 +572,31 @@ describe Project, '#resources' do
|
|
|
551
572
|
file('target/resources/foo').should contain('Foo')
|
|
552
573
|
end
|
|
553
574
|
|
|
575
|
+
it 'should copy new resources to target directory' do
|
|
576
|
+
time = Time.now
|
|
577
|
+
mkdir_p 'target/resources'
|
|
578
|
+
File.utime(time-1, time-1, 'target/resources')
|
|
579
|
+
|
|
580
|
+
write 'src/main/resources/foo', 'Foo'
|
|
581
|
+
|
|
582
|
+
define('foo')
|
|
583
|
+
project('foo').file('target/resources').invoke
|
|
584
|
+
file('target/resources/foo').should exist
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
it 'should copy updated resources to target directory' do
|
|
588
|
+
time = Time.now
|
|
589
|
+
mkdir_p 'target/resources'
|
|
590
|
+
write 'target/resources/foo', 'Foo'
|
|
591
|
+
File.utime(time-1, time-1, 'target/resources')
|
|
592
|
+
File.utime(time-1, time-1, 'target/resources/foo')
|
|
593
|
+
|
|
594
|
+
write 'src/main/resources/foo', 'Foo2'
|
|
595
|
+
define('foo')
|
|
596
|
+
project('foo').file('target/resources').invoke
|
|
597
|
+
file('target/resources/foo').should contain('Foo2')
|
|
598
|
+
end
|
|
599
|
+
|
|
554
600
|
it 'should not create target directory unless there are resources' do
|
|
555
601
|
define('foo').compile.invoke
|
|
556
602
|
file('target/resources').should_not exist
|
|
@@ -580,4 +626,33 @@ describe Project, '#resources' do
|
|
|
580
626
|
define('foo').compile.invoke
|
|
581
627
|
file('target/resources/foo').should contain('bar')
|
|
582
628
|
end
|
|
629
|
+
|
|
630
|
+
it 'should use current profile as default for filtering' do
|
|
631
|
+
write 'profiles.yaml', <<-YAML
|
|
632
|
+
development:
|
|
633
|
+
filter:
|
|
634
|
+
foo: bar
|
|
635
|
+
YAML
|
|
636
|
+
write 'src/main/resources/foo', '${foo} ${baz}'
|
|
637
|
+
define('foo') do
|
|
638
|
+
resources.filter.using 'baz' => 'qux'
|
|
639
|
+
end
|
|
640
|
+
project('foo').compile.invoke
|
|
641
|
+
file('target/resources/foo').should contain('bar qux')
|
|
642
|
+
end
|
|
643
|
+
|
|
644
|
+
it 'should allow clearing default filter mapping' do
|
|
645
|
+
write 'profiles.yaml', <<-YAML
|
|
646
|
+
development:
|
|
647
|
+
filter:
|
|
648
|
+
foo: bar
|
|
649
|
+
YAML
|
|
650
|
+
write 'src/main/resources/foo', '${foo} ${baz}'
|
|
651
|
+
define('foo') do
|
|
652
|
+
resources.filter.mapping.clear
|
|
653
|
+
resources.filter.using 'baz' => 'qux'
|
|
654
|
+
end
|
|
655
|
+
project('foo').compile.invoke
|
|
656
|
+
file('target/resources/foo').should contain('${foo} qux')
|
|
657
|
+
end
|
|
583
658
|
end
|