ittayd-buildr 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +915 -0
- data/DISCLAIMER +7 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +146 -0
- data/Rakefile +64 -0
- data/_buildr +28 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +221 -0
- data/addon/buildr/openjpa.rb +90 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/path.rb +136 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +58 -0
- data/doc/css/default.css +228 -0
- data/doc/css/print.css +100 -0
- data/doc/css/syntax.css +52 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +207 -0
- data/doc/pages/building.textile +240 -0
- data/doc/pages/contributing.textile +208 -0
- data/doc/pages/download.textile +62 -0
- data/doc/pages/extending.textile +175 -0
- data/doc/pages/getting_started.textile +273 -0
- data/doc/pages/index.textile +42 -0
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +314 -0
- data/doc/pages/packaging.textile +427 -0
- data/doc/pages/projects.textile +274 -0
- data/doc/pages/recipes.textile +103 -0
- data/doc/pages/settings_profiles.textile +274 -0
- data/doc/pages/testing.textile +212 -0
- data/doc/pages/troubleshooting.textile +103 -0
- data/doc/pages/whats_new.textile +323 -0
- data/doc/print.haml +51 -0
- data/doc/print.toc.yaml +29 -0
- data/doc/scripts/buildr-git.rb +412 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +56 -0
- data/doc/site.toc.yaml +47 -0
- data/etc/KEYS +151 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr/core/application.rb +665 -0
- data/lib/buildr/core/build.rb +311 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +590 -0
- data/lib/buildr/core/environment.rb +117 -0
- data/lib/buildr/core/filter.rb +366 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +49 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +923 -0
- data/lib/buildr/core/test.rb +715 -0
- data/lib/buildr/core/transports.rb +560 -0
- data/lib/buildr/core/util.rb +294 -0
- data/lib/buildr/core.rb +29 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/ide/eclipse.rb +222 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +190 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +212 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/java/ant.rb +92 -0
- data/lib/buildr/java/bdd.rb +451 -0
- data/lib/buildr/java/cobertura.rb +236 -0
- data/lib/buildr/java/commands.rb +211 -0
- data/lib/buildr/java/compiler.rb +348 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +238 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
- data/lib/buildr/java/packaging.rb +717 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +307 -0
- data/lib/buildr/java/tests.rb +329 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +759 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +64 -0
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr.rb +33 -0
- data/rakelib/apache.rake +191 -0
- data/rakelib/changelog.rake +57 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +76 -0
- data/rakelib/release.rake +65 -0
- data/rakelib/rspec.rake +83 -0
- data/rakelib/rubyforge.rake +56 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +81 -0
- data/rakelib/stage.rake +48 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +419 -0
- data/spec/core/build_spec.rb +423 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +582 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +776 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +500 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +239 -0
- data/spec/ide/eclipse_spec.rb +311 -0
- data/spec/java/ant.rb +33 -0
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/java/cobertura_spec.rb +77 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +120 -0
- data/spec/java/java_spec.rb +96 -0
- data/spec/java/packaging_spec.rb +1120 -0
- data/spec/java/test_coverage_spec.rb +255 -0
- data/spec/java/tests_spec.rb +471 -0
- data/spec/packaging/archive_spec.rb +503 -0
- data/spec/packaging/artifact_namespace_spec.rb +646 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +589 -0
- data/spec/sandbox.rb +139 -0
- data/spec/scala/compiler_spec.rb +228 -0
- data/spec/scala/tests_spec.rb +215 -0
- data/spec/spec_helpers.rb +327 -0
- data/spec/version_requirement_spec.rb +123 -0
- metadata +377 -0
@@ -0,0 +1,419 @@
|
|
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
|
+
|