ittayd-buildr 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/CHANGELOG +62 -9
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -39
  5. data/_buildr +1 -0
  6. data/{spec/java/ant.rb → _jbuildr} +11 -15
  7. metadata +30 -210
  8. data/DISCLAIMER +0 -7
  9. data/addon/buildr/antlr.rb +0 -65
  10. data/addon/buildr/cobertura.rb +0 -22
  11. data/addon/buildr/drb.rb +0 -281
  12. data/addon/buildr/emma.rb +0 -22
  13. data/addon/buildr/hibernate.rb +0 -142
  14. data/addon/buildr/javacc.rb +0 -85
  15. data/addon/buildr/jdepend.rb +0 -60
  16. data/addon/buildr/jetty.rb +0 -248
  17. data/addon/buildr/jibx.rb +0 -86
  18. data/addon/buildr/nailgun.rb +0 -221
  19. data/addon/buildr/openjpa.rb +0 -90
  20. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
  27. data/addon/buildr/path.rb +0 -136
  28. data/addon/buildr/xmlbeans.rb +0 -93
  29. data/buildr.buildfile +0 -53
  30. data/buildr.gemspec +0 -58
  31. data/doc/css/default.css +0 -228
  32. data/doc/css/print.css +0 -100
  33. data/doc/css/syntax.css +0 -52
  34. data/doc/images/apache-incubator-logo.png +0 -0
  35. data/doc/images/buildr-hires.png +0 -0
  36. data/doc/images/buildr.png +0 -0
  37. data/doc/images/favicon.png +0 -0
  38. data/doc/images/growl-icon.tiff +0 -0
  39. data/doc/images/note.png +0 -0
  40. data/doc/images/project-structure.png +0 -0
  41. data/doc/images/tip.png +0 -0
  42. data/doc/images/zbuildr.tif +0 -0
  43. data/doc/pages/artifacts.textile +0 -207
  44. data/doc/pages/building.textile +0 -240
  45. data/doc/pages/contributing.textile +0 -208
  46. data/doc/pages/download.textile +0 -62
  47. data/doc/pages/extending.textile +0 -175
  48. data/doc/pages/getting_started.textile +0 -273
  49. data/doc/pages/index.textile +0 -42
  50. data/doc/pages/languages.textile +0 -407
  51. data/doc/pages/mailing_lists.textile +0 -17
  52. data/doc/pages/more_stuff.textile +0 -314
  53. data/doc/pages/packaging.textile +0 -427
  54. data/doc/pages/projects.textile +0 -274
  55. data/doc/pages/recipes.textile +0 -103
  56. data/doc/pages/settings_profiles.textile +0 -274
  57. data/doc/pages/testing.textile +0 -212
  58. data/doc/pages/troubleshooting.textile +0 -103
  59. data/doc/pages/whats_new.textile +0 -323
  60. data/doc/print.haml +0 -51
  61. data/doc/print.toc.yaml +0 -29
  62. data/doc/scripts/buildr-git.rb +0 -412
  63. data/doc/scripts/install-jruby.sh +0 -44
  64. data/doc/scripts/install-linux.sh +0 -64
  65. data/doc/scripts/install-osx.sh +0 -52
  66. data/doc/site.haml +0 -56
  67. data/doc/site.toc.yaml +0 -47
  68. data/etc/KEYS +0 -151
  69. data/etc/git-svn-authors +0 -16
  70. data/lib/buildr.rb +0 -33
  71. data/lib/buildr/core.rb +0 -29
  72. data/lib/buildr/core/application.rb +0 -665
  73. data/lib/buildr/core/build.rb +0 -311
  74. data/lib/buildr/core/checks.rb +0 -254
  75. data/lib/buildr/core/common.rb +0 -150
  76. data/lib/buildr/core/compile.rb +0 -590
  77. data/lib/buildr/core/environment.rb +0 -117
  78. data/lib/buildr/core/filter.rb +0 -366
  79. data/lib/buildr/core/generate.rb +0 -195
  80. data/lib/buildr/core/help.rb +0 -119
  81. data/lib/buildr/core/osx.rb +0 -49
  82. data/lib/buildr/core/progressbar.rb +0 -156
  83. data/lib/buildr/core/project.rb +0 -923
  84. data/lib/buildr/core/test.rb +0 -715
  85. data/lib/buildr/core/transports.rb +0 -560
  86. data/lib/buildr/core/util.rb +0 -294
  87. data/lib/buildr/groovy.rb +0 -18
  88. data/lib/buildr/groovy/bdd.rb +0 -106
  89. data/lib/buildr/groovy/compiler.rb +0 -138
  90. data/lib/buildr/ide.rb +0 -19
  91. data/lib/buildr/ide/eclipse.rb +0 -222
  92. data/lib/buildr/ide/idea.ipr.template +0 -300
  93. data/lib/buildr/ide/idea.rb +0 -190
  94. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  95. data/lib/buildr/ide/idea7x.rb +0 -212
  96. data/lib/buildr/java.rb +0 -23
  97. data/lib/buildr/java/ant.rb +0 -92
  98. data/lib/buildr/java/bdd.rb +0 -451
  99. data/lib/buildr/java/cobertura.rb +0 -236
  100. data/lib/buildr/java/commands.rb +0 -211
  101. data/lib/buildr/java/compiler.rb +0 -348
  102. data/lib/buildr/java/deprecated.rb +0 -141
  103. data/lib/buildr/java/emma.rb +0 -238
  104. data/lib/buildr/java/jruby.rb +0 -117
  105. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  106. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  107. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
  108. data/lib/buildr/java/packaging.rb +0 -717
  109. data/lib/buildr/java/pom.rb +0 -174
  110. data/lib/buildr/java/rjb.rb +0 -155
  111. data/lib/buildr/java/test_result.rb +0 -307
  112. data/lib/buildr/java/tests.rb +0 -329
  113. data/lib/buildr/java/version_requirement.rb +0 -172
  114. data/lib/buildr/packaging.rb +0 -24
  115. data/lib/buildr/packaging/archive.rb +0 -488
  116. data/lib/buildr/packaging/artifact.rb +0 -759
  117. data/lib/buildr/packaging/artifact_namespace.rb +0 -972
  118. data/lib/buildr/packaging/artifact_search.rb +0 -140
  119. data/lib/buildr/packaging/gems.rb +0 -102
  120. data/lib/buildr/packaging/package.rb +0 -233
  121. data/lib/buildr/packaging/tar.rb +0 -186
  122. data/lib/buildr/packaging/version_requirement.rb +0 -172
  123. data/lib/buildr/packaging/zip.rb +0 -64
  124. data/lib/buildr/packaging/ziptask.rb +0 -313
  125. data/lib/buildr/resources/buildr.icns +0 -0
  126. data/lib/buildr/scala.rb +0 -19
  127. data/lib/buildr/scala/compiler.rb +0 -109
  128. data/lib/buildr/scala/tests.rb +0 -203
  129. data/rakelib/apache.rake +0 -191
  130. data/rakelib/changelog.rake +0 -57
  131. data/rakelib/doc.rake +0 -103
  132. data/rakelib/package.rake +0 -76
  133. data/rakelib/release.rake +0 -65
  134. data/rakelib/rspec.rake +0 -83
  135. data/rakelib/rubyforge.rake +0 -56
  136. data/rakelib/scm.rake +0 -49
  137. data/rakelib/setup.rake +0 -81
  138. data/rakelib/stage.rake +0 -48
  139. data/spec/addon/drb_spec.rb +0 -328
  140. data/spec/core/application_spec.rb +0 -419
  141. data/spec/core/build_spec.rb +0 -423
  142. data/spec/core/checks_spec.rb +0 -519
  143. data/spec/core/common_spec.rb +0 -670
  144. data/spec/core/compile_spec.rb +0 -582
  145. data/spec/core/generate_spec.rb +0 -33
  146. data/spec/core/project_spec.rb +0 -776
  147. data/spec/core/test_spec.rb +0 -1098
  148. data/spec/core/transport_spec.rb +0 -500
  149. data/spec/groovy/bdd_spec.rb +0 -80
  150. data/spec/groovy/compiler_spec.rb +0 -239
  151. data/spec/ide/eclipse_spec.rb +0 -311
  152. data/spec/java/bdd_spec.rb +0 -358
  153. data/spec/java/cobertura_spec.rb +0 -77
  154. data/spec/java/compiler_spec.rb +0 -446
  155. data/spec/java/emma_spec.rb +0 -120
  156. data/spec/java/java_spec.rb +0 -96
  157. data/spec/java/packaging_spec.rb +0 -1120
  158. data/spec/java/test_coverage_spec.rb +0 -255
  159. data/spec/java/tests_spec.rb +0 -471
  160. data/spec/packaging/archive_spec.rb +0 -503
  161. data/spec/packaging/artifact_namespace_spec.rb +0 -646
  162. data/spec/packaging/artifact_spec.rb +0 -795
  163. data/spec/packaging/packaging_helper.rb +0 -63
  164. data/spec/packaging/packaging_spec.rb +0 -589
  165. data/spec/sandbox.rb +0 -139
  166. data/spec/scala/compiler_spec.rb +0 -228
  167. data/spec/scala/tests_spec.rb +0 -215
  168. data/spec/spec_helpers.rb +0 -327
  169. data/spec/version_requirement_spec.rb +0 -123
