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,419 +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::Application do
21
-
22
- describe 'home_dir' do
23
- it 'should point to ~/.buildr' do
24
- Buildr.application.home_dir.should eql(File.expand_path('.buildr', ENV['HOME']))
25
- end
26
-
27
- it 'should point to existing directory' do
28
- File.directory?(Buildr.application.home_dir).should be_true
29
- end
30
- end
31
-
32
- describe '#run' do
33
- it 'should execute *_load methods in order' do
34
- order = [:load_gems, :load_artifact_ns, :load_tasks, :raw_load_buildfile]
35
- order.each { |method| Buildr.application.should_receive(method).ordered }
36
- Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
37
- Buildr.application.run
38
- end
39
-
40
- it 'should load imports after loading buildfile' do
41
- method = Buildr.application.method(:raw_load_buildfile)
42
- Buildr.application.should_receive(:raw_load_buildfile) do
43
- Buildr.application.should_receive(:load_imports)
44
- method.call
45
- end
46
- Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
47
- Buildr.application.run
48
- end
49
-
50
- it 'should evaluate all projects after loading buildfile' do
51
- Buildr.application.should_receive(:load_imports) do
52
- Buildr.should_receive(:projects)
53
- end
54
- Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
55
- Buildr.application.run
56
- end
57
- end
58
-
59
- describe 'environment' do
60
- it 'should return value of BUILDR_ENV' do
61
- ENV['BUILDR_ENV'] = 'qa'
62
- Buildr.application.environment.should eql('qa')
63
- end
64
-
65
- it 'should default to development' do
66
- Buildr.application.environment.should eql('development')
67
- end
68
-
69
- it 'should set environment name from -e argument' do
70
- ARGV.push('-e', 'test')
71
- Buildr.application.send(:handle_options)
72
- Buildr.application.environment.should eql('test')
73
- ENV['BUILDR_ENV'].should eql('test')
74
- end
75
-
76
- it 'should be echoed to user' do
77
- write 'buildfile'
78
- ENV['BUILDR_ENV'] = 'spec'
79
- Buildr.application.send(:handle_options)
80
- lambda { Buildr.application.send :load_buildfile }.should show(%r{(in .*, spec)})
81
- end
82
- end
83
-
84
- describe 'gems' do
85
- before do
86
- class << Buildr.application
87
- public :load_gems
88
- end
89
- end
90
-
91
- def load_with_yaml
92
- write 'build.yaml', <<-YAML
93
- gems:
94
- - rspec
95
- - rake >= 0.8
96
- YAML
97
- Buildr.application.load_gems
98
- end
99
-
100
- it 'should return empty array if no gems specified' do
101
- Buildr.application.load_gems
102
- Buildr.application.gems.should be_empty
103
- end
104
-
105
- it 'should return one entry for each gem specified in buildr.yaml' do
106
- load_with_yaml
107
- Buildr.application.gems.size.should be(2)
108
- end
109
-
110
- it 'should return a Gem::Specification for each installed gem' do
111
- load_with_yaml
112
- Buildr.application.gems.each { |gem| gem.should be_kind_of(Gem::Specification) }
113
- end
114
-
115
- it 'should parse Gem name correctly' do
116
- load_with_yaml
117
- Buildr.application.gems.map(&:name).should include('rake', 'rspec')
118
- end
119
-
120
- it 'should find installed version of Gem' do
121
- load_with_yaml
122
- Buildr.application.gems.each { |gem| gem.version.should eql(Gem.loaded_specs[gem.name].version) }
123
- end
124
- end
125
-
126
-
127
- describe 'load_gems' do
128
- before do
129
- class << Buildr.application
130
- public :load_gems
131
- end
132
- @spec = Gem::Specification.new do |spec|
133
- spec.name = 'foo'
134
- spec.version = '1.2'
135
- end
136
- $stdout.stub!(:isatty).and_return(true)
137
- end
138
-
139
- it 'should do nothing if no gems specified' do
140
- lambda { Buildr.application.load_gems }.should_not raise_error
141
- end
142
-
143
- it 'should install nothing if specified gems already installed' do
144
- Buildr.application.should_receive(:listed_gems).and_return([Gem.loaded_specs['rspec']])
145
- Util.should_not_receive(:ruby)
146
- lambda { Buildr.application.load_gems }.should_not raise_error
147
- end
148
-
149
- it 'should fail if required gem not found in remote repository' do
150
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
151
- Gem::SourceInfoCache.should_receive(:search).and_return([])
152
- lambda { Buildr.application.load_gems }.should raise_error(LoadError, /cannot be found/i)
153
- end
154
-
155
- it 'should fail if need to install gem and not running in interactive mode' do
156
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
157
- Gem::SourceInfoCache.should_receive(:search).and_return([@spec])
158
- $stdout.should_receive(:isatty).and_return(false)
159
- lambda { Buildr.application.load_gems }.should raise_error(LoadError, /this build requires the gems/i)
160
- end
161
-
162
- it 'should ask permission before installing required gems' do
163
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
164
- Gem::SourceInfoCache.should_receive(:search).and_return([@spec])
165
- $terminal.should_receive(:agree).with(/install/, true)
166
- lambda { Buildr.application.load_gems }.should raise_error
167
- end
168
-
169
- it 'should fail if permission not granted to install gem' do
170
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
171
- Gem::SourceInfoCache.should_receive(:search).and_return([@spec])
172
- $terminal.should_receive(:agree).and_return(false)
173
- lambda { Buildr.application.load_gems }.should raise_error(LoadError, /cannot build without/i)
174
- end
175
-
176
- it 'should install gem if permission granted' do
177
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
178
- Gem::SourceInfoCache.should_receive(:search).and_return([@spec])
179
- $terminal.should_receive(:agree).and_return(true)
180
- Util.should_receive(:ruby) do |*args|
181
- args.should include('install', 'foo', '-v', '1.2')
182
- end
183
- Buildr.application.should_receive(:gem).and_return(false)
184
- Buildr.application.load_gems
185
- end
186
-
187
- it 'should reload gem cache after installing required gems' do
188
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
189
- Gem::SourceInfoCache.should_receive(:search).and_return([@spec])
190
- $terminal.should_receive(:agree).and_return(true)
191
- Util.should_receive(:ruby)
192
- Gem.source_index.should_receive(:load_gems_in).with(Gem::SourceIndex.installed_spec_directories)
193
- Buildr.application.should_receive(:gem).and_return(false)
194
- Buildr.application.load_gems
195
- end
196
-
197
- it 'should load previously installed gems' do
198
- Buildr.application.should_receive(:listed_gems).and_return([Gem.loaded_specs['rspec']])
199
- Buildr.application.should_receive(:gem).with('rspec', Gem.loaded_specs['rspec'].version.to_s)
200
- Buildr.application.load_gems
201
- end
202
-
203
- it 'should load newly installed gems' do
204
- Buildr.application.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo', '>=1.1')])
205
- Gem::SourceInfoCache.should_receive(:search).and_return([@spec])
206
- $terminal.should_receive(:agree).and_return(true)
207
- Util.should_receive(:ruby)
208
- Buildr.application.should_receive(:gem).with('foo', @spec.version.to_s)
209
- Buildr.application.load_gems
210
- end
211
-
212
- it 'should default to >=0 version requirement if not specified' do
213
- write 'build.yaml', 'gems: foo'
214
- Gem::SourceInfoCache.should_receive(:search).with(Gem::Dependency.new('foo', '>=0')).and_return([])
215
- lambda { Buildr.application.load_gems }.should raise_error
216
- end
217
-
218
- it 'should parse exact version requirement' do
219
- write 'build.yaml', 'gems: foo 2.5'
220
- Gem::SourceInfoCache.should_receive(:search).with(Gem::Dependency.new('foo', '=2.5')).and_return([])
221
- lambda { Buildr.application.load_gems }.should raise_error
222
- end
223
-
224
- it 'should parse range version requirement' do
225
- write 'build.yaml', 'gems: foo ~>2.3'
226
- Gem::SourceInfoCache.should_receive(:search).with(Gem::Dependency.new('foo', '~>2.3')).and_return([])
227
- lambda { Buildr.application.load_gems }.should raise_error
228
- end
229
-
230
- it 'should parse multiple version requirements' do
231
- write 'build.yaml', 'gems: foo >=2.0 !=2.1'
232
- Gem::SourceInfoCache.should_receive(:search).with(Gem::Dependency.new('foo', ['>=2.0', '!=2.1'])).and_return([])
233
- lambda { Buildr.application.load_gems }.should raise_error
234
- end
235
- end
236
-
237
- end
238
-
239
-
240
- describe Buildr, 'settings' do
241
-
242
- describe 'user' do
243
-
244
- it 'should be empty hash if no settings.yaml file' do
245
- Buildr.settings.user.should == {}
246
- end
247
-
248
- it 'should return loaded settings.yaml file' do
249
- write 'home/.buildr/settings.yaml', 'foo: bar'
250
- Buildr.settings.user.should == { 'foo'=>'bar' }
251
- end
252
-
253
- it 'should return loaded settings.yml file' do
254
- write 'home/.buildr/settings.yml', 'foo: bar'
255
- Buildr.settings.user.should == { 'foo'=>'bar' }
256
- end
257
-
258
- it 'should fail if settings.yaml file is not a hash' do
259
- write 'home/.buildr/settings.yaml', 'foo bar'
260
- lambda { Buildr.settings.user }.should raise_error(RuntimeError, /expecting.*settings.yaml/i)
261
- end
262
-
263
- it 'should be empty hash if settings.yaml file is empty' do
264
- write 'home/.buildr/settings.yaml'
265
- Buildr.settings.user.should == {}
266
- end
267
- end
268
-
269
- describe 'configuration' do
270
- it 'should be empty hash if no build.yaml file' do
271
- Buildr.settings.build.should == {}
272
- end
273
-
274
- it 'should return loaded build.yaml file' do
275
- write 'build.yaml', 'foo: bar'
276
- Buildr.settings.build.should == { 'foo'=>'bar' }
277
- end
278
-
279
- it 'should return loaded build.yml file' do
280
- write 'build.yml', 'foo: bar'
281
- Buildr.settings.build.should == { 'foo'=>'bar' }
282
- end
283
-
284
- it 'should fail if build.yaml file is not a hash' do
285
- write 'build.yaml', 'foo bar'
286
- lambda { Buildr.settings.build }.should raise_error(RuntimeError, /expecting.*build.yaml/i)
287
- end
288
-
289
- it 'should be empty hash if build.yaml file is empty' do
290
- write 'build.yaml'
291
- Buildr.settings.build.should == {}
292
- end
293
- end
294
-
295
- describe 'profiles' do
296
- it 'should be empty hash if no profiles.yaml file' do
297
- Buildr.settings.profiles.should == {}
298
- end
299
-
300
- it 'should return loaded profiles.yaml file' do
301
- write 'profiles.yaml', <<-YAML
302
- development:
303
- foo: bar
304
- YAML
305
- Buildr.settings.profiles.should == { 'development'=> { 'foo'=>'bar' } }
306
- end
307
-
308
- it 'should return loaded profiles.yml file' do
309
- write 'profiles.yml', <<-YAML
310
- development:
311
- foo: bar
312
- YAML
313
- Buildr.settings.profiles.should == { 'development'=> { 'foo'=>'bar' } }
314
- end
315
-
316
- it 'should fail if profiles.yaml file is not a hash' do
317
- write 'profiles.yaml', 'foo bar'
318
- lambda { Buildr.settings.profiles }.should raise_error(RuntimeError, /expecting.*profiles.yaml/i)
319
- end
320
-
321
- it 'should be empty hash if profiles.yaml file is empty' do
322
- write 'profiles.yaml'
323
- Buildr.settings.profiles.should == {}
324
- end
325
- end
326
-
327
- describe 'profile' do
328
- before do
329
- end
330
-
331
- it 'should be empty hash if no profiles.yaml' do
332
- Buildr.settings.profile.should == {}
333
- end
334
-
335
- it 'should be empty hash if no matching profile' do
336
- write 'profiles.yaml', <<-YAML
337
- test:
338
- foo: bar
339
- YAML
340
- Buildr.settings.profile.should == {}
341
- end
342
-
343
- it 'should return profile matching environment name' do
344
- write 'profiles.yaml', <<-YAML
345
- development:
346
- foo: bar
347
- test:
348
- foo: baz
349
- YAML
350
- Buildr.settings.profile.should == { 'foo'=>'bar' }
351
- end
352
- end
353
-
354
- describe 'buildfile task' do
355
- before do
356
- @buildfile_time = Time.now - 10
357
- write 'buildfile'; File.utime(@buildfile_time, @buildfile_time, 'buildfile')
358
- end
359
-
360
- it 'should point to the buildfile' do
361
- Buildr.application.buildfile.should point_to_path('buildfile')
362
- end
363
-
364
- it 'should be a defined task' do
365
- Buildr.application.buildfile.should == file(File.expand_path('buildfile'))
366
- end
367
-
368
- it 'should ignore any rake namespace' do
369
- namespace 'dummy_ns' do
370
- Buildr.application.buildfile.should point_to_path('buildfile')
371
- end
372
- end
373
-
374
- it 'should have the same timestamp as the buildfile' do
375
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
376
- end
377
-
378
- it 'should have the same timestamp as build.yaml if the latter is newer' do
379
- write 'build.yaml'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'build.yaml')
380
- Buildr.application.run
381
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
382
- end
383
-
384
- it 'should have the same timestamp as the buildfile if build.yaml is older' do
385
- write 'build.yaml'; File.utime(@buildfile_time - 5, @buildfile_time - 5, 'build.yaml')
386
- Buildr.application.run
387
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
388
- end
389
-
390
- it 'should have the same timestamp as build.rb in home dir if the latter is newer' do
391
- write 'home/buildr.rb'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'home/buildr.rb')
392
- Buildr.application.send :load_tasks
393
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
394
- end
395
- end
396
- end
397
-
398
-
399
- describe Buildr do
400
-
401
- describe 'environment' do
402
- it 'should be same as Buildr.application.environment' do
403
- Buildr.environment.should eql(Buildr.application.environment)
404
- end
405
- end
406
-
407
- describe 'application' do
408
- it 'should be same as Rake.application' do
409
- Buildr.application.should == Rake.application
410
- end
411
- end
412
-
413
- describe 'settings' do
414
- it 'should be same as Buildr.application.settings' do
415
- Buildr.settings.should == Buildr.application.settings
416
- end
417
- end
418
- end
419
-
@@ -1,423 +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 'local task', :shared=>true do
21
- it "should execute task for project in current directory" do
22
- define 'foobar'
23
- lambda { @task.invoke }.should run_task("foobar:#{@task.name}")
24
- end
25
-
26
- it "should not execute task for projects in other directory" do
27
- define 'foobar', :base_dir=>'elsewhere'
28
- lambda { task('build').invoke }.should_not run_task('foobar:build')
29
- end
30
- end
31
-
32
-
33
- describe 'build task' do
34
- it_should_behave_like 'local task'
35
- before(:each) { @task = task('build') }
36
- end
37
-
38
- describe 'clean task' do
39
- it_should_behave_like 'local task'
40
- before(:each) { @task = task('clean') }
41
- end
42
-
43
- describe 'package task' do
44
- it_should_behave_like 'local task'
45
- before(:each) { @task = task('package') }
46
-
47
- it 'should execute build task as prerequisite' do
48
- lambda { @task.invoke }.should run_task('build')
49
- end
50
- end
51
-
52
- describe 'install task' do
53
- it_should_behave_like 'local task'
54
- before(:each) { @task = task('install') }
55
-
56
- it 'should execute package task as prerequisite' do
57
- lambda { @task.invoke }.should run_task('package')
58
- end
59
- end
60
-
61
- describe 'uninstall task' do
62
- it_should_behave_like 'local task'
63
- before(:each) { @task = task('uninstall') }
64
- end
65
-
66
- describe 'upload task' do
67
- it_should_behave_like 'local task'
68
- before(:each) { @task = task('upload') }
69
-
70
- it 'should execute package task as prerequisite' do
71
- lambda { @task.invoke }.should run_task('package')
72
- end
73
- end
74
-
75
-
76
- describe Project, '#build' do
77
- it 'should return the project\'s build task' do
78
- define('foo').build.should eql(task('foo:build'))
79
- end
80
-
81
- it 'should enhance the project\'s build task' do
82
- task 'prereq'
83
- task 'action'
84
- define 'foo' do
85
- build 'prereq' do
86
- task('action').invoke
87
- end
88
- end
89
- lambda { project('foo').build.invoke }.should run_tasks('prereq', 'action')
90
- end
91
-
92
- it 'should execute build task for sub-project' do
93
- define 'foo' do
94
- define 'bar'
95
- end
96
- lambda { task('foo:build').invoke }.should run_task('foo:bar:build')
97
- end
98
-
99
- it 'should not execute build task of other projects' do
100
- define 'foo'
101
- define 'bar'
102
- lambda { task('foo:build').invoke }.should_not run_task('bar:build')
103
- end
104
- end
105
-
106
-
107
- describe Project, '#clean' do
108
- it 'should return the project\'s clean task' do
109
- define('foo').clean.should eql(task('foo:clean'))
110
- end
111
-
112
- it 'should enhance the project\'s clean task' do
113
- task 'prereq'
114
- task 'action'
115
- define 'foo' do
116
- clean 'prereq' do
117
- task('action').invoke
118
- end
119
- end
120
- lambda { project('foo').clean.invoke }.should run_tasks('prereq', 'action')
121
- end
122
-
123
- it 'should remove target directory' do
124
- define 'foo' do
125
- self.layout[:target] = 'targeted'
126
- end
127
- mkpath 'targeted'
128
- lambda { project('foo').clean.invoke }.should change { File.exist?('targeted') }.from(true).to(false)
129
- end
130
-
131
- it 'should remove reports directory' do
132
- define 'foo' do
133
- self.layout[:reports] = 'reported'
134
- end
135
- mkpath 'reported'
136
- lambda { project('foo').clean.invoke }.should change { File.exist?('reported') }.from(true).to(false)
137
- end
138
-
139
- it 'should execute clean task for sub-project' do
140
- define 'foo' do
141
- define 'bar'
142
- end
143
- lambda { task('foo:clean').invoke }.should run_task('foo:bar:clean')
144
- end
145
-
146
- it 'should not execute clean task of other projects' do
147
- define 'foo'
148
- define 'bar'
149
- lambda { task('foo:clean').invoke }.should_not run_task('bar:clean')
150
- end
151
- end
152
-
153
-
154
- describe Project, '#target' do
155
- before :each do
156
- @project = define('foo', :layout=>Layout.new)
157
- end
158
-
159
- it 'should default to target' do
160
- @project.target.should eql('target')
161
- end
162
-
163
- it 'should set layout :target' do
164
- @project.target = 'bar'
165
- @project.layout.expand(:target).should point_to_path('bar')
166
- end
167
-
168
- it 'should come from layout :target' do
169
- @project.layout[:target] = 'baz'
170
- @project.target.should eql('baz')
171
- end
172
-
173
- it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
174
- Buildr::VERSION.should < '1.5'
175
- end
176
- end
177
-
178
-
179
- describe Project, '#reports' do
180
- before :each do
181
- @project = define('foo', :layout=>Layout.new)
182
- end
183
-
184
- it 'should default to reports' do
185
- @project.reports.should eql('reports')
186
- end
187
-
188
- it 'should set layout :reports' do
189
- @project.reports = 'bar'
190
- @project.layout.expand(:reports).should point_to_path('bar')
191
- end
192
-
193
- it 'should come from layout :reports' do
194
- @project.layout[:reports] = 'baz'
195
- @project.reports.should eql('baz')
196
- end
197
-
198
- it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
199
- Buildr::VERSION.should < '1.5'
200
- end
201
- end
202
-
203
-
204
- describe Buildr::Release do
205
-
206
- describe '#make' do
207
- before do
208
- write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
209
- # Prevent a real call to a spawned buildr process.
210
- Release.stub!(:buildr)
211
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
212
- Svn.stub!(:uncommitted_files).and_return('')
213
- Svn.stub!(:remove)
214
- Svn.stub!(:copy)
215
- Svn.stub!(:commit)
216
- end
217
-
218
- it 'should tag a release with the release version' do
219
- Svn.should_receive(:copy).with(Dir.pwd, 'http://my.repo.org/foo/tags/1.0.0', 'Release 1.0.0').and_return {
220
- file('buildfile').should contain('VERSION_NUMBER = "1.0.0"')
221
- }
222
- Release.make
223
- end
224
-
225
- it 'should update the buildfile with the next version number' do
226
- Release.make
227
- file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
228
- end
229
-
230
- it 'should commit the updated buildfile' do
231
- Svn.should_receive(:commit).with(File.expand_path('buildfile'), 'Changed version number to 1.0.1-SNAPSHOT').and_return {
232
- file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
233
- }
234
- Release.make
235
- end
236
- end
237
-
238
-
239
- describe '#check' do
240
- before do
241
- Svn.stub!(:uncommitted_files).and_return('')
242
- end
243
-
244
- it 'should accept to release from the trunk' do
245
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
246
- lambda { Release.check }.should_not raise_error
247
- end
248
-
249
- it 'should accept to release from a branch' do
250
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/branches/1.0')
251
- lambda { Release.check }.should_not raise_error
252
- end
253
-
254
- it 'should reject releasing from a tag' do
255
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/tags/1.0.0')
256
- lambda { Release.check }.should raise_error(RuntimeError, "SVN URL must contain 'trunk' or 'branches/...'")
257
- end
258
-
259
- it 'should reject a non standard repository layout' do
260
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/bar')
261
- lambda { Release.check }.should raise_error(RuntimeError, "SVN URL must contain 'trunk' or 'branches/...'")
262
- end
263
-
264
- it 'should reject an uncommitted file' do
265
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
266
- Svn.stub!(:uncommitted_files).and_return('M foo.rb')
267
- lambda { Release.check }.should raise_error(RuntimeError,
268
- "Uncommitted SVN files violate the First Principle Of Release!\n" +
269
- "M foo.rb")
270
- end
271
- end
272
-
273
-
274
- describe '#extract_version' do
275
- it 'should extract VERSION_NUMBER with single quotes' do
276
- write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
277
- Release.extract_version.should == '1.0.0-SNAPSHOT'
278
- end
279
-
280
- it 'should extract VERSION_NUMBER with double quotes' do
281
- write 'buildfile', %{VERSION_NUMBER = "1.0.1-SNAPSHOT"}
282
- Release.extract_version.should == '1.0.1-SNAPSHOT'
283
- end
284
-
285
- it 'should extract VERSION_NUMBER without any spaces' do
286
- write 'buildfile', "VERSION_NUMBER='1.0.2-SNAPSHOT'"
287
- Release.extract_version.should == '1.0.2-SNAPSHOT'
288
- end
289
-
290
- it 'should extract THIS_VERSION as an alternative to VERSION_NUMBER' do
291
- write 'buildfile', "THIS_VERSION = '1.0.3-SNAPSHOT'"
292
- Release.extract_version.should == '1.0.3-SNAPSHOT'
293
- end
294
-
295
- it 'should complain if no current version number' do
296
- write 'buildfile', 'define foo'
297
- lambda { Release.extract_version }.should raise_error('Looking for THIS_VERSION = "..." in your Buildfile, none found')
298
- end
299
- end
300
-
301
-
302
- # Reference: http://svnbook.red-bean.com/en/1.4/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout
303
- describe '#tag url' do
304
- it 'should accept to tag foo/trunk' do
305
- Release.tag_url('http://my.repo.org/foo/trunk', '1.0.0').should == 'http://my.repo.org/foo/tags/1.0.0'
306
- end
307
-
308
- it 'should accept to tag foo/branches/1.0' do
309
- Release.tag_url('http://my.repo.org/foo/branches/1.0', '1.0.1').should == 'http://my.repo.org/foo/tags/1.0.1'
310
- end
311
-
312
- it 'should accept to tag trunk/foo' do
313
- Release.tag_url('http://my.repo.org/trunk/foo', '1.0.0').should == 'http://my.repo.org/tags/foo/1.0.0'
314
- end
315
-
316
- it 'should accept to tag branches/foo/1.0' do
317
- Release.tag_url('http://my.repo.org/branches/foo/1.0', '1.0.0').should == 'http://my.repo.org/tags/foo/1.0.0'
318
- end
319
-
320
- it 'should use tag specified by tag_name' do
321
- Release.tag_name = 'first'
322
- Release.tag_url('http://my.repo.org/foo/trunk', '1.0.0').should == 'http://my.repo.org/foo/tags/first'
323
- end
324
-
325
- it 'should use tag returned by tag_name if tag_name is a proc' do
326
- Release.tag_name = lambda { |version| "buildr-#{version}" }
327
- Release.tag_url('http://my.repo.org/foo/trunk', '1.0.0').should == 'http://my.repo.org/foo/tags/buildr-1.0.0'
328
- end
329
-
330
- after { Release.tag_name = nil }
331
- end
332
-
333
-
334
- describe '#with_release_candidate_version' do
335
- before do
336
- Buildr.application.stub!(:buildfile).and_return(file('buildfile'))
337
- write 'buildfile', "THIS_VERSION = '1.1.0-SNAPSHOT'"
338
- end
339
-
340
- it 'should yield the name of the release candidate buildfile' do
341
- Release.send :with_release_candidate_version do |new_filename|
342
- File.read(new_filename).should == %{THIS_VERSION = "1.1.0"}
343
- end
344
- end
345
-
346
- it 'should yield a name different from the original buildfile' do
347
- Release.send :with_release_candidate_version do |new_filename|
348
- new_filename.should_not point_to_path('buildfile')
349
- end
350
- end
351
- end
352
-
353
-
354
- describe '#tag_release' do
355
- before do
356
- write 'buildfile', "THIS_VERSION = '1.0.1'"
357
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
358
- Svn.stub!(:copy)
359
- Svn.stub!(:remove)
360
- end
361
-
362
- it 'should tag the working copy' do
363
- Svn.should_receive(:copy).with(Dir.pwd, 'http://my.repo.org/foo/tags/1.0.1', 'Release 1.0.1')
364
- Release.send :tag_release
365
- end
366
-
367
- it 'should remove the tag if it already exists' do
368
- Svn.should_receive(:remove).with('http://my.repo.org/foo/tags/1.0.1', 'Removing old copy')
369
- Release.send :tag_release
370
- end
371
-
372
- it 'should accept that the tag does not exist' do
373
- Svn.stub!(:remove).and_raise(RuntimeError)
374
- Release.send :tag_release
375
- end
376
-
377
- it 'should inform the user' do
378
- lambda { Release.send :tag_release }.should show_info('Tagging release 1.0.1')
379
- end
380
- end
381
-
382
-
383
- describe '#commit_new_snapshot' do
384
- before do
385
- write 'buildfile', 'THIS_VERSION = "1.0.0"'
386
- Svn.stub!(:commit)
387
- end
388
-
389
- it 'should update the buildfile with a new version number' do
390
- Release.send :commit_new_snapshot
391
- file('buildfile').should contain('THIS_VERSION = "1.0.1-SNAPSHOT"')
392
- end
393
-
394
- it 'should commit the new buildfile on the trunk' do
395
- Svn.should_receive(:commit).with(File.expand_path('buildfile'), 'Changed version number to 1.0.1-SNAPSHOT')
396
- Release.send :commit_new_snapshot
397
- end
398
-
399
- it 'should inform the user of the new version' do
400
- lambda { Release.send :commit_new_snapshot }.should show_info('Current version is now 1.0.1-SNAPSHOT')
401
- end
402
- end
403
-
404
- end
405
-
406
-
407
- describe Buildr::Svn, '#repo_url' do
408
- it 'should extract the SVN URL from svn info' do
409
- Svn.stub!(:svn, 'info').and_return(<<EOF)
410
- Path: .
411
- URL: http://my.repo.org/foo/trunk
412
- Repository Root: http://my.repo.org
413
- Repository UUID: 12345678-9abc-def0-1234-56789abcdef0
414
- Revision: 112
415
- Node Kind: directory
416
- Schedule: normal
417
- Last Changed Author: Lacton
418
- Last Changed Rev: 110
419
- Last Changed Date: 2008-08-19 12:00:00 +0200 (Tue, 19 Aug 2008)
420
- EOF
421
- Svn.repo_url.should == 'http://my.repo.org/foo/trunk'
422
- end
423
- end