buildr 1.3.5-x86-mswin32 → 1.4.0-x86-mswin32
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.rb +1 -1
- data/lib/buildr/core.rb +1 -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/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.rb +148 -75
- 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/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java.rb +1 -0
- 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/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.rb +1 -0
- 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/shell.rb +33 -33
- 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/java/emma_spec.rb
CHANGED
@@ -28,18 +28,18 @@ describe Buildr::Emma do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it_should_behave_like 'test coverage tool'
|
31
|
-
|
31
|
+
|
32
32
|
describe 'project-specific' do
|
33
33
|
describe 'metadata file' do
|
34
34
|
it 'should have a default value' do
|
35
35
|
define('foo').emma.metadata_file.should point_to_path('reports/emma/coverage.em')
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it 'should be overridable' do
|
39
39
|
define('foo') { emma.metadata_file = path_to('target/metadata.emma') }
|
40
40
|
project('foo').emma.metadata_file.should point_to_path('target/metadata.emma')
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
it 'should be created during instrumentation' do
|
44
44
|
write 'src/main/java/Foo.java', 'public class Foo {}'
|
45
45
|
define('foo')
|
@@ -47,17 +47,17 @@ describe Buildr::Emma do
|
|
47
47
|
file(project('foo').emma.metadata_file).should exist
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
describe 'coverage file' do
|
52
52
|
it 'should have a default value' do
|
53
53
|
define('foo').emma.coverage_file.should point_to_path('reports/emma/coverage.ec')
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
it 'should be overridable' do
|
57
57
|
define('foo') { emma.coverage_file = path_to('target/coverage.emma') }
|
58
58
|
project('foo').emma.coverage_file.should point_to_path('target/coverage.emma')
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it 'should be created during test' do
|
62
62
|
write 'src/main/java/Foo.java', 'public class Foo {}'
|
63
63
|
write_test :for=>'Foo', :in=>'src/test/java'
|
@@ -83,7 +83,7 @@ describe Buildr::Emma do
|
|
83
83
|
task("foo:emma:instrument").invoke
|
84
84
|
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
it 'should instrument classes that are included but not excluded' do
|
88
88
|
write 'src/main/java/Baz.java', 'public class Baz {}'
|
89
89
|
define('foo') { emma.include('Ba*').exclude('*ar') }
|
@@ -91,13 +91,13 @@ describe Buildr::Emma do
|
|
91
91
|
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
|
92
92
|
end
|
93
93
|
end
|
94
|
-
|
94
|
+
|
95
95
|
describe 'reports' do
|
96
96
|
before do
|
97
97
|
write 'src/main/java/Foo.java', 'public class Foo {}'
|
98
98
|
write_test :for=>'Foo', :in=>'src/test/java'
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
describe 'in html' do
|
102
102
|
it 'should inform the user if no coverage data' do
|
103
103
|
rm 'src/test/java/FooTest.java'
|
@@ -106,14 +106,14 @@ describe Buildr::Emma do
|
|
106
106
|
should show_info(/No test coverage report for foo. Missing: #{project('foo').emma.coverage_file}/)
|
107
107
|
end
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
describe 'in xml' do
|
111
111
|
it 'should have an xml file' do
|
112
112
|
define('foo')
|
113
113
|
task('foo:emma:xml').invoke
|
114
114
|
file(File.join(project('foo').emma.report_dir, 'coverage.xml')).should exist
|
115
115
|
end
|
116
|
-
end
|
116
|
+
end
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
data/spec/java/java_spec.rb
CHANGED
@@ -48,42 +48,42 @@ describe Java, '#tools_jar' do
|
|
48
48
|
before do
|
49
49
|
@old_home = ENV['JAVA_HOME']
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
describe 'when JAVA_HOME points to a JDK' do
|
53
53
|
before do
|
54
54
|
Java.instance_eval { @tools_jar = nil }
|
55
55
|
write 'jdk/lib/tools.jar'
|
56
56
|
ENV['JAVA_HOME'] = File.expand_path('jdk')
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it 'should return the path to tools.jar' do
|
60
60
|
Java.tools_jar.should point_to_path('jdk/lib/tools.jar')
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
describe 'when JAVA_HOME points to a JRE inside a JDK' do
|
65
65
|
before do
|
66
66
|
Java.instance_eval { @tools_jar = nil }
|
67
67
|
write 'jdk/lib/tools.jar'
|
68
68
|
ENV['JAVA_HOME'] = File.expand_path('jdk/jre')
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
it 'should return the path to tools.jar' do
|
72
72
|
Java.tools_jar.should point_to_path('jdk/lib/tools.jar')
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
describe 'when there is no tools.jar' do
|
77
77
|
before do
|
78
78
|
Java.instance_eval { @tools_jar = nil }
|
79
79
|
ENV['JAVA_HOME'] = File.expand_path('jdk')
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
it 'should return nil' do
|
83
83
|
Java.tools_jar.should be_nil
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
after do
|
88
88
|
ENV['JAVA_HOME'] = @old_home
|
89
89
|
end
|
@@ -93,13 +93,13 @@ describe Java, '#java' do
|
|
93
93
|
before do
|
94
94
|
@old_home = ENV['JAVA_HOME']
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
describe 'when JAVA_HOME points to an invalid JRE/JDK installation' do
|
98
98
|
before do
|
99
99
|
write 'jdk'
|
100
100
|
ENV['JAVA_HOME'] = File.expand_path('jdk')
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
it 'should fail with an error message mentioning JAVA_HOME' do
|
104
104
|
begin
|
105
105
|
Java.java ['-version']
|
@@ -109,7 +109,7 @@ describe Java, '#java' do
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
after do
|
114
114
|
ENV['JAVA_HOME'] = @old_home
|
115
115
|
end
|
data/spec/java/packaging_spec.rb
CHANGED
@@ -120,6 +120,16 @@ shared_examples_for 'package with manifest' do
|
|
120
120
|
manifest.main['bar'].should eql('Bar')
|
121
121
|
end
|
122
122
|
end
|
123
|
+
|
124
|
+
it 'should close the temporary file used for packaging the MANIFEST.MF file' do
|
125
|
+
package_with_manifest 'Foo'=>1, :bar=>'Bar'
|
126
|
+
package = project('foo').package(@packaging)
|
127
|
+
package.invoke
|
128
|
+
module AccessManifestTMP
|
129
|
+
attr_reader :manifest_tmp
|
130
|
+
end
|
131
|
+
(package.dup.extend(AccessManifestTMP).manifest_tmp.closed?).should be_true
|
132
|
+
end
|
123
133
|
|
124
134
|
it 'should end hash manifest with EOL' do
|
125
135
|
package_with_manifest 'Foo'=>1, :bar=>'Bar'
|
@@ -187,6 +197,16 @@ shared_examples_for 'package with manifest' do
|
|
187
197
|
manifest.main['Meta'].should eql('data')
|
188
198
|
end
|
189
199
|
end
|
200
|
+
|
201
|
+
it 'should give 644 permissions to the manifest' do
|
202
|
+
package_with_manifest [ {}, { 'Name'=>'first', :Foo=>'first', :bar=>'second' } ]
|
203
|
+
package ||= project('foo').package(@packaging)
|
204
|
+
package.invoke
|
205
|
+
Zip::ZipFile.open(package.to_s) do |zip|
|
206
|
+
permissions = format("%o", zip.file.stat('META-INF/MANIFEST.MF').mode)
|
207
|
+
permissions.should match /644$/
|
208
|
+
end
|
209
|
+
end
|
190
210
|
|
191
211
|
it 'should not add manifest version twice' do
|
192
212
|
write 'MANIFEST.MF', 'Manifest-Version: 1.9'
|
@@ -241,7 +261,7 @@ shared_examples_for 'package with manifest' do
|
|
241
261
|
define('foo', :version => '1.0') do
|
242
262
|
manifest['Foo'] = '1'
|
243
263
|
package(packaging)
|
244
|
-
define('bar', :version => '1.0') do
|
264
|
+
define('bar', :version => '1.0') do
|
245
265
|
manifest['bar'] = 'Bar'
|
246
266
|
package(:jar)
|
247
267
|
package = packages.first
|
@@ -261,11 +281,11 @@ shared_examples_for 'package with manifest' do
|
|
261
281
|
define('foo', :version => '1.0') do
|
262
282
|
manifest['Foo'] = '1'
|
263
283
|
package(packaging)
|
264
|
-
define('bar', :version => '1.0') do
|
284
|
+
define('bar', :version => '1.0') do
|
265
285
|
manifest['bar'] = 'Bar'
|
266
286
|
package(:jar)
|
267
287
|
end
|
268
|
-
define('baz', :version => '1.0') do
|
288
|
+
define('baz', :version => '1.0') do
|
269
289
|
manifest['baz'] = 'Baz'
|
270
290
|
package(:jar)
|
271
291
|
end
|
@@ -410,6 +430,17 @@ describe Packaging, 'jar' do
|
|
410
430
|
it_should_behave_like 'package with meta_inf'
|
411
431
|
before { @meta_inf_ignore = 'MANIFEST.MF' }
|
412
432
|
|
433
|
+
it 'should place the manifest as the first entry of the file' do
|
434
|
+
write 'src/main/java/Test.java', 'class Test {}'
|
435
|
+
define('foo', :version=>'1.0') { package(:jar) }
|
436
|
+
project('foo').package(:jar).invoke
|
437
|
+
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
438
|
+
entries_to_s = jar.entries.map(&:to_s).delete_if {|entry| entry[-1,1] == "/"}
|
439
|
+
# Sometimes META-INF/ is counted as first entry, which is fair game.
|
440
|
+
(entries_to_s.first == 'META-INF/MANIFEST.MF' || entries_to_s[1] == 'META-INF/MANIFEST.MF').should be_true
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
413
444
|
it 'should use files from compile directory if nothing included' do
|
414
445
|
write 'src/main/java/Test.java', 'class Test {}'
|
415
446
|
define('foo', :version=>'1.0') { package(:jar) }
|
@@ -454,6 +485,22 @@ describe Packaging, 'jar' do
|
|
454
485
|
jar.entries.map(&:to_s).sort.should include('empty/')
|
455
486
|
end
|
456
487
|
end
|
488
|
+
|
489
|
+
it 'should raise error when calling with() with nil value' do
|
490
|
+
lambda {
|
491
|
+
define('foo', :version=>'1.0') { package(:jar).with(nil) }
|
492
|
+
}.should raise_error
|
493
|
+
end
|
494
|
+
|
495
|
+
it 'should exclude resources when ordered to do so' do
|
496
|
+
write 'src/main/resources/foo.xml', ''
|
497
|
+
foo = define('foo', :version => '1.0') { package(:jar).exclude('foo.xml')}
|
498
|
+
foo.package(:jar).invoke
|
499
|
+
Zip::ZipFile.open(foo.package(:jar).to_s) do |jar|
|
500
|
+
jar.entries.map(&:to_s).sort.should_not include('foo.xml')
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
457
504
|
end
|
458
505
|
|
459
506
|
|
@@ -701,31 +748,31 @@ describe Packaging, 'ear' do
|
|
701
748
|
end
|
702
749
|
|
703
750
|
it 'should not modify original artifact for its components' do
|
704
|
-
define 'one', :version => '1.0' do
|
751
|
+
define 'one', :version => '1.0' do
|
705
752
|
write 'src/main/resources/one.txt', '1'
|
706
753
|
package(:jar)
|
707
754
|
end
|
708
|
-
|
709
|
-
define 'two', :version => '1.0' do
|
755
|
+
|
756
|
+
define 'two', :version => '1.0' do
|
710
757
|
write 'src/main/resources/two.txt', '2'
|
711
758
|
package(:jar)
|
712
759
|
end
|
713
|
-
|
714
|
-
define 'foo', :version => '1.0' do
|
760
|
+
|
761
|
+
define 'foo', :version => '1.0' do
|
715
762
|
package(:ear).add project(:one).package(:jar)
|
716
763
|
package(:ear).add :ejb => project(:two).package(:jar)
|
717
764
|
end
|
718
765
|
|
719
766
|
inspect_ear { |files| files.should include('lib/one-1.0.jar', 'ejb/two-1.0.jar') }
|
720
|
-
|
767
|
+
|
721
768
|
Buildr::Packaging::Java::Manifest.from_zip(project('one').package(:jar)).main['Class-Path'].should be_nil
|
722
769
|
Buildr::Packaging::Java::Manifest.from_zip(project('two').package(:jar)).main['Class-Path'].should be_nil
|
723
|
-
|
770
|
+
|
724
771
|
inspect_classpath 'ejb/two-1.0.jar' do |classpath|
|
725
772
|
classpath.should include('../lib/one-1.0.jar')
|
726
773
|
end
|
727
774
|
end
|
728
|
-
|
775
|
+
|
729
776
|
it 'should map JARs to /lib directory' do
|
730
777
|
define 'foo', :version=>'1.0' do
|
731
778
|
package(:ear) << package(:jar)
|
@@ -764,12 +811,12 @@ describe Packaging, 'ear' do
|
|
764
811
|
package(:jar, :id => 'one')
|
765
812
|
package(:jar, :id => 'two')
|
766
813
|
end
|
767
|
-
define 'foo', :version => '1.0' do
|
814
|
+
define 'foo', :version => '1.0' do
|
768
815
|
package(:ear).add :lib => project('baz'),
|
769
816
|
:war => project('bar').package(:war),
|
770
817
|
:ejb => project('bar').package(:jar)
|
771
818
|
end
|
772
|
-
inspect_ear do |files|
|
819
|
+
inspect_ear do |files|
|
773
820
|
files.should include(*%w{ lib/one-1.5.jar lib/two-1.5.jar war/bar-1.5.war ejb/bar-1.5.jar })
|
774
821
|
files.should_not satisfy { files.any? { |f| f =~ /\.zip$/ } }
|
775
822
|
end
|
@@ -785,10 +832,10 @@ describe Packaging, 'ear' do
|
|
785
832
|
package(:war)
|
786
833
|
package(:jar)
|
787
834
|
end
|
788
|
-
define 'foo', :version => '1.0' do
|
835
|
+
define 'foo', :version => '1.0' do
|
789
836
|
package(:ear).add projects(:bar, :baz)
|
790
837
|
end
|
791
|
-
inspect_ear do |files|
|
838
|
+
inspect_ear do |files|
|
792
839
|
files.should include('war/bar-1.5.war', 'lib/bar-1.5.jar', 'lib/baz-1.5.jar', 'war/baz-1.5.war')
|
793
840
|
files.should_not satisfy { files.any? { |f| f =~ /\.zip$/ } }
|
794
841
|
end
|
@@ -969,7 +1016,7 @@ describe Packaging, 'ear' do
|
|
969
1016
|
end
|
970
1017
|
|
971
1018
|
|
972
|
-
it 'should generate relative classpaths for top level EJB' do
|
1019
|
+
it 'should generate relative classpaths for top level EJB' do
|
973
1020
|
define 'foo', :version => '1.0' do
|
974
1021
|
package(:ear).add package(:jar, :id => 'one'), :path => '.'
|
975
1022
|
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
|
@@ -981,7 +1028,7 @@ describe Packaging, 'ear' do
|
|
981
1028
|
end
|
982
1029
|
end
|
983
1030
|
|
984
|
-
it 'should generate relative classpaths for second level EJB' do
|
1031
|
+
it 'should generate relative classpaths for second level EJB' do
|
985
1032
|
define 'foo', :version => '1.0' do
|
986
1033
|
package(:ear).add package(:jar, :id => 'one'), :path => '.'
|
987
1034
|
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
|
@@ -993,7 +1040,7 @@ describe Packaging, 'ear' do
|
|
993
1040
|
end
|
994
1041
|
end
|
995
1042
|
|
996
|
-
it 'should generate relative classpaths for nested EJB' do
|
1043
|
+
it 'should generate relative classpaths for nested EJB' do
|
997
1044
|
define 'foo', :version => '1.0' do
|
998
1045
|
package(:ear).add package(:jar, :id => 'one'), :path => '.'
|
999
1046
|
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
|
@@ -1030,7 +1077,7 @@ describe Packaging, 'sources' do
|
|
1030
1077
|
|
1031
1078
|
it 'should be a ZipTask' do
|
1032
1079
|
define 'foo', :version=>'1.0' do
|
1033
|
-
package(:
|
1080
|
+
package(:sources).should be_kind_of(ZipTask)
|
1034
1081
|
end
|
1035
1082
|
end
|
1036
1083
|
end
|
@@ -1074,7 +1121,7 @@ end
|
|
1074
1121
|
shared_examples_for 'package_with_' do
|
1075
1122
|
|
1076
1123
|
def prepare(options = {})
|
1077
|
-
packager = "package_with_#{@packaging}"
|
1124
|
+
packager = "package_with_#{@packaging}"
|
1078
1125
|
write 'src/main/java/Source.java'
|
1079
1126
|
write 'baz/src/main/java/Source.java'
|
1080
1127
|
define 'foo', :version=>'1.0' do
|
@@ -29,21 +29,21 @@ module TestCoverageHelper
|
|
29
29
|
@expected_pattern = pattern
|
30
30
|
@pattern_matcher = lambda { |filename| File.fnmatch? pattern, filename }
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def matches?(directory)
|
34
34
|
@actual_filenames = Dir[File.join(directory,'*')]
|
35
35
|
@actual_filenames.any? &@pattern_matcher
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def failure_message
|
39
39
|
"Expected to find at least one element matching '#{@expected_pattern}' among #{@actual_filenames.inspect}, but found none"
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def negative_failure_message
|
43
43
|
"Expected to find no element matching '#{@expected_pattern}' among #{@actual_filenames.inspect}, but found matching element(s) #{@actual_filenames.select(&@pattern_matcher).inspect}"
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
# Test if a directory contains at least one file matching a given glob pattern.
|
48
48
|
#
|
49
49
|
# For example, to check that a directory contains at least one HTML file:
|
@@ -63,7 +63,7 @@ describe 'test coverage tool', :shared=>true do
|
|
63
63
|
def test_coverage_config
|
64
64
|
project('foo').send(toolname)
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
describe 'project-specific' do
|
68
68
|
|
69
69
|
before do
|
@@ -73,20 +73,20 @@ describe 'test coverage tool', :shared=>true do
|
|
73
73
|
|
74
74
|
describe 'clean' do
|
75
75
|
before { define('foo') }
|
76
|
-
|
76
|
+
|
77
77
|
it 'should remove the instrumented directory' do
|
78
78
|
mkdir_p test_coverage_config.instrumented_dir.to_s
|
79
79
|
task('foo:clean').invoke
|
80
80
|
file(test_coverage_config.instrumented_dir).should_not exist
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
it 'should remove the reporting directory' do
|
84
84
|
mkdir_p test_coverage_config.report_dir
|
85
85
|
task('foo:clean').invoke
|
86
86
|
file(test_coverage_config.report_dir).should_not exist
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
describe 'instrumented directory' do
|
91
91
|
it 'should have a default value' do
|
92
92
|
define('foo')
|
@@ -98,7 +98,7 @@ describe 'test coverage tool', :shared=>true do
|
|
98
98
|
define('foo') { send(toolname).instrumented_dir = path_to('target/coverage/classes') }
|
99
99
|
test_coverage_config.instrumented_dir.should point_to_path('target/coverage/classes')
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
it 'should be created during instrumentation' do
|
103
103
|
define('foo')
|
104
104
|
task("foo:#{toolname}:instrument").invoke
|
@@ -160,7 +160,7 @@ describe 'test coverage tool', :shared=>true do
|
|
160
160
|
task("foo:#{toolname}:html").invoke
|
161
161
|
test_coverage_config.report_to(:html).should have_files_matching('*.html')
|
162
162
|
end
|
163
|
-
|
163
|
+
|
164
164
|
it 'should contain full source code, including comments' do
|
165
165
|
write 'src/main/java/Foo.java',
|
166
166
|
'public class Foo { /* This comment is a TOKEN to check that test coverage reports include the source code */ }'
|
@@ -199,7 +199,7 @@ describe 'test coverage tool', :shared=>true do
|
|
199
199
|
task("#{toolname}:html").invoke
|
200
200
|
@tool_module.report_to(:html).should have_files_matching('*.html')
|
201
201
|
end
|
202
|
-
|
202
|
+
|
203
203
|
it 'should contain full source code, including comments' do
|
204
204
|
write 'bar/src/main/java/Bar.java',
|
205
205
|
'public class Bar { /* This comment is a TOKEN to check that test coverage reports include the source code */ }'
|
@@ -208,7 +208,7 @@ describe 'test coverage tool', :shared=>true do
|
|
208
208
|
html_report_contents.force_encoding('ascii-8bit') if RUBY_VERSION >= '1.9'
|
209
209
|
html_report_contents.should =~ /TOKEN/
|
210
210
|
end
|
211
|
-
|
211
|
+
|
212
212
|
it 'should handle gracefully a project with no source' do
|
213
213
|
define 'baz', :base_dir=>'baz'
|
214
214
|
task("#{toolname}:html").invoke
|
@@ -216,7 +216,7 @@ describe 'test coverage tool', :shared=>true do
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
219
|
-
|
219
|
+
|
220
220
|
describe 'clean' do
|
221
221
|
it 'should remove the report directory' do
|
222
222
|
define('foo')
|
@@ -224,31 +224,31 @@ describe 'test coverage tool', :shared=>true do
|
|
224
224
|
task("#{toolname}:clean").invoke
|
225
225
|
file(@tool_module.report_to).should_not exist
|
226
226
|
end
|
227
|
-
|
227
|
+
|
228
228
|
it 'should be called when calling global clean' do
|
229
229
|
define('foo')
|
230
230
|
lambda { task('clean').invoke }.should run_task("#{toolname}:clean")
|
231
231
|
end
|
232
232
|
end
|
233
233
|
end
|
234
|
-
|
234
|
+
|
235
235
|
describe 'project with no source' do
|
236
236
|
it 'should not define an html report task' do
|
237
237
|
define 'foo'
|
238
238
|
Rake::Task.task_defined?("foo:#{toolname}:html").should be(false)
|
239
239
|
end
|
240
|
-
|
240
|
+
|
241
241
|
it 'should not raise an error when instrumenting' do
|
242
242
|
define('foo')
|
243
243
|
lambda { task("foo:#{toolname}:instrument").invoke }.should_not raise_error
|
244
244
|
end
|
245
|
-
|
245
|
+
|
246
246
|
it 'should not add the instrumented directory to the testing classpath' do
|
247
247
|
define 'foo'
|
248
248
|
depends = project('foo').test.dependencies
|
249
249
|
depends.should_not include(test_coverage_config.instrumented_dir)
|
250
250
|
end
|
251
|
-
|
251
|
+
|
252
252
|
it 'should not add the test coverage tools artifacts to the testing classpath' do
|
253
253
|
define('foo')
|
254
254
|
@tool_module.dependencies.each { |artifact| project('foo').test.dependencies.should_not include(artifact) }
|