aruba 1.0.0.pre.alpha.3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/.rubocop.yml +40 -1
- data/.rubocop_todo.yml +106 -254
- data/.simplecov +7 -5
- data/.travis.yml +25 -38
- data/CHANGELOG.md +246 -46
- data/CONTRIBUTING.md +8 -17
- data/Gemfile +5 -54
- data/LICENSE +1 -1
- data/README.md +37 -30
- data/Rakefile +23 -50
- data/appveyor.yml +4 -8
- data/aruba.gemspec +34 -13
- data/bin/console +1 -1
- data/cucumber.yml +4 -15
- data/exe/aruba +1 -1
- data/fixtures/cli-app/bin/aruba-test-cli +1 -1
- data/fixtures/cli-app/cli-app.gemspec +4 -5
- data/fixtures/cli-app/lib/cli/app.rb +1 -1
- data/fixtures/cli-app/spec/spec_helper.rb +3 -2
- data/fixtures/empty-app/cli-app.gemspec +4 -5
- data/fixtures/empty-app/lib/cli/app.rb +0 -2
- data/fixtures/getting-started-app/Gemfile +1 -1
- data/lib/aruba/api.rb +6 -6
- data/lib/aruba/api/bundler.rb +1 -1
- data/lib/aruba/api/commands.rb +36 -13
- data/lib/aruba/api/core.rb +74 -47
- data/lib/aruba/api/environment.rb +16 -4
- data/lib/aruba/api/filesystem.rb +48 -48
- data/lib/aruba/api/text.rb +15 -3
- data/lib/aruba/aruba_path.rb +24 -95
- data/lib/aruba/basic_configuration.rb +5 -6
- data/lib/aruba/basic_configuration/option.rb +2 -2
- data/lib/aruba/cli.rb +4 -1
- data/lib/aruba/colorizer.rb +10 -99
- data/lib/aruba/config/jruby.rb +15 -5
- data/lib/aruba/config_wrapper.rb +17 -2
- data/lib/aruba/configuration.rb +43 -14
- data/lib/aruba/console.rb +0 -2
- data/lib/aruba/console/help.rb +5 -2
- data/lib/aruba/contracts/absolute_path.rb +3 -3
- data/lib/aruba/contracts/is_power_of_two.rb +2 -2
- data/lib/aruba/contracts/relative_path.rb +3 -3
- data/lib/aruba/cucumber.rb +0 -2
- data/lib/aruba/cucumber/command.rb +190 -93
- data/lib/aruba/cucumber/file.rb +53 -35
- data/lib/aruba/cucumber/hooks.rb +4 -1
- data/lib/aruba/cucumber/testing_frameworks.rb +76 -50
- data/lib/aruba/event_bus.rb +4 -2
- data/lib/aruba/event_bus/name_resolver.rb +9 -8
- data/lib/aruba/events.rb +2 -1
- data/lib/aruba/hooks.rb +2 -4
- data/lib/aruba/in_config_wrapper.rb +10 -3
- data/lib/aruba/initializer.rb +37 -31
- data/lib/aruba/matchers/base/base_matcher.rb +2 -11
- data/lib/aruba/matchers/base/message_indenter.rb +1 -1
- data/lib/aruba/matchers/base/object_formatter.rb +0 -5
- data/lib/aruba/matchers/collection/include_an_object.rb +4 -4
- data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +15 -3
- data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -1
- data/lib/aruba/matchers/command/have_output.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
- data/lib/aruba/matchers/command/have_output_size.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/directory/have_sub_directory.rb +8 -3
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +4 -2
- data/lib/aruba/matchers/path/have_permissions.rb +4 -2
- data/lib/aruba/platform.rb +0 -7
- data/lib/aruba/platforms/announcer.rb +36 -17
- data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
- data/lib/aruba/platforms/command_monitor.rb +39 -3
- data/lib/aruba/platforms/determine_disk_usage.rb +56 -19
- data/lib/aruba/platforms/simple_table.rb +2 -10
- data/lib/aruba/platforms/unix_environment_variables.rb +10 -13
- data/lib/aruba/platforms/unix_platform.rb +16 -12
- data/lib/aruba/platforms/unix_which.rb +1 -1
- data/lib/aruba/platforms/windows_command_string.rb +2 -2
- data/lib/aruba/platforms/windows_environment_variables.rb +9 -2
- data/lib/aruba/platforms/windows_platform.rb +4 -0
- data/lib/aruba/platforms/windows_which.rb +6 -2
- data/lib/aruba/processes/basic_process.rb +13 -15
- data/lib/aruba/processes/debug_process.rb +11 -5
- data/lib/aruba/processes/in_process.rb +4 -2
- data/lib/aruba/processes/spawn_process.rb +32 -16
- data/lib/aruba/rspec.rb +24 -14
- data/lib/aruba/runtime.rb +11 -4
- data/lib/aruba/setup.rb +27 -14
- data/lib/aruba/tasks/docker_helpers.rb +3 -1
- data/lib/aruba/version.rb +1 -1
- metadata +190 -34
- data/bin/build +0 -3
- data/bin/release +0 -3
- data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
data/bin/console
CHANGED
data/cucumber.yml
CHANGED
@@ -1,17 +1,6 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
require 'ffi'
|
5
|
-
|
6
|
-
java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION)
|
7
|
-
|
8
|
-
std_opts = "--format pretty --color --exclude features/fixtures --require features --tags ~@unsupported-on"
|
9
|
-
java_default_opts = "--tags ~@wip-jruby-java-1.6" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
|
10
|
-
java_wip_opts = "--tags @wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
|
11
|
-
|
12
|
-
ignore_opts = []
|
13
|
-
ignore_opts << '--tags ~@ignore'
|
14
|
-
ignore_opts = ignore_opts.join(' ')
|
2
|
+
std_opts = "--format pretty --color --exclude features/fixtures --require features --tags 'not @unsupported-on'"
|
3
|
+
ignore_opts = "--tags 'not @ignore'"
|
15
4
|
%>
|
16
|
-
default: <%= std_opts %> --tags
|
17
|
-
wip: <%= std_opts %> --wip --tags @wip:3 <%=
|
5
|
+
default: <%= std_opts %> --tags 'not @wip' <%= ignore_opts %>
|
6
|
+
wip: <%= std_opts %> --wip --tags @wip:3 <%= ignore_opts %>
|
data/exe/aruba
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'cli/app/version'
|
6
4
|
|
@@ -17,11 +15,12 @@ Gem::Specification.new do |spec|
|
|
17
15
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
16
|
# delete this section to allow pushing this gem to any host.
|
19
17
|
|
20
|
-
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
20
|
spec.bindir = 'exe'
|
22
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
24
|
spec.add_development_dependency 'bundler', '~> 1.9'
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
27
26
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
2
|
|
3
3
|
require 'cli/app'
|
4
4
|
|
5
5
|
require_relative 'support/aruba'
|
6
6
|
|
7
|
-
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__))
|
7
|
+
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__))
|
8
|
+
.each { |f| require_relative f }
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'cli/app/version'
|
6
4
|
|
@@ -17,11 +15,12 @@ Gem::Specification.new do |spec|
|
|
17
15
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
16
|
# delete this section to allow pushing this gem to any host.
|
19
17
|
|
20
|
-
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
20
|
spec.bindir = 'exe'
|
22
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
24
|
spec.add_development_dependency 'bundler', '~> 1.9'
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
27
26
|
end
|
data/lib/aruba/api.rb
CHANGED
@@ -19,11 +19,11 @@ Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
|
|
19
19
|
module Aruba
|
20
20
|
# Api
|
21
21
|
module Api
|
22
|
-
include
|
23
|
-
include
|
24
|
-
include
|
25
|
-
include
|
26
|
-
include
|
27
|
-
include
|
22
|
+
include Core
|
23
|
+
include Commands
|
24
|
+
include Environment
|
25
|
+
include Filesystem
|
26
|
+
include Text
|
27
|
+
include Bundler
|
28
28
|
end
|
29
29
|
end
|
data/lib/aruba/api/bundler.rb
CHANGED
@@ -7,7 +7,7 @@ module Aruba
|
|
7
7
|
|
8
8
|
# Unset variables used by bundler
|
9
9
|
def unset_bundler_env_vars
|
10
|
-
%w
|
10
|
+
%w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).each do |key|
|
11
11
|
delete_environment_variable(key)
|
12
12
|
end
|
13
13
|
end
|
data/lib/aruba/api/commands.rb
CHANGED
@@ -92,6 +92,30 @@ module Aruba
|
|
92
92
|
self
|
93
93
|
end
|
94
94
|
|
95
|
+
# Get stdout of all processes
|
96
|
+
#
|
97
|
+
# @return [String]
|
98
|
+
# The stdout of all processes which have run before
|
99
|
+
def all_stdout
|
100
|
+
aruba.command_monitor.all_stdout
|
101
|
+
end
|
102
|
+
|
103
|
+
# Get stderr of all processes
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
# The stderr of all processes which have run before
|
107
|
+
def all_stderr
|
108
|
+
aruba.command_monitor.all_stderr
|
109
|
+
end
|
110
|
+
|
111
|
+
# Get stderr and stdout of all processes
|
112
|
+
#
|
113
|
+
# @return [String]
|
114
|
+
# The stderr and stdout of all processes which have run before
|
115
|
+
def all_output
|
116
|
+
aruba.command_monitor.all_output
|
117
|
+
end
|
118
|
+
|
95
119
|
# Find a started command
|
96
120
|
#
|
97
121
|
# @param [String, Command] commandline
|
@@ -128,7 +152,7 @@ module Aruba
|
|
128
152
|
|
129
153
|
unless command.interactive?
|
130
154
|
raise NotImplementedError,
|
131
|
-
|
155
|
+
'Running interactively is not supported with this process launcher.'
|
132
156
|
end
|
133
157
|
|
134
158
|
start_command(command)
|
@@ -144,16 +168,16 @@ module Aruba
|
|
144
168
|
# @param [String] cmd
|
145
169
|
# The command to be executed
|
146
170
|
#
|
147
|
-
# @param [Hash]
|
171
|
+
# @param [Hash] opts
|
148
172
|
# Options for aruba
|
149
173
|
#
|
150
|
-
# @option
|
174
|
+
# @option opts [Boolean] :fail_on_error
|
151
175
|
# Should aruba fail on error?
|
152
176
|
#
|
153
|
-
# @option
|
177
|
+
# @option opts [Numeric] :exit_timeout
|
154
178
|
# Timeout for execution
|
155
179
|
#
|
156
|
-
# @option
|
180
|
+
# @option opts [Numeric] :io_wait_timeout
|
157
181
|
# Timeout for IO - STDERR, STDOUT
|
158
182
|
#
|
159
183
|
def run_command_and_stop(cmd, opts = {})
|
@@ -196,12 +220,11 @@ module Aruba
|
|
196
220
|
|
197
221
|
private
|
198
222
|
|
199
|
-
# rubocop:disable Metrics/MethodLength
|
200
223
|
def prepare_command(cmd, opts)
|
201
|
-
exit_timeout = opts[:exit_timeout]
|
202
|
-
io_wait_timeout = opts[:io_wait_timeout]
|
203
|
-
stop_signal = opts[:stop_signal]
|
204
|
-
startup_wait_time = opts[:startup_wait_time]
|
224
|
+
exit_timeout = opts[:exit_timeout] || aruba.config.exit_timeout
|
225
|
+
io_wait_timeout = opts[:io_wait_timeout] || aruba.config.io_wait_timeout
|
226
|
+
stop_signal = opts[:stop_signal] || aruba.config.stop_signal
|
227
|
+
startup_wait_time = opts[:startup_wait_time] || aruba.config.startup_wait_time
|
205
228
|
|
206
229
|
cmd = replace_variables(cmd)
|
207
230
|
|
@@ -232,12 +255,12 @@ module Aruba
|
|
232
255
|
)
|
233
256
|
end
|
234
257
|
|
235
|
-
# rubocop:enable Metrics/MethodLength
|
236
|
-
|
237
258
|
def start_command(command)
|
238
259
|
aruba.config.before(:command, self, command)
|
239
260
|
|
240
|
-
|
261
|
+
in_current_directory do
|
262
|
+
command.start
|
263
|
+
end
|
241
264
|
|
242
265
|
stop_signal = command.stop_signal
|
243
266
|
aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal
|
data/lib/aruba/api/core.rb
CHANGED
@@ -3,8 +3,6 @@ require 'aruba/runtime'
|
|
3
3
|
require 'aruba/errors'
|
4
4
|
require 'aruba/setup'
|
5
5
|
|
6
|
-
require 'aruba/config/jruby'
|
7
|
-
|
8
6
|
# Aruba
|
9
7
|
module Aruba
|
10
8
|
# Api
|
@@ -17,6 +15,10 @@ module Aruba
|
|
17
15
|
|
18
16
|
# Aruba Runtime
|
19
17
|
def aruba
|
18
|
+
# TODO: Check this variable being accessed inconsistently. Should only
|
19
|
+
# be using the memo!
|
20
|
+
# Renaming this to `aruba` causes 100's of rspec failures. Needs a
|
21
|
+
# deeper dive, approach with caution!
|
20
22
|
@_aruba_runtime ||= Runtime.new
|
21
23
|
end
|
22
24
|
|
@@ -31,6 +33,15 @@ module Aruba
|
|
31
33
|
self
|
32
34
|
end
|
33
35
|
|
36
|
+
# Execute block in Aruba's current directory
|
37
|
+
#
|
38
|
+
# @yield
|
39
|
+
# The block which should be run in current directory
|
40
|
+
def in_current_directory(&block)
|
41
|
+
create_directory '.' unless directory?('.')
|
42
|
+
cd('.', &block)
|
43
|
+
end
|
44
|
+
|
34
45
|
# Switch to directory
|
35
46
|
#
|
36
47
|
# @param [String] dir
|
@@ -45,25 +56,30 @@ module Aruba
|
|
45
56
|
# @example Run code in directory
|
46
57
|
# result = cd('some-dir') { Dir.getwd }
|
47
58
|
#
|
48
|
-
# rubocop:disable Metrics/MethodLength
|
49
59
|
def cd(dir, &block)
|
50
60
|
if block_given?
|
51
61
|
begin
|
52
|
-
|
62
|
+
unless Aruba.platform.directory?(expand_path(dir))
|
63
|
+
raise ArgumentError,
|
64
|
+
"#{expand_path(dir)} is not a directory or does not exist."
|
65
|
+
end
|
53
66
|
|
54
67
|
old_directory = expand_path('.')
|
55
68
|
aruba.current_directory << dir
|
56
69
|
new_directory = expand_path('.')
|
57
70
|
|
58
|
-
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
|
71
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
|
72
|
+
new: new_directory)
|
59
73
|
|
60
74
|
old_dir = Aruba.platform.getwd
|
61
75
|
|
62
|
-
|
76
|
+
real_new_directory = File.expand_path(aruba.current_directory,
|
77
|
+
aruba.root_directory)
|
78
|
+
Aruba.platform.chdir real_new_directory
|
63
79
|
|
64
80
|
result = with_environment(
|
65
81
|
'OLDPWD' => old_dir,
|
66
|
-
'PWD' =>
|
82
|
+
'PWD' => real_new_directory,
|
67
83
|
&block
|
68
84
|
)
|
69
85
|
ensure
|
@@ -74,17 +90,19 @@ module Aruba
|
|
74
90
|
return result
|
75
91
|
end
|
76
92
|
|
77
|
-
|
93
|
+
unless Aruba.platform.directory?(expand_path(dir))
|
94
|
+
raise ArgumentError, "#{expand_path(dir)} is not a directory or does not exist."
|
95
|
+
end
|
78
96
|
|
79
97
|
old_directory = expand_path('.')
|
80
98
|
aruba.current_directory << dir
|
81
99
|
new_directory = expand_path('.')
|
82
100
|
|
83
|
-
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
|
101
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
|
102
|
+
new: new_directory)
|
84
103
|
|
85
104
|
self
|
86
105
|
end
|
87
|
-
# rubocop:enable Metrics/MethodLength
|
88
106
|
|
89
107
|
# Expand file name
|
90
108
|
#
|
@@ -122,57 +140,70 @@ module Aruba
|
|
122
140
|
# # => /foo/bar
|
123
141
|
# expand_path('/foo/bar')
|
124
142
|
#
|
125
|
-
# rubocop:disable Metrics/MethodLength
|
126
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
127
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
128
143
|
def expand_path(file_name, dir_string = nil)
|
129
|
-
|
130
|
-
|
131
|
-
|
144
|
+
unless file_name.is_a?(String) && !file_name.empty?
|
145
|
+
message = "Filename #{file_name} needs to be a string." \
|
146
|
+
' It cannot be nil or empty either. '\
|
147
|
+
"Please use `expand_path('.')` if you want the current directory to be expanded."
|
132
148
|
|
133
|
-
|
134
|
-
|
135
|
-
# rubocop:disable Metrics/LineLength
|
136
|
-
fail %(Aruba's working directory does not exist. Maybe you forgot to run `setup_aruba` before using its API.) unless Aruba.platform.directory? File.join(aruba.config.root_directory, aruba.config.working_directory)
|
149
|
+
raise ArgumentError, message
|
150
|
+
end
|
137
151
|
|
138
|
-
|
152
|
+
unless Aruba.platform.directory? File.join(aruba.config.root_directory,
|
153
|
+
aruba.config.working_directory)
|
154
|
+
raise "Aruba's working directory does not exist." \
|
155
|
+
' Maybe you forgot to run `setup_aruba` before using its API.'
|
156
|
+
end
|
139
157
|
|
140
158
|
prefix = file_name[0]
|
141
|
-
rest = file_name[2..-1]
|
142
159
|
|
143
160
|
if aruba.config.fixtures_path_prefix == prefix
|
161
|
+
rest = file_name[2..-1]
|
144
162
|
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
163
|
+
unless Aruba.platform.exist? path
|
164
|
+
aruba_fixture_candidates = aruba.config.fixtures_directories
|
165
|
+
.map { |p| format('"%s"', p) }.join(', ')
|
166
|
+
|
167
|
+
raise ArgumentError,
|
168
|
+
"Fixture \"#{rest}\" does not exist" \
|
169
|
+
" in fixtures directory \"#{aruba.fixtures_directory}\"." \
|
170
|
+
' This was the one we found first on your system from all possible' \
|
171
|
+
" candidates: #{aruba_fixture_candidates}."
|
172
|
+
end
|
150
173
|
|
151
174
|
path
|
152
175
|
elsif prefix == '~'
|
153
176
|
path = with_environment do
|
154
|
-
|
177
|
+
File.expand_path(file_name)
|
155
178
|
end
|
156
179
|
|
157
|
-
|
158
|
-
|
180
|
+
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == '/'
|
181
|
+
|
182
|
+
unless Aruba.platform.absolute_path? path
|
183
|
+
raise ArgumentError,
|
184
|
+
"Expanding \"~\" to a relative path \"#{path}\" is not allowed"
|
185
|
+
end
|
159
186
|
|
160
187
|
path.to_s
|
161
|
-
elsif absolute?
|
188
|
+
elsif absolute?(file_name)
|
162
189
|
unless aruba.config.allow_absolute_paths
|
163
|
-
|
164
|
-
|
190
|
+
caller_location = caller_locations(1, 1).first
|
191
|
+
caller_file_line = "#{caller_location.path}:#{caller_location.lineno}"
|
192
|
+
aruba.logger.warn \
|
193
|
+
"Aruba's `expand_path` method was called with an absolute path" \
|
194
|
+
" at #{caller_file_line}, which is not recommended." \
|
195
|
+
' Change the call to pass a relative path or set '\
|
196
|
+
'`config.allow_absolute_paths = true` to silence this warning'
|
165
197
|
end
|
166
198
|
file_name
|
167
199
|
else
|
168
|
-
|
169
|
-
|
170
|
-
|
200
|
+
with_environment do
|
201
|
+
directory = File.expand_path(aruba.current_directory, aruba.root_directory)
|
202
|
+
directory = File.expand_path(dir_string, directory) if dir_string
|
203
|
+
File.expand_path(file_name, directory)
|
204
|
+
end
|
171
205
|
end
|
172
206
|
end
|
173
|
-
# rubocop:enable Metrics/MethodLength
|
174
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
175
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
176
207
|
|
177
208
|
# Run block with environment
|
178
209
|
#
|
@@ -182,14 +213,10 @@ module Aruba
|
|
182
213
|
# @yield
|
183
214
|
# The block of code which should be run with the changed environment variables
|
184
215
|
def with_environment(env = {}, &block)
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
ensure
|
190
|
-
# make sure the old environment is really restored in "aruba.environment"
|
191
|
-
aruba.environment.clear
|
192
|
-
aruba.environment.update old_aruba_env
|
216
|
+
aruba.environment.nest do |nested_env|
|
217
|
+
nested_env.update(env)
|
218
|
+
Aruba.platform.with_environment nested_env.to_h, &block
|
219
|
+
end
|
193
220
|
end
|
194
221
|
end
|
195
222
|
end
|