buildr-as3 0.2.19 → 0.2.20.pre

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.
@@ -0,0 +1,160 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
+
3
+ describe Buildr::AS3::Compiler::Compc do
4
+
5
+ it 'should not identify itself from source directories' do
6
+ write 'src/main/java/com/example/Test.as', 'package com.example{ class Test {} }'
7
+ define('foo').compile.compiler.should_not eql(:compc)
8
+ end
9
+
10
+ it 'should report the language as :actionscript' do
11
+ define('foo').compile.using(:compc).language.should eql(:actionscript)
12
+ end
13
+
14
+ it 'should set the target directory to target/bin' do
15
+ define 'foo' do
16
+ lambda { compile.using(:compc) }.should change { compile.target.to_s }.to(File.expand_path('target/bin'))
17
+ end
18
+ end
19
+
20
+ it 'should not override existing target directory' do
21
+ define 'foo' do
22
+ compile.into('classes')
23
+ lambda { compile.using(:compc) }.should_not change { compile.target }
24
+ end
25
+ end
26
+
27
+ it 'should not change existing list of sources' do
28
+ define 'foo' do
29
+ compile.from('sources')
30
+ lambda { compile.using(:compc) }.should_not change { compile.sources }
31
+ end
32
+ end
33
+
34
+ after do
35
+ Buildr.options.debug = nil
36
+ ENV.delete "debug"
37
+ ENV.delete "DEBUG"
38
+ end
39
+ end
40
+
41
+
42
+
43
+ describe "Buildr::AS3::Compiler::Compc compiler options" do
44
+
45
+ def compile_task
46
+ @compile_task ||= define('foo').compile.using( :compc, :flexsdk => FlexSDK.new("4.5.0.20967") )
47
+ end
48
+
49
+ def flex_sdk
50
+ compile_task.options.flexsdk
51
+ end
52
+
53
+ def output
54
+ compile_task.options.output
55
+ end
56
+
57
+ def target
58
+ compile_task.target
59
+ end
60
+
61
+ def dependencies
62
+ compile_task.as3_dependencies
63
+ end
64
+
65
+ def sources
66
+ compile_task.sources
67
+ end
68
+
69
+ def compc_args
70
+ compiler.send(:compiler_args,dependencies,flex_sdk,output,sources)
71
+ end
72
+
73
+ def compiler
74
+ compile_task.instance_eval { @compiler }
75
+ end
76
+
77
+ it 'should set warnings option to true by default' do
78
+ compile_task.options.warnings.should be_true
79
+ end
80
+
81
+ it 'should set debug option to true by default' do
82
+ compile_task.options.debug.should be_true
83
+ end
84
+
85
+ it 'should set debug option to false based on Buildr.options' do
86
+ Buildr.options.debug = false
87
+ compile_task.options.debug.should be_false
88
+ end
89
+
90
+ it 'should set debug option to false based on debug environment variable' do
91
+ ENV['debug'] = 'no'
92
+ compile_task.options.debug.should be_false
93
+ end
94
+
95
+ it 'should set debug option to false based on DEBUG environment variable' do
96
+ ENV['DEBUG'] = 'no'
97
+ compile_task.options.debug.should be_false
98
+ end
99
+
100
+ it 'should use -debug=true argument when debug option is true' do
101
+ compile_task.using(:debug=>true)
102
+ compc_args.should include('-debug=true')
103
+ end
104
+
105
+ it 'should not use -debug=true argument when debug option is false' do
106
+ compile_task.using(:debug=>false)
107
+ compc_args.should_not include('-debug=true')
108
+ end
109
+
110
+ it 'should define CONFIG::debug,true when debug option is true' do
111
+ compile_task.using(:debug=>true)
112
+ compc_args.should include('-define+=CONFIG::debug,true')
113
+ end
114
+
115
+ it 'should define CONFIG::debug,false when debug option is false' do
116
+ compile_task.using(:debug=>false)
117
+ compc_args.should include('-define+=CONFIG::debug,false')
118
+ end
119
+
120
+ it 'should use -warnings=true argument when warnings option is true' do
121
+ compile_task.using(:warnings=>true)
122
+ compc_args.should_not include('-warnings=false')
123
+ end
124
+
125
+ it 'should not use -warnings=true argument when warnings option is false' do
126
+ compile_task.using(:warnings=>false)
127
+ compc_args.should include('-warnings=false')
128
+ end
129
+
130
+ it 'should point to the correct compiler jar' do
131
+ compiler.instance_eval{ compiler_jar }.should eql( flex_sdk.compc_jar )
132
+ end
133
+
134
+ it 'should not identify itself as an air compiler' do
135
+ compiler.instance_eval{ air }.should_not eql( true )
136
+ end
137
+
138
+ it "should not use +configname=air ever" do
139
+ compc_args.should_not include('+configname=air')
140
+ end
141
+
142
+ it "should not use air config file ever" do
143
+ compc_args.should_not include(flex_sdk.air_config)
144
+ end
145
+
146
+ it "should use flex config file by default" do
147
+ compc_args.should include(flex_sdk.flex_config)
148
+ end
149
+
150
+ it "should not identify itself as a test task when it's not" do
151
+ compiler.send(:is_test,sources,target,dependencies).should eql(false)
152
+ end
153
+
154
+ after do
155
+ Buildr.options.debug = nil
156
+ ENV.delete "debug"
157
+ ENV.delete "DEBUG"
158
+ end
159
+
160
+ end
@@ -0,0 +1,160 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
+
3
+ describe Buildr::AS3::Compiler::Mxmlc do
4
+
5
+ it 'should not identify itself from source directories' do
6
+ write 'src/main/java/com/example/Test.as', 'package com.example{ class Test {} }'
7
+ define('foo').compile.compiler.should_not eql(:mxmlc)
8
+ end
9
+
10
+ it 'should report the language as :actionscript' do
11
+ define('foo').compile.using(:mxmlc).language.should eql(:actionscript)
12
+ end
13
+
14
+ it 'should set the target directory to target/bin' do
15
+ define 'foo' do
16
+ lambda { compile.using(:mxmlc) }.should change { compile.target.to_s }.to(File.expand_path('target/bin'))
17
+ end
18
+ end
19
+
20
+ it 'should not override existing target directory' do
21
+ define 'foo' do
22
+ compile.into('classes')
23
+ lambda { compile.using(:mxmlc) }.should_not change { compile.target }
24
+ end
25
+ end
26
+
27
+ it 'should not change existing list of sources' do
28
+ define 'foo' do
29
+ compile.from('sources')
30
+ lambda { compile.using(:mxmlc) }.should_not change { compile.sources }
31
+ end
32
+ end
33
+
34
+ after do
35
+ Buildr.options.debug = nil
36
+ ENV.delete "debug"
37
+ ENV.delete "DEBUG"
38
+ end
39
+ end
40
+
41
+
42
+
43
+ describe "Buildr::AS3::Compiler::Mxmlc compiler options" do
44
+
45
+ def compile_task
46
+ @compile_task ||= define('foo').compile.using( :mxmlc, :flexsdk => FlexSDK.new("4.5.0.20967") )
47
+ end
48
+
49
+ def flex_sdk
50
+ compile_task.options.flexsdk
51
+ end
52
+
53
+ def output
54
+ compile_task.options.output
55
+ end
56
+
57
+ def target
58
+ compile_task.target
59
+ end
60
+
61
+ def dependencies
62
+ compile_task.as3_dependencies
63
+ end
64
+
65
+ def sources
66
+ compile_task.sources
67
+ end
68
+
69
+ def mxmlc_args
70
+ compiler.send(:compiler_args,dependencies,flex_sdk,output,sources)
71
+ end
72
+
73
+ def compiler
74
+ compile_task.instance_eval { @compiler }
75
+ end
76
+
77
+ it 'should set warnings option to true by default' do
78
+ compile_task.options.warnings.should be_true
79
+ end
80
+
81
+ it 'should set debug option to true by default' do
82
+ compile_task.options.debug.should be_true
83
+ end
84
+
85
+ it 'should set debug option to false based on Buildr.options' do
86
+ Buildr.options.debug = false
87
+ compile_task.options.debug.should be_false
88
+ end
89
+
90
+ it 'should set debug option to false based on debug environment variable' do
91
+ ENV['debug'] = 'no'
92
+ compile_task.options.debug.should be_false
93
+ end
94
+
95
+ it 'should set debug option to false based on DEBUG environment variable' do
96
+ ENV['DEBUG'] = 'no'
97
+ compile_task.options.debug.should be_false
98
+ end
99
+
100
+ it 'should use -debug=true argument when debug option is true' do
101
+ compile_task.using(:debug=>true)
102
+ mxmlc_args.should include('-debug=true')
103
+ end
104
+
105
+ it 'should not use -debug=true argument when debug option is false' do
106
+ compile_task.using(:debug=>false)
107
+ mxmlc_args.should_not include('-debug=true')
108
+ end
109
+
110
+ it 'should define CONFIG::debug,true when debug option is true' do
111
+ compile_task.using(:debug=>true)
112
+ mxmlc_args.should include('-define+=CONFIG::debug,true')
113
+ end
114
+
115
+ it 'should define CONFIG::debug,false when debug option is false' do
116
+ compile_task.using(:debug=>false)
117
+ mxmlc_args.should include('-define+=CONFIG::debug,false')
118
+ end
119
+
120
+ it 'should use -warnings=true argument when warnings option is true' do
121
+ compile_task.using(:warnings=>true)
122
+ mxmlc_args.should_not include('-warnings=false')
123
+ end
124
+
125
+ it 'should not use -warnings=true argument when warnings option is false' do
126
+ compile_task.using(:warnings=>false)
127
+ mxmlc_args.should include('-warnings=false')
128
+ end
129
+
130
+ it 'should point to the correct compiler jar' do
131
+ compiler.instance_eval{ compiler_jar }.should eql( flex_sdk.mxmlc_jar )
132
+ end
133
+
134
+ it 'should not identify itself as an air compiler' do
135
+ compiler.instance_eval{ air }.should_not eql( true )
136
+ end
137
+
138
+ it "should not use +configname=air ever" do
139
+ mxmlc_args.should_not include('+configname=air')
140
+ end
141
+
142
+ it "should not use air config file ever" do
143
+ mxmlc_args.should_not include(flex_sdk.air_config)
144
+ end
145
+
146
+ it "should use flex config file by default" do
147
+ mxmlc_args.should include(flex_sdk.flex_config)
148
+ end
149
+
150
+ it "should not identify itself as a test task when it's not" do
151
+ compiler.send(:is_test,sources,target,dependencies).should eql(false)
152
+ end
153
+
154
+ after do
155
+ Buildr.options.debug = nil
156
+ ENV.delete "debug"
157
+ ENV.delete "DEBUG"
158
+ end
159
+
160
+ end
@@ -0,0 +1,66 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
+
3
+ describe Buildr::CompileTask do
4
+
5
+ it "should create an as3_dependecies property" do
6
+ define('foo').compile.with().as3_dependencies.should_not be(nil)
7
+ end
8
+
9
+ it "should create FileList for dependency type library" do
10
+ define('foo').compile.with().as3_dependencies[:library].should be_a FileList
11
+ end
12
+
13
+ it "should create FileList for dependency type external" do
14
+ define('foo').compile.with().as3_dependencies[:external].should be_a FileList
15
+ end
16
+
17
+ it "should create FileList for dependency type include" do
18
+ define('foo').compile.with().as3_dependencies[:include].should be_a FileList
19
+ end
20
+
21
+ it "should add dependency to library type when :library is specified" do
22
+ define('foo').compile.with(:library => "myLibrary.swc").as3_dependencies[:library].should include(File.join( pwd, "myLibrary.swc"))
23
+ end
24
+
25
+ it "should add dependency to @dependencies when :library is specified" do
26
+ define('foo').compile.with(:library => "myLibrary.swc").dependencies.should include(File.join( pwd, "myLibrary.swc"))
27
+ end
28
+
29
+ it "should add dependency to library when nothing is specified" do
30
+ define('foo').compile.with("myLibrary.swc").as3_dependencies[:library].should include(File.join( pwd, "myLibrary.swc"))
31
+ end
32
+
33
+ it "should add dependency to include type when :include is specified" do
34
+ define('foo').compile.with(:include => "myLibrary.swc").as3_dependencies[:include].should include(File.join( pwd, "myLibrary.swc"))
35
+ end
36
+
37
+ it "should add dependency to @dependencies when :include is specified" do
38
+ define('foo').compile.with(:include => "myLibrary.swc").dependencies.should include(File.join( pwd, "myLibrary.swc"))
39
+ end
40
+
41
+ it "should add dependency to external type when :external is specified" do
42
+ define('foo').compile.with(:external => "myLibrary.swc").as3_dependencies[:external].should include(File.join( pwd, "myLibrary.swc") )
43
+ end
44
+
45
+ it "should add dependency to @dependencies when :external is specified" do
46
+ define('foo').compile.with(:external => "myLibrary.swc").dependencies.should include(File.join( pwd, "myLibrary.swc"))
47
+ end
48
+
49
+ it "should be possible to add multiple dependency types at once" do
50
+ deps = define('foo').compile.with(:library => "lib1.swc", :external => "extern.swc", :include => "include.swc").with("lib2.swc").as3_dependencies
51
+ deps[:library].should include( File.join(pwd,"lib1.swc" ))
52
+ deps[:library].should include( File.join(pwd,"lib2.swc" ))
53
+ deps[:external].should include( File.join(pwd,"extern.swc" ))
54
+ deps[:include].should include( File.join(pwd,"include.swc" ))
55
+ end
56
+
57
+ it "should throw and error for incorrect dependecy type" do
58
+ lambda { define('foo').compile.with(:incorrect => "incorrect.swc") }.should raise_error
59
+ end
60
+
61
+ after do
62
+ Buildr.options.debug = nil
63
+ ENV.delete "debug"
64
+ ENV.delete "DEBUG"
65
+ end
66
+ end
@@ -0,0 +1,53 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe Buildr::Project do
4
+
5
+ it "should get the correct as3 output for a compile project for a swf" do
6
+ define('foo') do
7
+ compile.using(:mxmlc, :main => _(:src,:main,:as3,"Main.as"))
8
+ get_as3_output(false).to_s.should eql(_(:target,:bin,"Main.swf"))
9
+ end
10
+ end
11
+
12
+ it "should get the correct as3 output for a compile project for a swf from output option" do
13
+ define('foo') do
14
+ compile.using(:mxmlc, :main => _(:src,:main,:as3,"Main.as"), :output => _(:target,:bin,"Output.swf"))
15
+ get_as3_output(false).to_s.should eql(_(:target,:bin,"Output.swf"))
16
+ end
17
+ end
18
+
19
+ it "should get the correct as3 output for a compile project for a swc" do
20
+ define('foo') do
21
+ compile.using(:compc)
22
+ get_as3_output(false).to_s.should eql(_(:target,:bin,"foo.swc"))
23
+ end
24
+ end
25
+
26
+ it "should get the correct as3 output for a compile project for a swc from output option" do
27
+ define('foo') do
28
+ compile.using(:compc,:output => _(:target,:bin,"Output.swc"))
29
+ get_as3_output(false).to_s.should eql(_(:target,:bin,"Output.swc"))
30
+ end
31
+ end
32
+
33
+ it "should get the correct as3 output for a test project for a swf" do
34
+ define('foo') do
35
+ test.compile.using(:mxmlc, :main => _(:src,:test,:as3,"TestRunner.mxml"))
36
+ get_as3_output(true).to_s.should eql(_(:target,:test,:bin,"TestRunner.swf"))
37
+ end
38
+ end
39
+
40
+ it "should get the correct as3 output for a test project for a swf from output option" do
41
+ define('foo') do
42
+ test.compile.using(:mxmlc, :main => _(:src,:test,:as3,"TestRunner.mxml"),:output => _(:target,:test,:bin,"Output.swf"))
43
+ get_as3_output(true).to_s.should eql(_(:target,:test,:bin,"Output.swf"))
44
+ end
45
+ end
46
+
47
+ after do
48
+ Buildr.options.debug = nil
49
+ ENV.delete "debug"
50
+ ENV.delete "DEBUG"
51
+ end
52
+
53
+ end
data/spec/sandbox.rb ADDED
@@ -0,0 +1,201 @@
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
+ # The local repository we use for testing is void of any artifacts, which will break given
18
+ # that the code requires several artifacts. So we establish them first using the real local
19
+ # repository and cache these across test cases.
20
+ Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
21
+ repositories.remote << 'http://repo1.maven.org/maven2'
22
+ repositories.remote << 'http://scala-tools.org/repo-releases'
23
+
24
+ # Force Scala version for specs; don't want to rely on SCALA_HOME
25
+ #module Buildr::Scala
26
+ # SCALA_VERSION_FOR_SPECS = ENV["SCALA_VERSION"] || "2.8.1"
27
+ #end
28
+ #Buildr.settings.build['scala.version'] = Buildr::Scala::SCALA_VERSION_FOR_SPECS
29
+
30
+ # Add a 'require' here only for optional extensions, not for extensions that should be loaded by default.
31
+ #require 'buildr/clojure'
32
+ #require 'buildr/groovy'
33
+ #require 'buildr/scala'
34
+ #require 'buildr/bnd'
35
+ #require 'buildr/jaxb_xjc'
36
+
37
+ Java.load # Anything added to the classpath.
38
+ artifacts(
39
+ #TestFramework.frameworks.map(&:dependencies).flatten,
40
+ JUnit.ant_taskdef
41
+ #Buildr::Groovy.dependencies,
42
+ #Buildr::JaxbXjc.dependencies,
43
+ #Buildr::Bnd.dependencies,
44
+ #Buildr::Scala::Scalac.dependencies,
45
+ #Buildr::Scala::Specs.dependencies,
46
+ #Buildr::Shell::BeanShell.artifact,
47
+ #Buildr::Clojure.dependencies
48
+ ).each do |path|
49
+ file(path).invoke
50
+ end
51
+ #
52
+ ENV['HOME'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'home'))
53
+ mkpath ENV['HOME']
54
+
55
+ # Make Scala.version resilient to sandbox reset
56
+ #module Buildr::Scala
57
+ # DEFAULT_VERSION = SCALA_VERSION_FOR_SPECS
58
+ #
59
+ # class << self
60
+ # def version
61
+ # SCALA_VERSION_FOR_SPECS
62
+ # end
63
+ # end
64
+ #
65
+ # class Scalac
66
+ # class << self
67
+ # def use_installed?
68
+ # false
69
+ # end
70
+ # end
71
+ # end
72
+ #end
73
+
74
+ # We need to run all tests inside a _sandbox, tacking a snapshot of Buildr before the test,
75
+ # and restoring everything to its previous state after the test. Damn state changes.
76
+ module Sandbox
77
+
78
+ class << self
79
+ attr_reader :tasks, :rules
80
+
81
+ def included(spec)
82
+ spec.before(:each) { sandbox }
83
+ spec.after(:each) { reset }
84
+ end
85
+
86
+ # Require an optional extension without letting its callbacks pollute the Project class.
87
+ def require_optional_extension(extension_require_path)
88
+ project_callbacks_without_extension = Project.class_eval { @global_callbacks }.dup
89
+ begin
90
+ require extension_require_path
91
+ ensure
92
+ Project.class_eval { @global_callbacks = project_callbacks_without_extension }
93
+ end
94
+ end
95
+ end
96
+
97
+ @tasks = Buildr.application.tasks.collect do |original|
98
+ prerequisites = original.send(:prerequisites).map(&:to_s)
99
+ actions = original.instance_eval { @actions }.clone
100
+ lambda do
101
+ original.class.send(:define_task, original.name=>prerequisites).tap do |task|
102
+ task.comment = original.comment
103
+ actions.each { |action| task.enhance &action }
104
+ end
105
+ end
106
+ end
107
+ @rules = Buildr.application.instance_variable_get(:@rules)
108
+
109
+ def sandbox
110
+ @_sandbox = {}
111
+
112
+ # Create a temporary directory where we can create files, e.g,
113
+ # for projects, compilation. We need a place that does not depend
114
+ # on the current directory.
115
+ @_sandbox[:original_dir] = Dir.pwd
116
+ @temp = File.join(File.dirname(__FILE__), '../tmp')
117
+ FileUtils.mkpath @temp
118
+ Dir.chdir @temp
119
+
120
+ ARGV.clear
121
+ Buildr.application = Buildr::Application.new
122
+ Sandbox.tasks.each { |block| block.call }
123
+ Buildr.application.instance_variable_set :@rules, Sandbox.rules.clone
124
+ Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
125
+
126
+ @_sandbox[:load_path] = $LOAD_PATH.clone
127
+
128
+ # clear RUBYOPT since bundler hooks into it
129
+ # e.g. RUBYOPT=-I/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib -rbundler/setup
130
+ # and so Buildr's own Gemfile configuration taints e.g., JRuby's environment
131
+ @_sandbox[:ruby_opt] = ENV["RUBYOPT"]
132
+ ENV["RUBYOPT"] = nil
133
+
134
+ #@_sandbox[:loaded_features] = $LOADED_FEATURES.clone
135
+
136
+ # Later on we'll want to lose all the on_define created during the test.
137
+ @_sandbox[:on_define] = Project.class_eval { (@on_define || []).dup }
138
+ @_sandbox[:extension_modules] = Project.class_eval { (@extension_modules || []).dup }
139
+ @_sandbox[:global_callbacks] = Project.class_eval { (@global_callbacks || []).dup }
140
+ @_sandbox[:layout] = Layout.default.clone
141
+
142
+ # Create a local repository we can play with. However, our local repository will be void
143
+ # of some essential artifacts (e.g. JUnit artifacts required by build task), so we create
144
+ # these first (see above) and keep them across test cases.
145
+ @_sandbox[:artifacts] = Artifact.class_eval { @artifacts }.clone
146
+ @_sandbox[:local_repository] = Buildr.repositories.local
147
+ ENV['HOME'] = File.expand_path('home')
148
+ ENV['BUILDR_ENV'] = 'development'
149
+
150
+ @_sandbox[:env_keys] = ENV.keys
151
+ ['DEBUG', 'TEST', 'HTTP_PROXY', 'HTTPS_PROXY', 'USER'].each { |k| ENV.delete(k) ; ENV.delete(k.downcase) }
152
+
153
+ # By default, remote repository is user's own local M2 repository
154
+ # since we don't want to remotely download artifacts into the sandbox over and over
155
+ Buildr.repositories.instance_eval do
156
+ @remote = ["file://" + @local]
157
+ @local = @release_to = nil
158
+ end
159
+ Buildr.options.proxy.http = nil
160
+
161
+ # Don't output crap to the console.
162
+ trace false
163
+ verbose false
164
+ end
165
+
166
+ # Call this from teardown.
167
+ def reset
168
+ # Get rid of all the projects and the on_define blocks we used.
169
+ Project.clear
170
+
171
+ on_define = @_sandbox[:on_define]
172
+ extension_modules = @_sandbox[:extension_modules]
173
+ global_callbacks = @_sandbox[:global_callbacks]
174
+
175
+ Project.class_eval do
176
+ @on_define = on_define
177
+ @global_callbacks = global_callbacks
178
+ @extension_modules = extension_modules
179
+ end
180
+
181
+ Layout.default = @_sandbox[:layout].clone
182
+
183
+ $LOAD_PATH.replace @_sandbox[:load_path]
184
+ ENV["RUBYOPT"] = @_sandbox[:ruby_opt]
185
+
186
+ FileUtils.rm_rf @temp
187
+ mkpath ENV['HOME']
188
+
189
+ # Get rid of all artifacts.
190
+ @_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
191
+
192
+ Buildr.repositories.local = @_sandbox[:local_repository]
193
+
194
+ # Restore options.
195
+ Buildr.options.test = nil
196
+ (ENV.keys - @_sandbox[:env_keys]).each { |key| ENV.delete key }
197
+
198
+ Dir.chdir @_sandbox[:original_dir]
199
+ end
200
+
201
+ end