@@ -1,33 +0,0 @@
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
-
20
- describe Buildr::Generate do
21
-
22
- describe 'Generated buildfile' do
23
- it 'should be a legal buildfile' do
24
- File.open('buildfile', 'w') { |file| file.write Generate.from_directory(Dir.pwd).join("\n") }
25
- lambda { Buildr.application.run }.should_not raise_error
26
- end
27
-
28
- it 'should not contain NEXT_VERSION because it was removed in buildr 1.3.3' do
29
- buildfile = Generate.from_directory(Dir.pwd)
30
- buildfile.each { |line| line.should_not include('NEXT_VERSION')}
31
- end
32
- end
33
- end
@@ -1,776 +0,0 @@
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
-
20
- describe Project do
21
- it 'should be findable' do
22
- foo = define('foo')
23
- project('foo').should be(foo)
24
- end
25
-
26
- it 'should not exist unless defined' do
27
- lambda { project('foo') }.should raise_error(RuntimeError, /No such project/)
28
- end
29
-
30
- it 'should fail to be defined if its name is already used for a task' do
31
- lambda { define('test') }.should raise_error(RuntimeError, /Invalid project name/i)
32
- define 'valid' do
33
- lambda { define('build') }.should raise_error(RuntimeError, /Invalid project name/i)
34
- end
35
- end
36
-
37
- it 'should exist once defined' do
38
- define 'foo'
39
- lambda { project('foo') }.should_not raise_error
40
- end
41
-
42
- it 'should always return same project for same name' do
43
- foo, bar = define('foo'), define('bar')
44
- foo.should_not be(bar)
45
- foo.should be(project('foo'))
46
- bar.should be(project('bar'))
47
- end
48
-
49
- it 'should show up in projects list if defined' do
50
- define('foo')
51
- projects.map(&:name).should include('foo')
52
- end
53
-
54
- it 'should not show up in projects list unless defined' do
55
- projects.map(&:name).should_not include('foo')
56
- end
57
-
58
- it 'should be findable from within a project' do
59
- define('foo')
60
- project('foo').project('foo').should be(project('foo'))
61
- end
62
-
63
- it 'should cease to exist when project list cleared' do
64
- define 'foo'
65
- projects.map(&:name).should include('foo')
66
- Project.clear
67
- projects.map(&:name).should be_empty
68
- end
69
-
70
- it 'should be defined only once' do
71
- lambda { define 'foo' }.should_not raise_error
72
- lambda { define 'foo' }.should raise_error
73
- end
74
-
75
- it 'should be definable in any order' do
76
- Buildr.define('baz') { define('bar') { project('foo:bar') } }
77
- Buildr.define('foo') { define('bar') }
78
- lambda { project('foo') }.should_not raise_error
79
- end
80
-
81
- it 'should detect circular dependency' do
82
- Buildr.define('baz') { define('bar') { project('foo:bar') } }
83
- Buildr.define('foo') { define('bar') { project('baz:bar') } }
84
- lambda { project('foo:bar') }.should raise_error(RuntimeError, /Circular dependency/)
85
- end
86
- end
87
-
88
- describe Project, ' property' do
89
- it 'should be set if passed as argument' do
90
- define 'foo', 'version'=>'1.1'
91
- project('foo').version.should eql('1.1')
92
- end
93
-
94
- it 'should be set if assigned in body' do
95
- define('foo') { self.version = '1.2' }
96
- project('foo').version.should eql('1.2')
97
- end
98
-
99
- it 'should take precedence when assigned in body' do
100
- define('foo', 'version'=>'1.1') { self.version = '1.2' }
101
- project('foo').version.should eql('1.2')
102
- end
103
-
104
- it 'should inherit from parent (for some properties)' do
105
- define('foo', 'version'=>'1.2', :group=>'foobar') { define 'bar' }
106
- project('foo:bar').version.should eql('1.2')
107
- project('foo:bar').group.should eql('foobar')
108
- end
109
-
110
- it 'should have different value if set in sub-project' do
111
- define 'foo', 'version'=>'1.2', :group=>'foobar' do
112
- define 'bar', :version=>'1.3' do
113
- self.group = 'barbaz'
114
- end
115
- end
116
- project('foo:bar').version.should eql('1.3')
117
- project('foo:bar').group.should eql('barbaz')
118
- end
119
- end
120
-
121
-
122
- describe Project, ' block' do
123
- it 'should execute once' do
124
- define('foo') { self.name.should eql('foo') }
125
- end
126
-
127
- it 'should execute in describe of project' do
128
- define('foo') { self.version = '1.3' }
129
- project('foo').version.should eql('1.3')
130
- end
131
-
132
- it 'should execute by passing project' do
133
- define('foo') { |project| project.version = '1.3' }
134
- project('foo').version.should eql('1.3')
135
- end
136
-
137
- it 'should execute in namespace of project' do
138
- define('foo') { define('bar') { Buildr.application.current_scope.should eql(['foo', 'bar']) } }
139
- end
140
- end
141
-
142
-
143
- describe Project, '#base_dir' do
144
- it 'should be pwd if not specified' do
145
- define('foo').base_dir.should eql(Dir.pwd)
146
- end
147
-
148
- it 'should come from property, if specified' do
149
- foo = define('foo', :base_dir=>'tmp')
150
- foo.base_dir.should point_to_path('tmp')
151
- end
152
-
153
- it 'should be expanded path' do
154
- foo = define('foo', :base_dir=>'tmp')
155
- foo.base_dir.should eql(File.expand_path('tmp'))
156
- end
157
-
158
- it 'should be relative to parent project' do
159
- define('foo') { define('bar') { define 'baz' } }
160
- project('foo:bar:baz').base_dir.should point_to_path('bar/baz')
161
- end
162
-
163
- it 'should be settable only if not read' do
164
- lambda { define('foo', :base_dir=>'tmp') }.should_not raise_error
165
- lambda { define('bar', :base_dir=>'tmp') { self.base_dir = 'bar' } }.should raise_error(Exception, /Cannot set/)
166
- end
167
- end
168
-
169
-
170
- describe Layout do
171
- before :each do
172
- @layout = Layout.new
173
- end
174
-
175
- it 'should expand empty to itself' do
176
- @layout.expand.should eql('')
177
- @layout.expand('').should eql('')
178
- end
179
-
180
- it 'should expand array of symbols' do
181
- @layout.expand(:foo, :bar).should eql('foo/bar')
182
- end
183
-
184
- it 'should expand array of names' do
185
- @layout.expand('foo', 'bar').should eql('foo/bar')
186
- end
187
-
188
- it 'should map symbol to path' do
189
- @layout[:foo] = 'baz'
190
- @layout.expand(:foo, :bar).should eql('baz/bar')
191
- end
192
-
193
- it 'should map symbols to path' do
194
- @layout[:foo, :bar] = 'none'
195
- @layout.expand(:foo, :bar).should eql('none')
196
- end
197
-
198
- it 'should map strings to path' do
199
- @layout[:foo, "bar"] = 'none'
200
- @layout.expand(:foo, :bar).should eql('none')
201
- @layout.expand(:foo, 'bar').should eql('none')
202
- end
203
-
204
- it 'should ignore nil elements' do
205
- @layout[:foo, :bar] = 'none'
206
- @layout.expand(:foo, nil, :bar).should eql('none')
207
- @layout.expand(nil, :foo).should eql('foo')
208
- end
209
-
210
- it 'should return nil if path not mapped' do
211
- @layout[:foo].should be_nil
212
- end
213
-
214
- it 'should return path from symbol' do
215
- @layout[:foo] = 'path'
216
- @layout[:foo].should eql('path')
217
- end
218
-
219
- it 'should return path from symbol' do
220
- @layout[:foo, :bar] = 'path'
221
- @layout[:foo, :bar].should eql('path')
222
- end
223
-
224
- it 'should do eager mapping' do
225
- @layout[:one] = 'none'
226
- @layout[:one, :two] = '1..2'
227
- @layout.expand(:one, :two, :three).should eql('1..2/three')
228
- end
229
-
230
- end
231
-
232
-
233
- describe Project, '#layout' do
234
- before :each do
235
- @layout = Layout.new
236
- end
237
-
238
- it 'should exist by default' do
239
- define('foo').layout.should respond_to(:expand)
240
- end
241
-
242
- it 'should be clone of default layout' do
243
- define 'foo' do
244
- layout.should_not be(Layout.default)
245
- layout.expand(:test, :main).should eql(Layout.default.expand(:test, :main))
246
- end
247
- end
248
-
249
- it 'should come from property, if specified' do
250
- foo = define('foo', :layout=>@layout)
251
- foo.layout.should eql(@layout)
252
- end
253
-
254
- it 'should inherit from parent project' do
255
- define 'foo', :layout=>@layout do
256
- layout[:foo] = 'foo'
257
- define 'bar'
258
- end
259
- project('foo:bar').layout[:foo].should eql('foo')
260
- end
261
-
262
- it 'should clone when inheriting from parent project' do
263
- define 'foo', :layout=>@layout do
264
- layout[:foo] = 'foo'
265
- define 'bar' do
266
- layout[:foo] = 'bar'
267
- end
268
- end
269
- project('foo').layout[:foo].should eql('foo')
270
- project('foo:bar').layout[:foo].should eql('bar')
271
- end
272
-
273
- it 'should be settable only if not read' do
274
- lambda { define('foo', :layout=>@layout) }.should_not raise_error
275
- lambda { define('bar', :layout=>@layout) { self.layout = @layout.clone } }.should raise_error(Exception, /Cannot set/)
276
- end
277
-
278
- end
279
-
280
-
281
- describe Project, '#path_to' do
282
- it 'should return absolute paths as is' do
283
- define('foo').path_to('/tmp').should eql(File.expand_path('/tmp'))
284
- end
285
-
286
- it 'should resolve empty path to project\'s base directory' do
287
- define('foo').path_to.should eql(project('foo').base_dir)
288
- end
289
-
290
- it 'should resolve relative paths' do
291
- define('foo').path_to('tmp').should eql(File.expand_path('tmp'))
292
- end
293
-
294
- it 'should accept multiple arguments' do
295
- define('foo').path_to('foo', 'bar').should eql(File.expand_path('foo/bar'))
296
- end
297
-
298
- it 'should handle relative paths' do
299
- define('foo').path_to('..', 'bar').should eql(File.expand_path('../bar'))
300
- end
301
-
302
- it 'should resolve symbols using layout' do
303
- define('foo').layout[:foo] = 'bar'
304
- project('foo').path_to(:foo).should eql(File.expand_path('bar'))
305
- project('foo').path_to(:foo, 'tmp').should eql(File.expand_path('bar/tmp'))
306
- end
307
-
308
- it 'should resolve path for sub-project' do
309
- define('foo') { define 'bar' }
310
- project('foo:bar').path_to('foo').should eql(File.expand_path('foo', project('foo:bar').base_dir))
311
- end
312
-
313
- it 'should be idempotent for relative paths' do
314
- define 'foo'
315
- path = project('foo').path_to('bar')
316
- project('foo').path_to(path).should eql(path)
317
- end
318
- end
319
-
320
-
321
- describe Project, '#on_define' do
322
- it 'should be called when project is defined' do
323
- names = []
324
- Project.on_define { |project| names << project.name }
325
- define 'foo' ; define 'bar'
326
- names.should eql(['foo', 'bar'])
327
- end
328
-
329
- it 'should be called with project object' do
330
- Project.on_define { |project| project.name.should eql('foo') }
331
- define('foo')
332
- end
333
-
334
- it 'should be called with project object and set properties' do
335
- Project.on_define { |project| project.version.should eql('2.0') }
336
- define('foo', :version=>'2.0')
337
- end
338
-
339
- it 'should execute in namespace of project' do
340
- scopes = []
341
- Project.on_define { |project| scopes << Buildr.application.current_scope }
342
- define('foo') { define 'bar' }
343
- project('foo:bar')
344
- scopes.should eql([['foo'], ['foo', 'bar']])
345
- end
346
-
347
- it 'should be called before project block' do
348
- order = []
349
- Project.on_define { |project| order << 'on_define' }
350
- define('foo') { order << 'define' }
351
- order.should eql(['on_define', 'define'])
352
- end
353
-
354
- it 'should accept enhancement and call it after project block' do
355
- order = []
356
- Project.on_define { |project| project.enhance { order << 'enhance' } }
357
- define('foo') { order << 'define' }
358
- order.should eql(['define', 'enhance'])
359
- end
360
-
361
- it 'should accept enhancement and call it with project' do
362
- Project.on_define { |project| project.enhance { |project| project.name.should eql('foo') } }
363
- define('foo')
364
- end
365
-
366
- it 'should execute enhancement in namespace of project' do
367
- scopes = []
368
- Project.on_define { |project| project.enhance { scopes << Buildr.application.current_scope } }
369
- define('foo') { define 'bar' }
370
- project('foo:bar')
371
- scopes.should eql([['foo'], ['foo', 'bar']])
372
- end
373
-
374
- it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
375
- Buildr::VERSION.should < '1.5'
376
- end
377
- end
378
-
379
-
380
- describe Rake::Task, ' recursive' do
381
- before do
382
- @order = []
383
- Project.on_define do |project| # TODO on_define is deprecated
384
- project.recursive_task('doda') { @order << project.name }
385
- end
386
- define('foo') { define('bar') { define('baz') } }
387
- project('foo:bar:baz')
388
- end
389
-
390
- it 'should invoke same task in child project' do
391
- task('foo:doda').invoke
392
- p @order
393
- @order.should include('foo:bar:baz')
394
- @order.should include('foo:bar')
395
- @order.should include('foo')
396
- end
397
-
398
- it 'should invoke in depth-first order' do
399
- task('foo:doda').invoke
400
- @order.should eql([ 'foo:bar:baz', 'foo:bar', 'foo' ])
401
- end
402
-
403
- it 'should not invoke task in parent project' do
404
- task('foo:bar:baz:doda').invoke
405
- @order.should eql([ 'foo:bar:baz' ])
406
- end
407
- end
408
-
409
-
410
- describe 'Sub-project' do
411
- it 'should point at parent project' do
412
- define('foo') { define 'bar' }
413
- project('foo:bar').parent.should be(project('foo'))
414
- end
415
-
416
- it 'should be defined only within parent project' do
417
- lambda { define('foo:bar') }.should raise_error
418
- end
419
-
420
- it 'should have unique name' do
421
- lambda do
422
- define 'foo' do
423
- define 'bar'
424
- define 'bar'
425
- end
426
- end.should raise_error
427
- end
428
-
429
- it 'should be findable from root' do
430
- define('foo') { define 'bar' }
431
- projects.map(&:name).should include('foo:bar')
432
- end
433
-
434
- it 'should be findable from parent project' do
435
- define('foo') { define 'bar' }
436
- project('foo').projects.map(&:name).should include('foo:bar')
437
- end
438
-
439
- it 'should be findable during project definition' do
440
- define 'foo' do
441
- bar = define 'bar' do
442
- baz = define 'baz'
443
- project('baz').should eql(baz)
444
- end
445
- # Note: evaluating bar:baz first unearthed a bug that doesn't happen
446
- # if we evaluate bar, then bar:baz.
447
- project('bar:baz').should be(bar.project('baz'))
448
- project('bar').should be(bar)
449
- end
450
- end
451
-
452
- it 'should be findable only if exists' do
453
- define('foo') { define 'bar' }
454
- lambda { project('foo').project('baz') }.should raise_error(RuntimeError, /No such project/)
455
- end
456
-
457
- it 'should always execute its definition ' do
458
- ordered = []
459
- define 'foo' do
460
- ordered << self.name
461
- define('bar') { ordered << self.name }
462
- define('baz') { ordered << self.name }
463
- end
464
- ordered.should eql(['foo'])
465
- end
466
-
467
- it 'should not invoke sub projects' do
468
- invoked = false
469
- define 'foo' do
470
- define('bar') { invoked = true}
471
- end
472
- invoked.should eql(false)
473
- end
474
-
475
- it 'should execute in order of dependency' do
476
- ordered = []
477
- define 'foo' do
478
- ordered << self.name
479
- define('bar') { project('foo:baz') ; ordered << self.name }
480
- define('baz') { ordered << self.name }
481
- end
482
- project('foo').projects
483
- ordered.should eql(['foo', 'foo:baz', 'foo:bar'])
484
- end
485
-
486
- it 'should warn of circular dependency' do
487
- lambda do
488
- define 'foo' do
489
- define('bar') { project('foo:baz') }
490
- define('baz') { project('foo:bar') }
491
- end
492
- end.should raise_error(RuntimeError, /Circular dependency/)
493
- end
494
- end
495
-
496
-
497
- describe 'Top-level project' do
498
- it 'should have no parent' do
499
- define('foo')
500
- project('foo').parent.should be_nil
501
- end
502
- end
503
-
504
-
505
- describe Buildr, '#project' do
506
- it 'should raise error if no such project' do
507
- lambda { project('foo') }.should raise_error(RuntimeError, /No such project/)
508
- end
509
-
510
- it 'should return a project if exists' do
511
- foo = define('foo')
512
- project('foo').should be(foo)
513
- end
514
-
515
- it 'should find a project by its full name' do
516
- bar, baz = nil
517
- define('foo') { bar = define('bar') { baz = define('baz') } }
518
- project('foo:bar').should be(bar)
519
- project('foo:bar:baz').should be(baz)
520
- end
521
-
522
- it 'should find a project from any context' do
523
- bar, baz = nil
524
- define('foo') { bar = define('bar') { baz = define('baz') } }
525
- project('foo:bar').project('foo:bar:baz').should be(baz)
526
- project('foo:bar:baz').project('foo:bar').should be(bar)
527
- end
528
-
529
- it 'should find a project from its parent or sibling project' do
530
- define 'foo' do
531
- define 'bar'
532
- define 'baz'
533
- end
534
- project('foo').project('bar').should be(project('foo:bar'))
535
- project('foo').project('baz').should be(project('foo:baz'))
536
- project('foo:bar').project('baz').should be(project('foo:baz'))
537
- end
538
-
539
- it 'should fine a project from its parent by proximity' do
540
- define 'foo' do
541
- define('bar') { define 'baz' }
542
- define 'baz'
543
- end
544
- project('foo').project('baz').should be(project('foo:baz'))
545
- project('foo:bar').project('baz').should be(project('foo:bar:baz'))
546
- end
547
-
548
- it 'should invoke project before returning it' do
549
- define('foo').should_receive(:invoke).once
550
- project('foo')
551
- end
552
-
553
- it 'should fail if called without a project name' do
554
- lambda { project }.should raise_error(ArgumentError)
555
- end
556
-
557
- it 'should return self if called on a project without a name' do
558
- define('foo') { project.should be(self) }
559
- end
560
-
561
- it 'should evaluate parent project before returning' do
562
- # Note: gets around our define that also invokes the project.
563
- Buildr.define('foo') { define('bar'); define('baz') }
564
- project('foo:bar').should eql(projects[1])
565
- end
566
- end
567
-
568
-
569
- describe Buildr, '#projects' do
570
- it 'should only return defined projects' do
571
- projects.should eql([])
572
- define 'foo'
573
- projects.should eql([project('foo')])
574
- end
575
-
576
- it 'should return all defined projects' do
577
- define 'foo'
578
- define('bar') { define 'baz' }
579
- projects.should include(project('foo'))
580
- projects.should include(project('bar'))
581
- projects.should include(project('bar:baz'))
582
- end
583
-
584
- it 'should return only named projects' do
585
- define 'foo' ; define 'bar' ; define 'baz'
586
- projects('foo', 'bar').should include(project('foo'))
587
- projects('foo', 'bar').should include(project('bar'))
588
- projects('foo', 'bar').should_not include(project('baz'))
589
- end
590
-
591
- it 'should complain if named project does not exist' do
592
- define 'foo'
593
- projects('foo').should include(project('foo'))
594
- lambda { projects('bar') }.should raise_error(RuntimeError, /No such project/)
595
- end
596
-
597
- it 'should find a project from its parent or sibling project' do
598
- define 'foo' do
599
- define 'bar'
600
- define 'baz'
601
- end
602
- project('foo').projects('bar').should eql(projects('foo:bar'))
603
- project('foo').projects('baz').should eql(projects('foo:baz'))
604
- project('foo:bar').projects('baz').should eql(projects('foo:baz'))
605
- end
606
-
607
- it 'should fine a project from its parent by proximity' do
608
- define 'foo' do
609
- define('bar') { define 'baz' }
610
- define 'baz'
611
- end
612
- project('foo').projects('baz').should eql(projects('foo:baz'))
613
- project('foo:bar').projects('baz').should eql(projects('foo:bar:baz'))
614
- end
615
-
616
- it 'should evaluate all projects before returning' do
617
- # Note: gets around our define that also invokes the project.
618
- Buildr.define('foo') { define('bar'); define('baz') }
619
- projects.should eql(projects('foo', 'foo:bar', 'foo:baz'))
620
- end
621
- end
622
-
623
-
624
- describe Rake::Task, ' local directory' do
625
- before do
626
- @task = Project.local_task(task(('doda')))
627
- Project.on_define { |project| task('doda') { |task| @task.from project.name } }
628
- end
629
-
630
- it 'should execute project in local directory' do
631
- define 'foo'
632
- @task.should_receive(:from).with('foo')
633
- @task.invoke
634
- end
635
-
636
- it 'should execute sub-project in local directory' do
637
- @task.should_receive(:from).with('foo:bar')
638
- define('foo') { define 'bar' }
639
- in_original_dir(project('foo:bar').base_dir) { @task.invoke }
640
- end
641
-
642
- it 'should do nothing if no project in local directory' do
643
- @task.should_not_receive(:from)
644
- define('foo') { define 'bar' }
645
- in_original_dir('../not_foo') { @task.invoke }
646
- end
647
-
648
- it 'should find closest project that matches current directory' do
649
- mkpath 'bar/src/main'
650
- define('foo') { define 'bar' }
651
- project('foo:bar')
652
- @task.should_receive(:from).with('foo:bar')
653
- in_original_dir('bar/src/main') { @task.invoke }
654
- end
655
- end
656
-
657
-
658
- describe Project, '#task' do
659
- it 'should create a regular task' do
660
- define('foo') { task('bar') }
661
- Buildr.application.lookup('foo:bar').should_not be_nil
662
- end
663
-
664
- it 'should return a task defined in the project' do
665
- define('foo') { task('bar') }
666
- project('foo').task('bar').should be_instance_of(Rake::Task)
667
- end
668
-
669
- it 'should not create task outside project definition' do
670
- define 'foo'
671
- lambda { project('foo').task('bar') }.should raise_error(RuntimeError, /no task foo:bar/)
672
- end
673
-
674
- it 'should include project name as prefix' do
675
- define('foo') { task('bar') }
676
- project('foo').task('bar').name.should eql('foo:bar')
677
- end
678
-
679
- it 'should ignore namespace if starting with color' do
680
- define 'foo' do
681
- task(':bar').name.should == 'bar'
682
- end
683
- Rake::Task.task_defined?('bar').should be_true
684
- end
685
-
686
- it 'should accept single dependency' do
687
- define('foo') { task('bar'=>'baz') }
688
- project('foo').task('bar').prerequisites.should include('baz')
689
- end
690
-
691
- it 'should accept multiple dependencies' do
692
- define('foo') { task('bar'=>['baz1', 'baz2']) }
693
- project('foo').task('bar').prerequisites.should include('baz1')
694
- project('foo').task('bar').prerequisites.should include('baz2')
695
- end
696
-
697
- it 'should execute task exactly once' do
698
- define('foo') do
699
- task 'baz'
700
- task 'bar'=>'baz'
701
- end
702
- lambda { project('foo').task('bar').invoke }.should run_tasks(['foo:baz', 'foo:bar'])
703
- end
704
-
705
- it 'should create a file task' do
706
- define('foo') { file('bar') }
707
- Buildr.application.lookup(File.expand_path('bar')).should_not be_nil
708
- end
709
-
710
- it 'should create file task with absolute path' do
711
- define('foo') { file('/tmp') }
712
- Buildr.application.lookup(File.expand_path('/tmp')).should_not be_nil
713
- end
714
-
715
- it 'should create file task relative to project base directory' do
716
- define('foo', :base_dir=>'tmp') { file('bar') }
717
- Buildr.application.lookup(File.expand_path('tmp/bar')).should_not be_nil
718
- end
719
-
720
- it 'should accept single dependency' do
721
- define('foo') { file('bar'=>'baz') }
722
- project('foo').file('bar').prerequisites.should include('baz')
723
- end
724
-
725
- it 'should accept multiple dependencies' do
726
- define('foo') { file('bar'=>['baz1', 'baz2']) }
727
- project('foo').file('bar').prerequisites.should include('baz1')
728
- project('foo').file('bar').prerequisites.should include('baz2')
729
- end
730
-
731
- it 'should accept hash arguments' do
732
- define('foo') do
733
- task 'bar'=>'bar_dep'
734
- file 'baz'=>'baz_dep'
735
- end
736
- project('foo').task('bar').prerequisites.should include('bar_dep')
737
- project('foo').file('baz').prerequisites.should include('baz_dep')
738
- end
739
-
740
- it 'should return a file task defined in the project' do
741
- define('foo') { file('bar') }
742
- project('foo').file('bar').should be_instance_of(Rake::FileTask)
743
- end
744
-
745
- it 'should create file task relative to project definition' do
746
- define('foo') { define 'bar' }
747
- project('foo:bar').file('baz').name.should point_to_path('bar/baz')
748
- end
749
-
750
- it 'should execute task exactly once' do
751
- define('foo') do
752
- task 'baz'
753
- file 'bar'=>'baz'
754
- end
755
- lambda { project('foo').file('bar').invoke }.should run_tasks(['foo:baz', project('foo').path_to('bar')])
756
- end
757
- end
758
-
759
-
760
- =begin
761
- describe Buildr::Generate do
762
- it 'should be able to create buildfile from directory structure' do
763
- write 'src/main/java/Foo.java', ''
764
- write 'one/two/src/main/java/Foo.java', ''
765
- write 'one/three/src/main/java/Foo.java', ''
766
- write 'four/src/main/java/Foo.java', ''
767
- script = Buildr::Generate.from_directory(Dir.pwd)
768
- instance_eval(script.join("\n"), "generated buildfile")
769
- # projects should have been defined
770
- root = Dir.pwd.pathmap('%n')
771
- names = [root, "#{root}:one:two", "#{root}:one:three", "#{root}:four"]
772
- # the top level project has the directory name.
773
- names.each { |name| lambda { project(name) }.should_not raise_error }
774
- end
775
- end
776
- =end