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/test_spec.rb
CHANGED
|
@@ -110,12 +110,22 @@ describe Buildr::TestTask do
|
|
|
110
110
|
test_task.compile.dependencies.should include(artifact('acme:example:jar:1.0'))
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
it 'should respond to deprecated classpath' do
|
|
114
|
+
test_task.classpath = artifact('acme:example:jar:1.0')
|
|
115
|
+
test_task.classpath.should be(artifact('acme:example:jar:1.0'))
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'should respond to dependencies' do
|
|
119
|
+
test_task.dependencies = artifact('acme:example:jar:1.0')
|
|
120
|
+
test_task.dependencies.should be(artifact('acme:example:jar:1.0'))
|
|
121
|
+
end
|
|
122
|
+
|
|
113
123
|
it 'should respond to :with and add artifacfs to task dependencies' do
|
|
114
124
|
test_task.with 'test.jar', 'acme:example:jar:1.0'
|
|
115
125
|
test_task.dependencies.should include(File.expand_path('test.jar'))
|
|
116
126
|
test_task.dependencies.should include(artifact('acme:example:jar:1.0'))
|
|
117
127
|
end
|
|
118
|
-
|
|
128
|
+
|
|
119
129
|
it 'should response to :options and return test framework options' do
|
|
120
130
|
test_task.using :foo=>'bar'
|
|
121
131
|
test_task.options[:foo].should eql('bar')
|
|
@@ -216,9 +226,9 @@ describe Buildr::TestTask do
|
|
|
216
226
|
define('foo').test.dependencies.should include(project('foo').resources.target)
|
|
217
227
|
end
|
|
218
228
|
|
|
219
|
-
it 'should
|
|
229
|
+
it 'should use the test compile dependencies' do
|
|
220
230
|
define('foo') { test.compile.using(:javac).with 'group:id:jar:1.0' }
|
|
221
|
-
project('foo').test.dependencies.
|
|
231
|
+
project('foo').test.dependencies.should include(artifact('group:id:jar:1.0'))
|
|
222
232
|
end
|
|
223
233
|
|
|
224
234
|
it 'should include the test compile target in its dependencies' do
|
|
@@ -252,7 +262,7 @@ describe Buildr::TestTask do
|
|
|
252
262
|
depends = project('foo').test.dependencies
|
|
253
263
|
depends.index(project('foo').test.resources.target).should < depends.index(project('foo').resources.target)
|
|
254
264
|
end
|
|
255
|
-
|
|
265
|
+
|
|
256
266
|
it 'should not have a last successful run timestamp before the tests are run' do
|
|
257
267
|
test_task.timestamp.should == Rake::EARLY
|
|
258
268
|
end
|
|
@@ -268,6 +278,14 @@ describe Buildr::TestTask do
|
|
|
268
278
|
mkpath project('foo').test.report_to.to_s
|
|
269
279
|
lambda { task('clean').invoke }.should change { File.exist?(project('foo').test.report_to.to_s) }.to(false)
|
|
270
280
|
end
|
|
281
|
+
|
|
282
|
+
it 'should only run tests explicitly specified if options.test is :only' do
|
|
283
|
+
Buildr.options.test = :only
|
|
284
|
+
write 'bar/src/main/java/Bar.java', 'public class Bar {}'
|
|
285
|
+
define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
|
|
286
|
+
define('foo') { compile.with project('bar') }
|
|
287
|
+
lambda { task('foo:test').invoke rescue nil }.should_not run_tasks('bar:test')
|
|
288
|
+
end
|
|
271
289
|
end
|
|
272
290
|
|
|
273
291
|
|
|
@@ -279,7 +297,7 @@ describe Buildr::TestTask, 'with no tests' do
|
|
|
279
297
|
it 'should report no failed tests' do
|
|
280
298
|
lambda { verbose(true) { define('foo').test.invoke } }.should_not show_error(/fail/i)
|
|
281
299
|
end
|
|
282
|
-
|
|
300
|
+
|
|
283
301
|
it 'should return no failed tests' do
|
|
284
302
|
define('foo') { test.using(:junit) }
|
|
285
303
|
project('foo').test.invoke
|
|
@@ -319,7 +337,7 @@ describe Buildr::TestTask, 'with passing tests' do
|
|
|
319
337
|
it 'should report no failed tests' do
|
|
320
338
|
lambda { verbose(true) { test_task.invoke } }.should_not show_error(/fail/i)
|
|
321
339
|
end
|
|
322
|
-
|
|
340
|
+
|
|
323
341
|
it 'should return passed tests' do
|
|
324
342
|
test_task.invoke
|
|
325
343
|
test_task.passed_tests.should == ['PassingTest1', 'PassingTest2']
|
|
@@ -343,7 +361,7 @@ end
|
|
|
343
361
|
|
|
344
362
|
describe Buildr::TestTask, 'with failed test' do
|
|
345
363
|
include TestHelper
|
|
346
|
-
|
|
364
|
+
|
|
347
365
|
def test_task
|
|
348
366
|
@test_task ||= begin
|
|
349
367
|
define 'foo' do
|
|
@@ -365,6 +383,11 @@ describe Buildr::TestTask, 'with failed test' do
|
|
|
365
383
|
lambda { verbose(true) { test_task.invoke rescue nil } }.should show_error(/FailingTest/)
|
|
366
384
|
end
|
|
367
385
|
|
|
386
|
+
it 'should record failed tests' do
|
|
387
|
+
test_task.invoke rescue nil
|
|
388
|
+
File.read(project('foo').path_to('target', "#{test_task.framework}-failed")).should == 'FailingTest'
|
|
389
|
+
end
|
|
390
|
+
|
|
368
391
|
it 'should return failed tests' do
|
|
369
392
|
test_task.invoke rescue nil
|
|
370
393
|
test_task.failed_tests.should == ['FailingTest']
|
|
@@ -375,6 +398,11 @@ describe Buildr::TestTask, 'with failed test' do
|
|
|
375
398
|
test_task.passed_tests.should == ['PassingTest']
|
|
376
399
|
end
|
|
377
400
|
|
|
401
|
+
it 'should know what tests failed last time' do
|
|
402
|
+
test_task.invoke rescue nil
|
|
403
|
+
project('foo').test.last_failures.should == ['FailingTest']
|
|
404
|
+
end
|
|
405
|
+
|
|
378
406
|
it 'should not fail if fail_on_failure is false' do
|
|
379
407
|
test_task.using(:fail_on_failure=>false).invoke
|
|
380
408
|
lambda { test_task.invoke }.should_not raise_error
|
|
@@ -393,7 +421,7 @@ describe Buildr::TestTask, 'with failed test' do
|
|
|
393
421
|
it 'should execute teardown task' do
|
|
394
422
|
lambda { test_task.invoke rescue nil }.should run_task('foo:test:teardown')
|
|
395
423
|
end
|
|
396
|
-
|
|
424
|
+
|
|
397
425
|
it 'should not update the last successful run timestamp' do
|
|
398
426
|
a_second_ago = Time.now - 1
|
|
399
427
|
touch_last_successful_test_run test_task, a_second_ago
|
|
@@ -460,7 +488,7 @@ describe Buildr::Project, '#test' do
|
|
|
460
488
|
test.options[:environment].should == {}
|
|
461
489
|
end
|
|
462
490
|
end
|
|
463
|
-
|
|
491
|
+
|
|
464
492
|
it 'should clone options from parent project when using #options' do
|
|
465
493
|
define 'foo' do
|
|
466
494
|
define 'bar' do
|
|
@@ -476,14 +504,14 @@ describe Buildr::Project, '#test' do
|
|
|
476
504
|
test.options[:environment].should == {}
|
|
477
505
|
end
|
|
478
506
|
end
|
|
479
|
-
|
|
507
|
+
|
|
480
508
|
it 'should accept to set a test property in the top project' do
|
|
481
509
|
define 'foo' do
|
|
482
510
|
test.options[:properties][:foo] = 'bar'
|
|
483
511
|
end
|
|
484
512
|
project('foo').test.options[:properties][:foo].should == 'bar'
|
|
485
513
|
end
|
|
486
|
-
|
|
514
|
+
|
|
487
515
|
it 'should accept to set a test property in a subproject' do
|
|
488
516
|
define 'foo' do
|
|
489
517
|
define 'bar' do
|
|
@@ -492,7 +520,7 @@ describe Buildr::Project, '#test' do
|
|
|
492
520
|
end
|
|
493
521
|
project('foo:bar').test.options[:properties][:bar].should == 'baz'
|
|
494
522
|
end
|
|
495
|
-
|
|
523
|
+
|
|
496
524
|
it 'should not change options of unrelated projects when using #options' do
|
|
497
525
|
define 'foo' do
|
|
498
526
|
test.options[:properties][:foo] = 'bar'
|
|
@@ -501,7 +529,7 @@ describe Buildr::Project, '#test' do
|
|
|
501
529
|
test.options[:properties].should == {}
|
|
502
530
|
end
|
|
503
531
|
end
|
|
504
|
-
|
|
532
|
+
|
|
505
533
|
it "should run from project's build task" do
|
|
506
534
|
write 'src/main/java/Foo.java'
|
|
507
535
|
write 'src/test/java/FooTest.java'
|
|
@@ -584,7 +612,9 @@ describe Buildr::Project, '#test.resources' do
|
|
|
584
612
|
end
|
|
585
613
|
|
|
586
614
|
it 'should create target directory even if no files to copy' do
|
|
587
|
-
define('foo')
|
|
615
|
+
define('foo') do
|
|
616
|
+
test.resources.filter.into('resources')
|
|
617
|
+
end
|
|
588
618
|
lambda { file(File.expand_path('resources')).invoke }.should change { File.exist?('resources') }.to(true)
|
|
589
619
|
end
|
|
590
620
|
|
|
@@ -598,7 +628,7 @@ end
|
|
|
598
628
|
|
|
599
629
|
describe Buildr::TestTask, '#invoke' do
|
|
600
630
|
include TestHelper
|
|
601
|
-
|
|
631
|
+
|
|
602
632
|
def test_task
|
|
603
633
|
@test_task ||= define('foo') {
|
|
604
634
|
test.using(:junit)
|
|
@@ -608,7 +638,7 @@ describe Buildr::TestTask, '#invoke' do
|
|
|
608
638
|
end
|
|
609
639
|
}.test
|
|
610
640
|
end
|
|
611
|
-
|
|
641
|
+
|
|
612
642
|
it 'should require dependencies to exist' do
|
|
613
643
|
lambda { test_task.with('no-such.jar').invoke }.should \
|
|
614
644
|
raise_error(RuntimeError, /Don't know how to build/)
|
|
@@ -622,12 +652,12 @@ describe Buildr::TestTask, '#invoke' do
|
|
|
622
652
|
it 'should run tests if they have never run' do
|
|
623
653
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
624
654
|
end
|
|
625
|
-
|
|
655
|
+
|
|
626
656
|
it 'should not run tests if test option is off' do
|
|
627
657
|
Buildr.options.test = false
|
|
628
658
|
lambda { test_task.invoke }.should_not run_task('foo:test')
|
|
629
659
|
end
|
|
630
|
-
|
|
660
|
+
|
|
631
661
|
describe 'when there was a successful test run already' do
|
|
632
662
|
before do
|
|
633
663
|
@a_second_ago = Time.now - 1
|
|
@@ -635,57 +665,69 @@ describe Buildr::TestTask, '#invoke' do
|
|
|
635
665
|
target = ['classes/Foo.class', 'resources/config.xml', 'test/classes/FooTest.class', 'test/resources/config-test.xml'].map { |f| File.join('target', f) }
|
|
636
666
|
files = ['buildfile'] + src + target
|
|
637
667
|
files.each { |file| write file }
|
|
638
|
-
(
|
|
668
|
+
dirs = (src + target).map { |file| file.pathmap('%d') }
|
|
669
|
+
(files + dirs ).each { |path| File.utime(@a_second_ago, @a_second_ago, path) }
|
|
639
670
|
touch_last_successful_test_run test_task, @a_second_ago
|
|
640
671
|
end
|
|
641
|
-
|
|
672
|
+
|
|
642
673
|
it 'should not run tests if nothing changed' do
|
|
643
674
|
lambda { test_task.invoke }.should_not run_task('foo:test')
|
|
644
675
|
end
|
|
645
|
-
|
|
676
|
+
|
|
646
677
|
it 'should run tests if options.test is :all' do
|
|
647
678
|
Buildr.options.test = :all
|
|
648
679
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
649
680
|
end
|
|
650
|
-
|
|
681
|
+
|
|
651
682
|
it 'should run tests if main compile target changed' do
|
|
652
683
|
touch project('foo').compile.target.to_s
|
|
653
684
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
654
685
|
end
|
|
655
|
-
|
|
686
|
+
|
|
656
687
|
it 'should run tests if test compile target changed' do
|
|
657
688
|
touch test_task.compile.target.to_s
|
|
658
689
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
659
690
|
end
|
|
660
|
-
|
|
691
|
+
|
|
661
692
|
it 'should run tests if main resources changed' do
|
|
662
693
|
touch project('foo').resources.target.to_s
|
|
663
694
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
664
695
|
end
|
|
665
|
-
|
|
696
|
+
|
|
666
697
|
it 'should run tests if test resources changed' do
|
|
667
698
|
touch test_task.resources.target.to_s
|
|
668
699
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
669
700
|
end
|
|
670
|
-
|
|
701
|
+
|
|
671
702
|
it 'should run tests if compile-dependent project changed' do
|
|
672
703
|
write 'bar/src/main/java/Bar.java', 'public class Bar {}'
|
|
673
704
|
define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
|
|
674
705
|
project('foo').compile.with project('bar')
|
|
675
706
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
676
707
|
end
|
|
677
|
-
|
|
708
|
+
|
|
678
709
|
it 'should run tests if test-dependent project changed' do
|
|
679
710
|
write 'bar/src/main/java/Bar.java', 'public class Bar {}'
|
|
680
711
|
define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
|
|
681
712
|
test_task.with project('bar')
|
|
682
713
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
683
714
|
end
|
|
684
|
-
|
|
715
|
+
|
|
685
716
|
it 'should run tests if buildfile changed' do
|
|
686
717
|
touch 'buildfile'
|
|
718
|
+
test_task.should_receive(:run_tests)
|
|
687
719
|
lambda { test_task.invoke }.should run_task('foo:test')
|
|
688
720
|
end
|
|
721
|
+
|
|
722
|
+
it 'should not run tests if buildfile changed but IGNORE_BUILDFILE is true' do
|
|
723
|
+
begin
|
|
724
|
+
ENV["IGNORE_BUILDFILE"] = "true"
|
|
725
|
+
test_task.should_not_receive(:run_tests)
|
|
726
|
+
test_task.invoke
|
|
727
|
+
ensure
|
|
728
|
+
ENV["IGNORE_BUILDFILE"] = nil
|
|
729
|
+
end
|
|
730
|
+
end
|
|
689
731
|
end
|
|
690
732
|
end
|
|
691
733
|
|
|
@@ -713,9 +755,38 @@ describe Rake::Task, 'test' do
|
|
|
713
755
|
it 'should ignore failure if options.test is :all' do
|
|
714
756
|
define('foo') { test { fail } }
|
|
715
757
|
define('bar') { test { fail } }
|
|
716
|
-
options.test = :all
|
|
758
|
+
options.test = :all
|
|
717
759
|
lambda { task('test').invoke rescue nil }.should run_tasks('foo:test', 'bar:test')
|
|
718
760
|
end
|
|
761
|
+
|
|
762
|
+
it 'should ignore failure in subprojects if options.test is :all' do
|
|
763
|
+
define('foo') {
|
|
764
|
+
define('p1') { test { fail } }
|
|
765
|
+
define('p2') { test { } }
|
|
766
|
+
define('p3') { test { fail } }
|
|
767
|
+
}
|
|
768
|
+
define('bar') { test { fail } }
|
|
769
|
+
options.test = :all
|
|
770
|
+
lambda { task('test').invoke rescue nil }.should run_tasks('foo:p1:test', 'foo:p2:test', 'foo:p3:test', 'bar:test')
|
|
771
|
+
end
|
|
772
|
+
|
|
773
|
+
it 'should ignore failure in subprojects if environment variable test is \'all\'' do
|
|
774
|
+
define('foo') {
|
|
775
|
+
define('p1') { test { fail } }
|
|
776
|
+
define('p2') { test { } }
|
|
777
|
+
define('p3') { test { fail } }
|
|
778
|
+
}
|
|
779
|
+
define('bar') { test { fail } }
|
|
780
|
+
ENV['test'] = 'all'
|
|
781
|
+
lambda { task('test').invoke rescue nil }.should run_tasks('foo:p1:test', 'foo:p2:test', 'foo:p3:test', 'bar:test')
|
|
782
|
+
end
|
|
783
|
+
|
|
784
|
+
it 'should ignore failure if options.test is :all and target is build task ' do
|
|
785
|
+
define('foo') { test { fail } }
|
|
786
|
+
define('bar') { test { fail } }
|
|
787
|
+
options.test = :all
|
|
788
|
+
lambda { task('build').invoke rescue nil }.should run_tasks('foo:test', 'bar:test')
|
|
789
|
+
end
|
|
719
790
|
|
|
720
791
|
it 'should ignore failure if environment variable test is \'all\'' do
|
|
721
792
|
define('foo') { test { fail } }
|
|
@@ -751,12 +822,18 @@ describe Rake::Task, 'test' do
|
|
|
751
822
|
ENV['TEST'] = 'no'
|
|
752
823
|
lambda { task('test').invoke rescue nil }.should_not run_tasks('foo:test', 'bar:test')
|
|
753
824
|
end
|
|
754
|
-
end
|
|
755
825
|
|
|
826
|
+
it "should not compile tests if environment variable test is 'no'" do
|
|
827
|
+
write "src/test/java/HelloTest.java", "public class HelloTest { public void testTest() {}}"
|
|
828
|
+
define('foo') { test { fail } }
|
|
829
|
+
ENV['test'] = 'no'
|
|
830
|
+
lambda { task('test').invoke rescue nil }.should_not run_tasks('foo:test:compile')
|
|
831
|
+
end
|
|
832
|
+
end
|
|
756
833
|
|
|
757
834
|
describe 'test rule' do
|
|
758
835
|
include TestHelper
|
|
759
|
-
|
|
836
|
+
|
|
760
837
|
it 'should execute test task on local project' do
|
|
761
838
|
define('foo') { define 'bar' }
|
|
762
839
|
lambda { task('test:something').invoke }.should run_task('foo:test')
|
|
@@ -816,7 +893,7 @@ describe 'test rule' do
|
|
|
816
893
|
define 'foo'
|
|
817
894
|
task('test:Something').invoke
|
|
818
895
|
end
|
|
819
|
-
|
|
896
|
+
|
|
820
897
|
it 'should execute the named tests even if the test task is not needed' do
|
|
821
898
|
define 'foo' do
|
|
822
899
|
test.using(:junit)
|
|
@@ -826,7 +903,7 @@ describe 'test rule' do
|
|
|
826
903
|
task('test:something').invoke
|
|
827
904
|
project('foo').test.tests.should include('something')
|
|
828
905
|
end
|
|
829
|
-
|
|
906
|
+
|
|
830
907
|
it 'should not update the last successful test run timestamp' do
|
|
831
908
|
define 'foo' do
|
|
832
909
|
test.using(:junit)
|
|
@@ -839,6 +916,38 @@ describe 'test rule' do
|
|
|
839
916
|
end
|
|
840
917
|
end
|
|
841
918
|
|
|
919
|
+
describe 'test failed' do
|
|
920
|
+
include TestHelper
|
|
921
|
+
|
|
922
|
+
def test_task
|
|
923
|
+
@test_task ||= begin
|
|
924
|
+
define 'foo' do
|
|
925
|
+
test.using(:junit)
|
|
926
|
+
test.instance_eval do
|
|
927
|
+
@framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
|
|
928
|
+
@framework.stub!(:run).and_return(['PassingTest'])
|
|
929
|
+
end
|
|
930
|
+
end
|
|
931
|
+
project('foo').test
|
|
932
|
+
end
|
|
933
|
+
end
|
|
934
|
+
|
|
935
|
+
it 'should run the tests that failed the last time' do
|
|
936
|
+
define 'foo' do
|
|
937
|
+
test.using(:junit)
|
|
938
|
+
test.instance_eval do
|
|
939
|
+
@framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
|
|
940
|
+
@framework.stub!(:run).and_return(['PassingTest'])
|
|
941
|
+
end
|
|
942
|
+
end
|
|
943
|
+
write project('foo').path_to(:target, "junit-failed"), "FailingTest"
|
|
944
|
+
task('test:failed').invoke rescue nil
|
|
945
|
+
project('foo').test.tests.should include('FailingTest')
|
|
946
|
+
project('foo').test.tests.should_not include('PassingTest')
|
|
947
|
+
end
|
|
948
|
+
|
|
949
|
+
end
|
|
950
|
+
|
|
842
951
|
|
|
843
952
|
describe Buildr::Options, 'test' do
|
|
844
953
|
it 'should be true by default' do
|
|
@@ -972,7 +1081,7 @@ describe Rake::Task, 'integration' do
|
|
|
972
1081
|
end
|
|
973
1082
|
|
|
974
1083
|
it 'should run test cases marked for integration' do
|
|
975
|
-
write 'src/test/java/FailingTest.java',
|
|
1084
|
+
write 'src/test/java/FailingTest.java',
|
|
976
1085
|
'public class FailingTest extends junit.framework.TestCase { public void testNothing() { assertTrue(false); } }'
|
|
977
1086
|
define('foo') { test.using :integration }
|
|
978
1087
|
lambda { task('test').invoke }.should_not raise_error
|
|
@@ -996,7 +1105,7 @@ describe Rake::Task, 'integration' do
|
|
|
996
1105
|
end
|
|
997
1106
|
|
|
998
1107
|
it 'should not fail if test=all' do
|
|
999
|
-
write 'src/test/java/FailingTest.java',
|
|
1108
|
+
write 'src/test/java/FailingTest.java',
|
|
1000
1109
|
'public class FailingTest extends junit.framework.TestCase { public void testNothing() { assertTrue(false); } }'
|
|
1001
1110
|
define('foo') { test.using :integration }
|
|
1002
1111
|
options.test = :all
|
data/spec/core/transport_spec.rb
CHANGED
|
@@ -20,7 +20,7 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
|
20
20
|
describe URI, '#download' do
|
|
21
21
|
before do
|
|
22
22
|
write @source = 'source', @content = 'Just a file'
|
|
23
|
-
@uri = URI("file://#{File.expand_path(@source)}")
|
|
23
|
+
@uri = URI(URI.escape("file://#{File.expand_path(@source)}"))
|
|
24
24
|
@target = 'target'
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -60,7 +60,7 @@ describe URI, '#upload' do
|
|
|
60
60
|
before do
|
|
61
61
|
write @source = 'source', @content = 'Just a file'
|
|
62
62
|
@target = 'target'
|
|
63
|
-
@uri = URI("file://#{File.expand_path(@target)}")
|
|
63
|
+
@uri = URI(URI.escape("file://#{File.expand_path(@target)}"))
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
it 'should upload file if found' do
|
|
@@ -149,7 +149,7 @@ end
|
|
|
149
149
|
describe URI::FILE, '#read' do
|
|
150
150
|
before do
|
|
151
151
|
@filename = 'readme'
|
|
152
|
-
@uri = URI("file:///#{File.expand_path(@filename)}")
|
|
152
|
+
@uri = URI(URI.escape("file:///#{File.expand_path(@filename)}"))
|
|
153
153
|
@content = 'Readme. Please!'
|
|
154
154
|
write 'readme', @content
|
|
155
155
|
end
|
|
@@ -180,7 +180,7 @@ end
|
|
|
180
180
|
describe URI::FILE, '#write' do
|
|
181
181
|
before do
|
|
182
182
|
@filename = 'readme'
|
|
183
|
-
@uri = URI("file:///#{File.expand_path(@filename)}")
|
|
183
|
+
@uri = URI(URI.escape("file:///#{File.expand_path(@filename)}"))
|
|
184
184
|
@content = 'Readme. Please!'
|
|
185
185
|
end
|
|
186
186
|
|
|
@@ -240,7 +240,7 @@ describe URI::HTTP, '#read' do
|
|
|
240
240
|
@http.should_receive(:use_ssl=).with(true)
|
|
241
241
|
URI(@uri.to_s.sub(/http/, 'https')).read
|
|
242
242
|
end
|
|
243
|
-
|
|
243
|
+
|
|
244
244
|
it 'should use proxy from environment variable HTTP_PROXY when using http' do
|
|
245
245
|
ENV['HTTP_PROXY'] = @proxy
|
|
246
246
|
Net::HTTP.should_receive(:new).with(*@proxy_args).and_return(@http)
|
|
@@ -312,7 +312,7 @@ describe URI::HTTP, '#read' do
|
|
|
312
312
|
request.should_receive(:basic_auth).with('john', 'secret')
|
|
313
313
|
URI("http://john:secret@#{@host_domain}").read
|
|
314
314
|
end
|
|
315
|
-
|
|
315
|
+
|
|
316
316
|
it 'should preseve authentication information during a redirect' do
|
|
317
317
|
Net::HTTP.should_receive(:new).twice.and_return(@http)
|
|
318
318
|
|
|
@@ -324,7 +324,7 @@ describe URI::HTTP, '#read' do
|
|
|
324
324
|
Net::HTTP::Get.should_receive(:new).once.with('/', nil).and_return(request1)
|
|
325
325
|
request1.should_receive(:basic_auth).with('john', 'secret')
|
|
326
326
|
@http.should_receive(:request).with(request1).and_yield(redirect)
|
|
327
|
-
|
|
327
|
+
|
|
328
328
|
# The second request will be ok
|
|
329
329
|
ok = Net::HTTPOK.new(nil, nil, nil)
|
|
330
330
|
ok.stub!(:read_body)
|
|
@@ -503,7 +503,7 @@ describe URI::SFTP, '#write' do
|
|
|
503
503
|
end
|
|
504
504
|
|
|
505
505
|
it 'should close all opened directories' do
|
|
506
|
-
@sftp_session.should_receive(:opendir!).with(anything()).twice do |path|
|
|
506
|
+
@sftp_session.should_receive(:opendir!).with(anything()).twice do |path|
|
|
507
507
|
@sftp_session.should_receive(:close).with(handle = Object.new)
|
|
508
508
|
handle
|
|
509
509
|
end
|
data/spec/core/util_spec.rb
CHANGED
|
@@ -21,7 +21,7 @@ describe Hash do
|
|
|
21
21
|
it "should find value for one key" do
|
|
22
22
|
{:a => 1, :b => 2, :c => 3}.only(:a).should == {:a => 1}
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
it "should find values for multiple keys" do
|
|
26
26
|
{:a => 1, :b => 2, :c => 3}.only(:b, :c).should == {:b => 2, :c => 3}
|
|
27
27
|
end
|
|
@@ -36,19 +36,19 @@ describe OpenObject do
|
|
|
36
36
|
it "should be kind of Hash" do
|
|
37
37
|
Hash.should === @obj
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
it "should accept block that supplies default value" do
|
|
41
41
|
obj = OpenObject.new { |hash, key| hash[key] = "New #{key}" }
|
|
42
42
|
obj[:foo].should == "New foo"
|
|
43
43
|
obj.keys.should == [:foo]
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
it "should combine initial values from hash argument and from block" do
|
|
47
47
|
obj = OpenObject.new(:a => 6, :b => 2) { |h, k| h[k] = k.to_s * 2 }
|
|
48
48
|
obj[:a].should == 6
|
|
49
49
|
obj[:c].should == 'cc'
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
it "should allow reading a value by calling its name method" do
|
|
53
53
|
@obj.b.should == 2
|
|
54
54
|
end
|
|
@@ -60,8 +60,66 @@ describe OpenObject do
|
|
|
60
60
|
it "should allow changing a value by calling its name= method" do
|
|
61
61
|
lambda { @obj.c = 17 }.should change { @obj.c }.to(17)
|
|
62
62
|
end
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
it "should implement only method like a hash" do
|
|
65
65
|
@obj.only(:a).should == { :a => 1 }
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
|
+
|
|
69
|
+
describe File do
|
|
70
|
+
# Quite a few of the other specs depend on File#utime working correctly.
|
|
71
|
+
# These specs validate that utime is working as expected.
|
|
72
|
+
describe "#utime" do
|
|
73
|
+
it "should update mtime of directories" do
|
|
74
|
+
mkpath 'tmp'
|
|
75
|
+
begin
|
|
76
|
+
creation_time = File.mtime('tmp')
|
|
77
|
+
|
|
78
|
+
sleep 1
|
|
79
|
+
File.utime(nil, nil, 'tmp')
|
|
80
|
+
|
|
81
|
+
File.mtime('tmp').should > creation_time
|
|
82
|
+
ensure
|
|
83
|
+
Dir.rmdir 'tmp'
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "should update mtime of files" do
|
|
88
|
+
FileUtils.touch('tmp')
|
|
89
|
+
begin
|
|
90
|
+
creation_time = File.mtime('tmp')
|
|
91
|
+
|
|
92
|
+
sleep 1
|
|
93
|
+
File.utime(nil, nil, 'tmp')
|
|
94
|
+
|
|
95
|
+
File.mtime('tmp').should > creation_time
|
|
96
|
+
ensure
|
|
97
|
+
File.delete 'tmp'
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it "should be able to set mtime in the past" do
|
|
102
|
+
FileUtils.touch('tmp')
|
|
103
|
+
begin
|
|
104
|
+
time = Time.at((Time.now - 10).to_i)
|
|
105
|
+
File.utime(time, time, 'tmp')
|
|
106
|
+
|
|
107
|
+
File.mtime('tmp').should == time
|
|
108
|
+
ensure
|
|
109
|
+
File.delete 'tmp'
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it "should be able to set mtime in the future" do
|
|
114
|
+
FileUtils.touch('tmp')
|
|
115
|
+
begin
|
|
116
|
+
time = Time.at((Time.now + 10).to_i)
|
|
117
|
+
File.utime(time, time, 'tmp')
|
|
118
|
+
|
|
119
|
+
File.mtime('tmp').should == time
|
|
120
|
+
ensure
|
|
121
|
+
File.delete 'tmp'
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
data/spec/groovy/bdd_spec.rb
CHANGED
|
@@ -17,7 +17,7 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
describe Buildr::Groovy::EasyB do
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def foo(*args, &prc)
|
|
22
22
|
define('foo', *args) do
|
|
23
23
|
test.using :easyb
|
|
@@ -58,9 +58,9 @@ describe Buildr::Groovy::EasyB do
|
|
|
58
58
|
test.compile.language.should eql(:java)
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
it 'should include src/spec/groovy/*Specification.groovy' do
|
|
63
|
-
foo do
|
|
63
|
+
foo do
|
|
64
64
|
spec = _('src/spec/groovy/SomeSpecification.groovy')
|
|
65
65
|
write spec, 'true'
|
|
66
66
|
test.invoke
|
|
@@ -69,12 +69,12 @@ describe Buildr::Groovy::EasyB do
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
it 'should include src/spec/groovy/*Story.groovy' do
|
|
72
|
-
foo do
|
|
72
|
+
foo do
|
|
73
73
|
spec = _('src/spec/groovy/SomeStory.groovy')
|
|
74
74
|
write spec, 'true'
|
|
75
75
|
test.invoke
|
|
76
76
|
test.tests.should include(spec)
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
end # EasyB
|