buildr 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +148 -132
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -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
- @release.tag_name = 'first'
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
- @release.tag_name = lambda { |version| "buildr-#{version}" }
429
+ Release.tag_name = lambda { |version| "buildr-#{version}" }
430
430
  @release.send(:resolve_tag).should == 'buildr-1.0.0'
431
431
  end
432
- after { @release.tag_name = nil }
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
- @release.commit_message = 'Here is my custom message'
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
- @release.commit_message = lambda { |new_version|
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
@@ -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'