vic-buildr 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +42 -11
- data/Rakefile +5 -3
- data/_buildr +9 -31
- data/addon/buildr/cobertura.rb +5 -218
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -220
- data/addon/buildr/nailgun.rb +94 -686
- data/bin/buildr +0 -9
- data/buildr.gemspec +6 -6
- data/doc/images/favicon.png +0 -0
- data/doc/pages/contributing.textile +6 -4
- data/doc/pages/download.textile +11 -0
- data/doc/pages/extending.textile +2 -2
- data/doc/pages/getting_started.textile +4 -4
- data/doc/pages/index.textile +8 -11
- data/doc/pages/more_stuff.textile +50 -22
- data/doc/pages/packaging.textile +1 -1
- data/doc/pages/projects.textile +2 -2
- data/doc/pages/settings_profiles.textile +2 -2
- data/doc/pages/testing.textile +1 -1
- data/doc/pages/whats_new.textile +12 -0
- data/doc/site.haml +1 -0
- data/lib/buildr.rb +2 -4
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +304 -149
- data/lib/buildr/core/checks.rb +3 -131
- data/lib/buildr/core/common.rb +0 -4
- data/lib/buildr/core/compile.rb +1 -7
- data/lib/buildr/core/environment.rb +0 -3
- data/lib/buildr/core/filter.rb +7 -3
- data/lib/buildr/core/generate.rb +50 -52
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +49 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -9
- data/lib/buildr/core/test.rb +4 -4
- data/lib/buildr/core/transports.rb +13 -30
- data/lib/buildr/core/util.rb +8 -3
- data/lib/buildr/groovy/bdd.rb +1 -0
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +30 -20
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +4 -2
- data/lib/buildr/java/ant.rb +1 -1
- data/lib/buildr/java/bdd.rb +9 -5
- data/lib/buildr/java/cobertura.rb +236 -0
- data/lib/buildr/java/commands.rb +2 -1
- data/lib/buildr/java/emma.rb +238 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +2 -0
- data/lib/buildr/java/packaging.rb +6 -2
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/test_result.rb +45 -15
- data/lib/buildr/java/tests.rb +14 -9
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +36 -7
- data/lib/buildr/packaging/artifact_namespace.rb +2 -2
- data/lib/buildr/packaging/gems.rb +3 -3
- data/lib/buildr/packaging/package.rb +1 -1
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala/compiler.rb +1 -1
- data/lib/buildr/scala/tests.rb +2 -2
- data/rakelib/apache.rake +58 -8
- data/rakelib/package.rake +4 -1
- data/rakelib/rspec.rake +2 -2
- data/rakelib/rubyforge.rake +6 -3
- data/rakelib/scm.rake +1 -1
- data/rakelib/setup.rake +0 -5
- data/rakelib/stage.rake +4 -1
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +29 -22
- data/spec/core/build_spec.rb +8 -0
- data/spec/core/checks_spec.rb +293 -311
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +24 -1
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +4 -4
- data/spec/{addon → java}/cobertura_spec.rb +3 -3
- data/spec/{addon → java}/emma_spec.rb +3 -3
- data/spec/java/java_spec.rb +9 -1
- data/spec/java/packaging_spec.rb +19 -2
- data/spec/{addon → java}/test_coverage_spec.rb +7 -1
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +1 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +2 -2
- data/spec/packaging/artifact_spec.rb +46 -5
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +16 -14
- data/spec/spec_helpers.rb +26 -3
- metadata +20 -11
- data/lib/buildr/core/application_cli.rb +0 -139
data/rakelib/rspec.rake
CHANGED
@@ -68,7 +68,7 @@ begin
|
|
68
68
|
end
|
69
69
|
|
70
70
|
task 'setup' do
|
71
|
-
install_gem 'win32console' if
|
71
|
+
install_gem 'win32console' if windows? && !RUBY_PLATFORM[/java/] # Colors for RSpec, only on Windows platform.
|
72
72
|
end
|
73
73
|
|
74
74
|
rescue LoadError
|
@@ -80,4 +80,4 @@ end
|
|
80
80
|
|
81
81
|
|
82
82
|
task 'stage:prepare'=>'spec'
|
83
|
-
task 'stage:prepare'=>RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby' # Test the *other* platform
|
83
|
+
task 'stage:prepare'=>RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby' # Test the *other* platform
|
data/rakelib/rubyforge.rake
CHANGED
@@ -40,12 +40,15 @@ namespace 'rubyforge' do
|
|
40
40
|
changes = FileList['published/CHANGES'].first
|
41
41
|
files = FileList['published/rubyforge/*.{gem,tgz,zip}'].exclude(changes).existing
|
42
42
|
print "Uploading #{spec.version} to RubyForge ... "
|
43
|
-
rubyforge = RubyForge.new
|
44
|
-
rubyforge.configure
|
43
|
+
rubyforge = RubyForge.new.configure
|
45
44
|
rubyforge.login
|
46
45
|
rubyforge.userconfig.merge!('release_changes'=>changes, 'preformatted' => true) if changes
|
47
46
|
rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
|
48
|
-
puts
|
47
|
+
puts "Done"
|
48
|
+
print "Posting news to RubyForge ... "
|
49
|
+
rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.versions} released",
|
50
|
+
"New in Buildr #{spec.version}:\n\n#{changes}"
|
51
|
+
puts "Done"
|
49
52
|
end
|
50
53
|
|
51
54
|
end
|
data/rakelib/scm.rake
CHANGED
data/rakelib/setup.rake
CHANGED
@@ -31,10 +31,6 @@ def set_java_home
|
|
31
31
|
fail "Please set JAVA_HOME first #{'(no need to run as sudo)' if ENV['USER'] == 'root'}" unless ENV['JAVA_HOME']
|
32
32
|
end
|
33
33
|
|
34
|
-
def set_gem_home
|
35
|
-
ENV['GEM_HOME'] ||= Gem.path.find { |f| File.writable?(f) }
|
36
|
-
end
|
37
|
-
|
38
34
|
def sudo_needed?
|
39
35
|
!( windows? || ENV['GEM_HOME'] )
|
40
36
|
end
|
@@ -78,7 +74,6 @@ desc "If you're building from sources, run this task first to setup the necessar
|
|
78
74
|
missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
|
79
75
|
task 'setup' do
|
80
76
|
set_java_home
|
81
|
-
set_gem_home
|
82
77
|
missing.each do |dep|
|
83
78
|
install_gem dep.name, dep.version_requirements
|
84
79
|
end
|
data/rakelib/stage.rake
CHANGED
@@ -39,7 +39,10 @@ namespace 'stage' do
|
|
39
39
|
sh 'rsync', '--progress', '--recursive', 'staged/', args.staging
|
40
40
|
puts 'Done'
|
41
41
|
end
|
42
|
+
|
43
|
+
# Put anything that happens post staging here, e.g. release vote email template.
|
44
|
+
task 'wrapup'
|
42
45
|
end
|
43
46
|
|
44
47
|
desc 'Stage files for the release, upload them to staging server'
|
45
|
-
task 'stage'=>['stage:check', 'stage:prepare', 'stage:upload']
|
48
|
+
task 'stage'=>['stage:check', 'stage:prepare', 'stage:upload', 'stage:wrapup']
|
@@ -0,0 +1,328 @@
|
|
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.expand_path('../spec_helpers', File.dirname(__FILE__))
|
18
|
+
require 'stringio'
|
19
|
+
Sandbox.require_optional_extension 'buildr/drb'
|
20
|
+
|
21
|
+
|
22
|
+
describe Buildr::DRbApplication do
|
23
|
+
|
24
|
+
module DRbHelper
|
25
|
+
attr_accessor :app, :drb, :cfg
|
26
|
+
|
27
|
+
def use_stdio(stdin = nil, stdout = nil, stderr = nil)
|
28
|
+
stdin ||= StringIO.new
|
29
|
+
stdout ||= StringIO.new
|
30
|
+
stderr ||= StringIO.new
|
31
|
+
cfg.update :in => stdin, :out => stdout, :err => stderr
|
32
|
+
end
|
33
|
+
|
34
|
+
def remote_run(*argv)
|
35
|
+
cfg.update :argv => argv
|
36
|
+
drb.remote_run(cfg)
|
37
|
+
end
|
38
|
+
|
39
|
+
def output
|
40
|
+
cfg[:out].string
|
41
|
+
end
|
42
|
+
|
43
|
+
def write_buildfile(content = nil)
|
44
|
+
write 'buildfile', content || %q{
|
45
|
+
define('foo') do
|
46
|
+
|
47
|
+
rule '.rbc' => '.rb' do |t|
|
48
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
49
|
+
end
|
50
|
+
|
51
|
+
task('hello') do
|
52
|
+
$stdout.puts 'hi'
|
53
|
+
end
|
54
|
+
|
55
|
+
task('empty')
|
56
|
+
|
57
|
+
task('no') do
|
58
|
+
task('empty').enhance ['delete_me']
|
59
|
+
task('empty') { $stdout.puts 'no' }
|
60
|
+
end
|
61
|
+
|
62
|
+
task('delete_me')
|
63
|
+
|
64
|
+
task('create') do
|
65
|
+
Rake::Task.define_task('created')
|
66
|
+
rule '.rbc' => '.rb' do |t|
|
67
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
task('exists') do
|
72
|
+
$stdout.puts !!Buildr.application.lookup('created')
|
73
|
+
end
|
74
|
+
|
75
|
+
task('setopt', :name, :value) do |task, args|
|
76
|
+
Buildr.application.options.send("#{args[:name]}=", args[:value])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
include DRbHelper
|
84
|
+
|
85
|
+
before(:each) do
|
86
|
+
@in, @out, @err = $stdin, $stdout, $stderr
|
87
|
+
@cfg = {
|
88
|
+
:dir => Dir.pwd, :argv => [],
|
89
|
+
:in => @in, :out => @out, :err => @err
|
90
|
+
}
|
91
|
+
@drb = Buildr::DRbApplication.clone
|
92
|
+
@drb.send :setup
|
93
|
+
@app = Buildr.application
|
94
|
+
end
|
95
|
+
|
96
|
+
after(:each) do
|
97
|
+
$stdin, $stdout, $stderr = @in, @out, @err
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '.run' do
|
101
|
+
it 'starts server if no server is running' do
|
102
|
+
drb.should_receive(:connect).and_raise DRb::DRbConnError
|
103
|
+
drb.should_receive(:run_server!)
|
104
|
+
drb.should_not_receive(:run_client)
|
105
|
+
drb.run
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'connects to an already started server' do
|
109
|
+
drb.should_receive(:connect).and_return "client"
|
110
|
+
drb.should_receive(:run_client).with "client"
|
111
|
+
drb.should_not_receive(:run_server!)
|
112
|
+
drb.run
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '.remote_run' do
|
117
|
+
|
118
|
+
describe 'stdout' do
|
119
|
+
it 'is redirected to client' do
|
120
|
+
use_stdio
|
121
|
+
Buildr.application.should_receive(:remote_run) do
|
122
|
+
$stdout.puts "HELLO"
|
123
|
+
end
|
124
|
+
remote_run
|
125
|
+
output.should eql("HELLO\n")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe 'stderr' do
|
130
|
+
it 'is redirected to client' do
|
131
|
+
use_stdio
|
132
|
+
Buildr.application.should_receive(:remote_run) do
|
133
|
+
$stderr.puts "HELLO"
|
134
|
+
end
|
135
|
+
remote_run
|
136
|
+
cfg[:err].string.should eql("HELLO\n")
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe 'stdin' do
|
141
|
+
it 'is redirected to client' do
|
142
|
+
use_stdio
|
143
|
+
cfg[:in].should_receive(:gets).and_return("HELLO\n")
|
144
|
+
result = nil
|
145
|
+
Buildr.application.should_receive(:remote_run) do
|
146
|
+
result = $stdin.gets
|
147
|
+
end
|
148
|
+
remote_run
|
149
|
+
result.should eql("HELLO\n")
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe 'server ARGV' do
|
154
|
+
it 'is replaced with client argv' do
|
155
|
+
Buildr.application.should_receive(:remote_run) do
|
156
|
+
ARGV.should eql(['hello'])
|
157
|
+
end
|
158
|
+
remote_run 'hello'
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe 'without buildfile loaded' do
|
163
|
+
before(:each) do
|
164
|
+
app.instance_eval { @rakefile = nil }
|
165
|
+
write_buildfile
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should load the buildfile' do
|
169
|
+
app.should_receive(:top_level)
|
170
|
+
lambda { remote_run }.should run_task('foo')
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe 'with unmodified buildfile' do
|
175
|
+
|
176
|
+
before(:each) do
|
177
|
+
write_buildfile
|
178
|
+
app.options.rakelib = []
|
179
|
+
app.send :load_buildfile
|
180
|
+
drb.save_snapshot(app)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'should not reload the buildfile' do
|
184
|
+
app.should_not_receive(:reload_buildfile)
|
185
|
+
app.should_receive(:top_level)
|
186
|
+
remote_run
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'should not define projects again' do
|
190
|
+
use_stdio
|
191
|
+
lambda { 2.times { remote_run 'foo:hello' } }.should_not run_task('foo')
|
192
|
+
output.should eql("hi\nhi\n")
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'should restore task actions' do
|
196
|
+
use_stdio
|
197
|
+
remote_run 'foo:empty'
|
198
|
+
output.should be_empty
|
199
|
+
2.times { remote_run 'foo:no' }
|
200
|
+
remote_run 'foo:empty'
|
201
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
202
|
+
actions.should be_empty # as originally defined
|
203
|
+
output.should be_empty
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'should restore task prerequisites' do
|
207
|
+
use_stdio
|
208
|
+
remote_run 'foo:empty'
|
209
|
+
output.should be_empty
|
210
|
+
2.times { remote_run 'foo:no' }
|
211
|
+
remote_run 'foo:empty'
|
212
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
213
|
+
pres.should be_empty # as originally defined
|
214
|
+
output.should be_empty
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'should drop runtime created tasks' do
|
218
|
+
remote_run 'foo:create'
|
219
|
+
app.lookup('created').should_not be_nil
|
220
|
+
remote_run 'foo:empty'
|
221
|
+
app.lookup('created').should be_nil
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'should restore options' do
|
225
|
+
remote_run 'foo:setopt[bar,baz]'
|
226
|
+
app.options.bar.should eql("baz")
|
227
|
+
remote_run 'foo:empty'
|
228
|
+
app.options.bar.should be_nil
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'should restore rules' do
|
232
|
+
orig = app.instance_eval { @rules.size }
|
233
|
+
remote_run 'foo:create'
|
234
|
+
app.instance_eval { @rules.size }.should eql(orig + 1)
|
235
|
+
remote_run 'foo:empty'
|
236
|
+
app.instance_eval { @rules.size }.should eql(orig)
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
describe 'with modified buildfile' do
|
242
|
+
|
243
|
+
before(:each) do
|
244
|
+
write_buildfile
|
245
|
+
app.options.rakelib = []
|
246
|
+
app.send :load_buildfile
|
247
|
+
drb.save_snapshot(app)
|
248
|
+
app.instance_eval { @last_loaded = Time.now - 10 }
|
249
|
+
write_buildfile %q{
|
250
|
+
rule '.rbc' => '.rb' do |t|
|
251
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
252
|
+
end
|
253
|
+
define('foo') do
|
254
|
+
task('hello') do
|
255
|
+
$stdout.puts 'bye'
|
256
|
+
end
|
257
|
+
task('empty')
|
258
|
+
define('bar') do
|
259
|
+
|
260
|
+
end
|
261
|
+
end
|
262
|
+
}
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'should reload the buildfile' do
|
266
|
+
app.should_receive(:reload_buildfile)
|
267
|
+
app.should_receive(:top_level)
|
268
|
+
remote_run
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'should redefine projects' do
|
272
|
+
lambda { remote_run }.should run_tasks('foo', 'foo:bar')
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'should remove tasks deleted from buildfile' do
|
276
|
+
app.lookup('foo:delete_me').should_not be_nil
|
277
|
+
remote_run
|
278
|
+
app.lookup('foo:delete_me').should be_nil
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'should redefine tasks actions' do
|
282
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
283
|
+
actions.should be_empty # no action
|
284
|
+
app.lookup('foo:no').invoke # enhance the empty task
|
285
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
286
|
+
actions.should_not be_empty
|
287
|
+
remote_run # cause to reload the buildfile
|
288
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
289
|
+
actions.should be_empty # as defined on the new buildfile
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'should redefine task prerequisites' do
|
293
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
294
|
+
pres.should be_empty # no action
|
295
|
+
app.lookup('foo:no').invoke # enhance the empty task
|
296
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
297
|
+
pres.should_not be_empty
|
298
|
+
remote_run # cause to reload the buildfile
|
299
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
300
|
+
pres.should be_empty # as defined on the new buildfile
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'should drop runtime created tasks' do
|
304
|
+
app.lookup('foo:create').invoke
|
305
|
+
app.lookup('created').should_not be_nil
|
306
|
+
remote_run 'foo:empty'
|
307
|
+
app.lookup('created').should be_nil
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'should restore options' do
|
311
|
+
app.options.bar = 'baz'
|
312
|
+
remote_run 'foo:empty'
|
313
|
+
app.options.bar.should be_nil
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should redefine rules' do
|
317
|
+
orig = app.instance_eval { @rules.size }
|
318
|
+
app.lookup('foo:create').invoke
|
319
|
+
app.instance_eval { @rules.size }.should eql(orig + 1)
|
320
|
+
remote_run 'foo:empty'
|
321
|
+
app.instance_eval { @rules.size }.should eql(orig)
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|
325
|
+
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
@@ -31,44 +31,58 @@ describe Buildr::Application do
|
|
31
31
|
|
32
32
|
describe '#run' do
|
33
33
|
it 'should execute *_load methods in order' do
|
34
|
-
|
35
|
-
order = [:find_buildfile, :load_gems, :load_artifacts, :load_tasks,
|
36
|
-
:load_requires, :load_buildfile, :load_imports, :top_level]
|
34
|
+
order = [:load_gems, :load_artifact_ns, :load_tasks, :raw_load_buildfile]
|
37
35
|
order.each { |method| Buildr.application.should_receive(method).ordered }
|
38
36
|
Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
|
39
37
|
Buildr.application.run
|
40
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
|
41
57
|
end
|
42
58
|
|
43
59
|
describe 'environment' do
|
44
60
|
it 'should return value of BUILDR_ENV' do
|
45
61
|
ENV['BUILDR_ENV'] = 'qa'
|
46
|
-
Buildr
|
62
|
+
Buildr.application.environment.should eql('qa')
|
47
63
|
end
|
48
64
|
|
49
65
|
it 'should default to development' do
|
50
|
-
Buildr
|
66
|
+
Buildr.application.environment.should eql('development')
|
51
67
|
end
|
52
68
|
|
53
69
|
it 'should set environment name from -e argument' do
|
54
70
|
ARGV.push('-e', 'test')
|
55
|
-
Buildr
|
71
|
+
Buildr.application.send(:handle_options)
|
72
|
+
Buildr.application.environment.should eql('test')
|
56
73
|
ENV['BUILDR_ENV'].should eql('test')
|
57
74
|
end
|
58
75
|
|
59
76
|
it 'should be echoed to user' do
|
60
77
|
write 'buildfile'
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
after do
|
65
|
-
ENV['BUILDR_ENV'] = nil
|
78
|
+
ENV['BUILDR_ENV'] = 'spec'
|
79
|
+
Buildr.application.send(:handle_options)
|
80
|
+
lambda { Buildr.application.send :load_buildfile }.should show(%r{(in .*, spec)})
|
66
81
|
end
|
67
82
|
end
|
68
83
|
|
69
84
|
describe 'gems' do
|
70
85
|
before do
|
71
|
-
Buildr.application.private_methods(true).should include('load_gems')
|
72
86
|
class << Buildr.application
|
73
87
|
public :load_gems
|
74
88
|
end
|
@@ -112,7 +126,6 @@ describe Buildr::Application do
|
|
112
126
|
|
113
127
|
describe 'load_gems' do
|
114
128
|
before do
|
115
|
-
Buildr.application.private_methods(true).should include('load_gems')
|
116
129
|
class << Buildr.application
|
117
130
|
public :load_gems
|
118
131
|
end
|
@@ -312,6 +325,9 @@ describe Buildr, 'settings' do
|
|
312
325
|
end
|
313
326
|
|
314
327
|
describe 'profile' do
|
328
|
+
before do
|
329
|
+
end
|
330
|
+
|
315
331
|
it 'should be empty hash if no profiles.yaml' do
|
316
332
|
Buildr.settings.profile.should == {}
|
317
333
|
end
|
@@ -376,15 +392,6 @@ describe Buildr, 'settings' do
|
|
376
392
|
Buildr.application.send :load_tasks
|
377
393
|
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
|
378
394
|
end
|
379
|
-
|
380
|
-
it 'should include explicitly required files as dependencies' do
|
381
|
-
write 'some/file.rb'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'some/file.rb')
|
382
|
-
Buildr.application.instance_variable_set(:@requires, ['rbconfig', 'some/file.rb'])
|
383
|
-
Buildr.application.send :load_buildfile
|
384
|
-
Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
|
385
|
-
Buildr.application.buildfile.prerequisites.should include(File.expand_path('some/file.rb'))
|
386
|
-
Buildr.application.buildfile.prerequisites.should_not include('rbconfig')
|
387
|
-
end
|
388
395
|
end
|
389
396
|
end
|
390
397
|
|