aruba 1.0.0.pre.alpha.2 → 1.0.0.pre.alpha.3
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.
- checksums.yaml +5 -5
- data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
- data/.rubocop.yml +6 -181
- data/.rubocop_todo.yml +364 -0
- data/.travis.yml +63 -34
- data/.yardopts +3 -0
- data/CHANGELOG.md +1121 -0
- data/CONTRIBUTING.md +179 -78
- data/Gemfile +29 -44
- data/README.md +41 -11
- data/Rakefile +35 -35
- data/appveyor.yml +6 -5
- data/aruba.gemspec +14 -16
- data/bin/console +2 -11
- data/cucumber.yml +0 -7
- data/fixtures/cli-app/README.md +1 -1
- data/fixtures/cli-app/Rakefile +1 -1
- data/fixtures/cli-app/cli-app.gemspec +1 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
- data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
- data/fixtures/empty-app/Rakefile +1 -1
- data/fixtures/empty-app/cli-app.gemspec +1 -0
- data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
- data/fixtures/getting-started-app/Gemfile +1 -1
- data/lib/aruba/api.rb +3 -10
- data/lib/aruba/api/bundler.rb +16 -0
- data/lib/aruba/api/commands.rb +249 -0
- data/lib/aruba/api/core.rb +24 -10
- data/lib/aruba/api/environment.rb +12 -7
- data/lib/aruba/api/filesystem.rb +22 -20
- data/lib/aruba/api/text.rb +3 -9
- data/lib/aruba/aruba_path.rb +3 -18
- data/lib/aruba/basic_configuration.rb +3 -19
- data/lib/aruba/cli.rb +1 -1
- data/lib/aruba/colorizer.rb +33 -33
- data/lib/aruba/command.rb +4 -0
- data/lib/aruba/config_wrapper.rb +1 -1
- data/lib/aruba/configuration.rb +78 -0
- data/lib/aruba/console.rb +5 -5
- data/lib/aruba/console/help.rb +1 -1
- data/lib/aruba/cucumber.rb +0 -1
- data/lib/aruba/cucumber/command.rb +55 -115
- data/lib/aruba/cucumber/environment.rb +1 -1
- data/lib/aruba/cucumber/file.rb +9 -21
- data/lib/aruba/cucumber/hooks.rb +6 -62
- data/lib/aruba/event_bus/name_resolver.rb +1 -2
- data/lib/aruba/hooks.rb +1 -1
- data/lib/aruba/initializer.rb +3 -3
- data/lib/aruba/matchers/base/base_matcher.rb +2 -2
- data/lib/aruba/matchers/base/message_indenter.rb +19 -0
- data/lib/aruba/matchers/base/object_formatter.rb +2 -2
- data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
- data/lib/aruba/matchers/command/be_successfully_executed.rb +2 -4
- data/lib/aruba/matchers/command/have_exit_status.rb +1 -1
- data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -4
- data/lib/aruba/matchers/command/have_output.rb +9 -4
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
- data/lib/aruba/matchers/command/have_output_size.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +4 -6
- data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
- data/lib/aruba/matchers/file/be_an_existing_file.rb +4 -6
- data/lib/aruba/matchers/file/have_file_content.rb +4 -4
- data/lib/aruba/matchers/file/have_file_size.rb +6 -8
- data/lib/aruba/matchers/file/have_same_file_content.rb +9 -12
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
- data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
- data/lib/aruba/matchers/path/have_permissions.rb +6 -8
- data/lib/aruba/matchers/string/include_output_string.rb +8 -10
- data/lib/aruba/matchers/string/match_output_string.rb +9 -11
- data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
- data/lib/aruba/platform.rb +0 -1
- data/lib/aruba/platforms/announcer.rb +26 -70
- data/lib/aruba/platforms/aruba_file_creator.rb +1 -1
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
- data/lib/aruba/platforms/aruba_logger.rb +22 -2
- data/lib/aruba/platforms/command_monitor.rb +2 -125
- data/lib/aruba/platforms/filesystem_status.rb +9 -9
- data/lib/aruba/platforms/local_environment.rb +2 -2
- data/lib/aruba/platforms/simple_table.rb +3 -3
- data/lib/aruba/platforms/unix_command_string.rb +7 -4
- data/lib/aruba/platforms/unix_environment_variables.rb +9 -13
- data/lib/aruba/platforms/unix_platform.rb +2 -27
- data/lib/aruba/platforms/unix_which.rb +2 -1
- data/lib/aruba/platforms/windows_command_string.rb +20 -7
- data/lib/aruba/platforms/windows_environment_variables.rb +35 -30
- data/lib/aruba/platforms/windows_which.rb +4 -3
- data/lib/aruba/processes/basic_process.rb +11 -15
- data/lib/aruba/processes/debug_process.rb +5 -0
- data/lib/aruba/processes/in_process.rb +17 -8
- data/lib/aruba/processes/spawn_process.rb +35 -23
- data/lib/aruba/rspec.rb +9 -22
- data/lib/aruba/runtime.rb +7 -5
- data/lib/aruba/setup.rb +6 -4
- data/lib/aruba/tasks/docker_helpers.rb +1 -1
- data/lib/aruba/version.rb +1 -1
- metadata +37 -57
- data/History.md +0 -612
- data/bin/bootstrap +0 -34
- data/fixtures/spawn_process/stderr.sh +0 -3
- data/lib/aruba/api/command.rb +0 -309
- data/lib/aruba/api/deprecated.rb +0 -895
- data/lib/aruba/api/rvm.rb +0 -44
- data/lib/aruba/config.rb +0 -101
- data/lib/aruba/cucumber/rvm.rb +0 -3
- data/lib/aruba/in_process.rb +0 -14
- data/lib/aruba/jruby.rb +0 -4
- data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
- data/lib/aruba/spawn_process.rb +0 -11
@@ -5,44 +5,35 @@ module Aruba
|
|
5
5
|
# Platforms
|
6
6
|
module Platforms
|
7
7
|
# Windows is case-insensitive when it accesses its environment variables.
|
8
|
-
# That means that at the Windows command line:
|
9
8
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
|
9
|
+
# To work around this we turn all of the environment variable keys to
|
10
|
+
# upper-case so that aruba is ensured that accessing environment variables
|
11
|
+
# with upper-case keys will always work. See the following examples.
|
14
12
|
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# @example Setting Windows environment variables using mixed case
|
14
|
+
# C:>set Path
|
15
|
+
# C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
|
16
|
+
# C:>set PATH
|
17
|
+
# C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
|
17
18
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
|
19
|
+
# @example If you access environment variables through ENV, you can access values no matter the case of the key:
|
20
|
+
# ENV["Path"] # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
|
21
|
+
# ENV["PATH"] # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
|
22
22
|
#
|
23
|
-
# But if you copy the ENV to a hash, Ruby treats the keys as case sensitive:
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
# => nil
|
31
|
-
#
|
32
|
-
# Thus we turn all of the environment variable keys to upper case so that
|
33
|
-
# aruba is ensured that accessing environment variables with upper case keys
|
34
|
-
# will always work.
|
23
|
+
# @example But if you copy the ENV to a hash, Ruby treats the keys as case sensitive:
|
24
|
+
# env_copy = ENV.to_hash
|
25
|
+
# # => {"ALLUSERSPROFILE"=>"C:\\ProgramData", "ANSICON"=>"119x1000 (119x58)", "ANSICON_DEF"=>"7", APPDATA"=>"C:\\Users\\blorf\\AppData\\Roaming", ....}
|
26
|
+
# env["Path"]
|
27
|
+
# # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
|
28
|
+
# env["PATH"]
|
29
|
+
# # => nil
|
35
30
|
class WindowsEnvironmentVariables < UnixEnvironmentVariables
|
36
|
-
def initialize(env = ENV
|
37
|
-
|
38
|
-
|
39
|
-
@env = env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
|
31
|
+
def initialize(env = ENV)
|
32
|
+
super(upcase_env env)
|
40
33
|
end
|
41
34
|
|
42
35
|
def update(other_env, &block)
|
43
|
-
|
44
|
-
|
45
|
-
super(other_env, &block)
|
36
|
+
super(upcase_env(other_env), &block)
|
46
37
|
end
|
47
38
|
|
48
39
|
def fetch(name, default = UnixEnvironmentVariables::UNDEFINED)
|
@@ -72,6 +63,20 @@ module Aruba
|
|
72
63
|
def delete(name)
|
73
64
|
super(name.upcase)
|
74
65
|
end
|
66
|
+
|
67
|
+
def self.hash_from_env
|
68
|
+
upcase_env(ENV)
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.upcase_env(env)
|
72
|
+
env.each_with_object({}) { |(k, v), a| a[k.to_s.upcase] = v }
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def upcase_env(env)
|
78
|
+
self.class.upcase_env(env)
|
79
|
+
end
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
@@ -23,11 +23,12 @@ module Aruba
|
|
23
23
|
Aruba.platform.absolute_path?(program) || Aruba.platform.relative_command?(program)
|
24
24
|
end
|
25
25
|
|
26
|
-
def call(program,
|
26
|
+
def call(program, _path)
|
27
27
|
# Expand `#path_exts`
|
28
28
|
found = Dir[program].first
|
29
29
|
|
30
30
|
return File.expand_path(found) if found && Aruba.platform.executable?(found)
|
31
|
+
|
31
32
|
nil
|
32
33
|
end
|
33
34
|
end
|
@@ -48,7 +49,7 @@ module Aruba
|
|
48
49
|
file = File.join(dir, program)
|
49
50
|
# Dir[] doesn't handle backslashes properly, so convert them. Also, if
|
50
51
|
# the program name doesn't have an extension, try them all.
|
51
|
-
file = file.tr(
|
52
|
+
file = file.tr('\\', '/')
|
52
53
|
|
53
54
|
found = Dir[file].first
|
54
55
|
|
@@ -95,7 +96,7 @@ module Aruba
|
|
95
96
|
private
|
96
97
|
|
97
98
|
def windows_executable_extentions
|
98
|
-
ENV['PATHEXT'] ? format('.{%s}', ENV['PATHEXT'].tr(';', ',').tr('.','')).downcase : '.{exe,com,bat}'
|
99
|
+
ENV['PATHEXT'] ? format('.{%s}', ENV['PATHEXT'].tr(';', ',').tr('.', '')).downcase : '.{exe,com,bat}'
|
99
100
|
end
|
100
101
|
end
|
101
102
|
end
|
@@ -11,9 +11,12 @@ module Aruba
|
|
11
11
|
#
|
12
12
|
# @private
|
13
13
|
class BasicProcess
|
14
|
-
attr_reader :exit_status, :environment, :working_directory, :main_class,
|
14
|
+
attr_reader :exit_status, :environment, :working_directory, :main_class,
|
15
|
+
:io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal
|
15
16
|
|
16
|
-
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
|
17
|
+
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
|
18
|
+
environment = Aruba.platform.environment_variables.hash_from_env,
|
19
|
+
main_class = nil, stop_signal = nil, startup_wait_time = 0)
|
17
20
|
@cmd = cmd
|
18
21
|
@working_directory = working_directory
|
19
22
|
@environment = environment
|
@@ -101,14 +104,6 @@ module Aruba
|
|
101
104
|
@timed_out == true
|
102
105
|
end
|
103
106
|
|
104
|
-
# @deprecated
|
105
|
-
# @private
|
106
|
-
def run!
|
107
|
-
Aruba.platform.deprecated('The use of "command#run!" is deprecated. You can simply use "command#start" instead.')
|
108
|
-
|
109
|
-
start
|
110
|
-
end
|
111
|
-
|
112
107
|
# Hook which is run before command is run
|
113
108
|
def before_run; end
|
114
109
|
|
@@ -117,18 +112,16 @@ module Aruba
|
|
117
112
|
|
118
113
|
def inspect
|
119
114
|
# rubocop:disable Style/UnneededInterpolation
|
120
|
-
out = truncate("#{stdout(:
|
121
|
-
err = truncate("#{stderr(:
|
115
|
+
out = truncate("#{stdout(wait_for_io: 0).inspect}", 35)
|
116
|
+
err = truncate("#{stderr(wait_for_io: 0).inspect}", 35)
|
122
117
|
# rubocop:enable Style/UnneededInterpolation
|
123
118
|
|
124
119
|
fmt = '#<%s:%s commandline="%s": stdout=%s stderr=%s>'
|
125
|
-
format fmt, self.class,
|
120
|
+
format fmt, self.class, object_id, commandline, out, err
|
126
121
|
end
|
127
122
|
|
128
123
|
alias to_s inspect
|
129
124
|
|
130
|
-
private
|
131
|
-
|
132
125
|
def command
|
133
126
|
Shellwords.split(commandline).first
|
134
127
|
end
|
@@ -139,8 +132,11 @@ module Aruba
|
|
139
132
|
[]
|
140
133
|
end
|
141
134
|
|
135
|
+
private
|
136
|
+
|
142
137
|
def truncate(string, max_length)
|
143
138
|
return string if string.length <= max_length
|
139
|
+
|
144
140
|
string[0, max_length - 1] + ' ...'
|
145
141
|
end
|
146
142
|
end
|
@@ -18,6 +18,7 @@ module Aruba
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def start
|
21
|
+
@started = true
|
21
22
|
Dir.chdir @working_directory do
|
22
23
|
Aruba.platform.with_environment(environment) do
|
23
24
|
@exit_status = system(command, *arguments) ? 0 : 1
|
@@ -64,6 +65,10 @@ module Aruba
|
|
64
65
|
def terminate(*)
|
65
66
|
stop
|
66
67
|
end
|
68
|
+
|
69
|
+
def interactive?
|
70
|
+
true
|
71
|
+
end
|
67
72
|
end
|
68
73
|
end
|
69
74
|
end
|
@@ -33,19 +33,22 @@ module Aruba
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def exit(exitstatus)
|
36
|
-
@exitstatus =
|
36
|
+
@exitstatus =
|
37
|
+
case exitstatus
|
38
|
+
when Numeric then Integer(exitstatus)
|
39
|
+
when TrueClass then 0
|
40
|
+
when FalseClass then 1
|
41
|
+
else raise TypeError, "no implicit conversion of #{exitstatus.class} into Integer"
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
39
45
|
|
40
|
-
class << self
|
41
|
-
# @deprecated
|
42
|
-
attr_accessor :main_class
|
43
|
-
end
|
44
|
-
|
45
46
|
# @private
|
46
47
|
attr_reader :main_class
|
47
48
|
|
48
|
-
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
|
49
|
+
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
|
50
|
+
environment = Aruba.platform.environment_variables.hash_from_env,
|
51
|
+
main_class = nil, stop_signal = nil, startup_wait_time = 0)
|
49
52
|
@cmd = cmd
|
50
53
|
@argv = arguments
|
51
54
|
@stdin = StringIO.new
|
@@ -58,7 +61,9 @@ module Aruba
|
|
58
61
|
|
59
62
|
# Start command
|
60
63
|
def start
|
61
|
-
fail
|
64
|
+
fail 'You need to call aruba.config.main_class = YourMainClass' unless main_class
|
65
|
+
|
66
|
+
@started = true
|
62
67
|
|
63
68
|
Dir.chdir @working_directory do
|
64
69
|
before_run
|
@@ -120,6 +125,10 @@ module Aruba
|
|
120
125
|
def pid
|
121
126
|
$PROCESS_ID
|
122
127
|
end
|
128
|
+
|
129
|
+
def interactive?
|
130
|
+
false
|
131
|
+
end
|
123
132
|
end
|
124
133
|
end
|
125
134
|
end
|
@@ -19,24 +19,38 @@ module Aruba
|
|
19
19
|
# @private
|
20
20
|
class SpawnProcess < BasicProcess
|
21
21
|
# Use as default launcher
|
22
|
-
def self.match?(
|
22
|
+
def self.match?(_mode)
|
23
23
|
true
|
24
24
|
end
|
25
25
|
|
26
26
|
# Create process
|
27
27
|
#
|
28
|
-
# @
|
28
|
+
# @param [String] cmd
|
29
29
|
# Command string
|
30
30
|
#
|
31
|
-
# @
|
31
|
+
# @param [Numeric] exit_timeout
|
32
32
|
# The timeout until we expect the command to be finished
|
33
33
|
#
|
34
|
-
# @
|
34
|
+
# @param [Numeric] io_wait_timeout
|
35
35
|
# The timeout until we expect the io to be finished
|
36
36
|
#
|
37
|
-
# @
|
37
|
+
# @param [String] working_directory
|
38
38
|
# The directory where the command will be executed
|
39
|
-
|
39
|
+
#
|
40
|
+
# @param [Hash] environment
|
41
|
+
# Environment variables
|
42
|
+
#
|
43
|
+
# @param [Class] main_class
|
44
|
+
# E.g. Cli::App::Runner
|
45
|
+
#
|
46
|
+
# @param [String] stop_signal
|
47
|
+
# Name of signal to send to stop process. E.g. 'HUP'.
|
48
|
+
#
|
49
|
+
# @param [Numeric] startup_wait_time
|
50
|
+
# The amount of seconds to wait after Aruba has started a command.
|
51
|
+
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
|
52
|
+
environment = Aruba.platform.environment_variables.hash_from_env,
|
53
|
+
main_class = nil, stop_signal = nil, startup_wait_time = 0)
|
40
54
|
super
|
41
55
|
|
42
56
|
@process = nil
|
@@ -53,11 +67,12 @@ module Aruba
|
|
53
67
|
def start
|
54
68
|
# rubocop:disable Metrics/LineLength
|
55
69
|
fail CommandAlreadyStartedError, %(Command "#{commandline}" has already been started. Please `#stop` the command first and `#start` it again. Alternatively use `#restart`.\n#{caller.join("\n")}) if started?
|
70
|
+
|
56
71
|
# rubocop:enable Metrics/LineLength
|
57
72
|
|
58
73
|
@started = true
|
59
74
|
|
60
|
-
@process = ChildProcess.build(*
|
75
|
+
@process = ChildProcess.build(*command_string.to_a)
|
61
76
|
@stdout_file = Tempfile.new('aruba-stdout-')
|
62
77
|
@stderr_file = Tempfile.new('aruba-stderr-')
|
63
78
|
|
@@ -139,14 +154,6 @@ module Aruba
|
|
139
154
|
end
|
140
155
|
end
|
141
156
|
|
142
|
-
def read_stdout
|
143
|
-
# rubocop:disable Metrics/LineLength
|
144
|
-
Aruba.platform.deprecated('The use of "#read_stdout" is deprecated. Use "#stdout" instead. To reduce the time to wait for io, pass `:wait_for_io => 0` or some suitable for your use case')
|
145
|
-
# rubocop:enable Metrics/LineLength
|
146
|
-
|
147
|
-
stdout(:wait_for_io => 0)
|
148
|
-
end
|
149
|
-
|
150
157
|
def write(input)
|
151
158
|
return if stopped?
|
152
159
|
|
@@ -233,7 +240,7 @@ module Aruba
|
|
233
240
|
# @return [Aruba::Platforms::FilesystemStatus]
|
234
241
|
# This returns a File::Stat-object
|
235
242
|
def filesystem_status
|
236
|
-
Aruba.platform.filesystem_status.new(
|
243
|
+
Aruba.platform.filesystem_status.new(command_path)
|
237
244
|
end
|
238
245
|
|
239
246
|
# Content of command
|
@@ -242,22 +249,27 @@ module Aruba
|
|
242
249
|
# The content of the script/command. This might be binary output as
|
243
250
|
# string if your command is a binary executable.
|
244
251
|
def content
|
245
|
-
File.read
|
252
|
+
File.read command_path
|
253
|
+
end
|
254
|
+
|
255
|
+
def interactive?
|
256
|
+
true
|
246
257
|
end
|
247
258
|
|
248
259
|
private
|
249
260
|
|
250
261
|
def command_string
|
251
|
-
#
|
252
|
-
cmd = Aruba.platform.which(command, environment['PATH'])
|
262
|
+
fail LaunchError, %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".) if command_path.nil?
|
253
263
|
|
254
|
-
|
264
|
+
Aruba.platform.command_string.new(command_path, *arguments)
|
265
|
+
end
|
255
266
|
|
256
|
-
|
267
|
+
def command_path
|
268
|
+
@command_path ||= Aruba.platform.which(command, environment['PATH'])
|
257
269
|
end
|
258
270
|
|
259
|
-
def wait_for_io(time_to_wait
|
260
|
-
sleep time_to_wait
|
271
|
+
def wait_for_io(time_to_wait)
|
272
|
+
sleep time_to_wait
|
261
273
|
yield
|
262
274
|
end
|
263
275
|
|
data/lib/aruba/rspec.rb
CHANGED
@@ -5,16 +5,16 @@ require 'aruba/api'
|
|
5
5
|
require 'aruba/version'
|
6
6
|
|
7
7
|
RSpec.configure do |config|
|
8
|
-
config.include Aruba::Api, :
|
8
|
+
config.include Aruba::Api, type: :aruba
|
9
9
|
|
10
10
|
# Setup environment for aruba
|
11
11
|
config.around :each do |example|
|
12
12
|
if self.class.include? Aruba::Api
|
13
|
-
restore_env
|
14
13
|
setup_aruba
|
15
14
|
|
16
15
|
# Modify PATH to include project/bin
|
17
|
-
prepend_environment_variable 'PATH',
|
16
|
+
prepend_environment_variable 'PATH',
|
17
|
+
aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
|
18
18
|
|
19
19
|
# Use configured home directory as HOME
|
20
20
|
set_environment_variable 'HOME', aruba.config.home_directory
|
@@ -23,18 +23,17 @@ RSpec.configure do |config|
|
|
23
23
|
example.run
|
24
24
|
|
25
25
|
next unless self.class.include? Aruba::Api
|
26
|
+
|
26
27
|
stop_all_commands
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
with_environment do
|
33
|
-
example.run
|
34
|
-
end
|
35
|
-
else
|
30
|
+
config.around :each do |example|
|
31
|
+
if self.class.include? Aruba::Api
|
32
|
+
with_environment do
|
36
33
|
example.run
|
37
34
|
end
|
35
|
+
else
|
36
|
+
example.run
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
@@ -48,21 +47,9 @@ RSpec.configure do |config|
|
|
48
47
|
config.before :each do |example|
|
49
48
|
next unless self.class.include?(Aruba::Api)
|
50
49
|
|
51
|
-
if example.metadata[:announce_environment]
|
52
|
-
Aruba.platform.deprecated 'announce_environment is deprecated. Use announce_changed_environment instead'
|
53
|
-
|
54
|
-
aruba.announcer.activate(:changed_environment)
|
55
|
-
end
|
56
|
-
|
57
50
|
aruba.announcer.activate(:full_environment) if example.metadata[:announce_full_environment]
|
58
51
|
aruba.announcer.activate(:changed_environment) if example.metadata[:announce_changed_environment]
|
59
52
|
|
60
|
-
if example.metadata[:announce_modified_environment]
|
61
|
-
Aruba.platform.deprecated 'announce_modified_environment is deprecated. Use announce_changed_environment instead'
|
62
|
-
|
63
|
-
aruba.announcer.activate(:changed_environment)
|
64
|
-
end
|
65
|
-
|
66
53
|
aruba.announcer.activate(:command) if example.metadata[:announce_command]
|
67
54
|
aruba.announcer.activate(:directory) if example.metadata[:announce_directory]
|
68
55
|
aruba.announcer.activate(:full_environment) if example.metadata[:announce_full_environment]
|
data/lib/aruba/runtime.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'aruba/
|
1
|
+
require 'aruba/configuration'
|
2
2
|
require 'aruba/aruba_path'
|
3
3
|
require 'aruba/config_wrapper'
|
4
4
|
require 'aruba/events'
|
@@ -49,7 +49,7 @@ module Aruba
|
|
49
49
|
|
50
50
|
@environment.update(@config.command_runtime_environment)
|
51
51
|
|
52
|
-
@command_monitor = opts.fetch(:command_monitor, Aruba.platform.command_monitor.new(:
|
52
|
+
@command_monitor = opts.fetch(:command_monitor, Aruba.platform.command_monitor.new(announcer: @announcer))
|
53
53
|
|
54
54
|
@logger = opts.fetch(:logger, Aruba.platform.logger.new)
|
55
55
|
@logger.mode = @config.log_level
|
@@ -77,11 +77,13 @@ module Aruba
|
|
77
77
|
# @return [ArubaPath]
|
78
78
|
# The directory to where your fixtures are stored
|
79
79
|
def fixtures_directory
|
80
|
-
|
80
|
+
@fixtures_directory ||= begin
|
81
81
|
candidates = config.fixtures_directories.map { |dir| File.join(root_directory, dir) }
|
82
|
-
|
82
|
+
directory = candidates.find { |d| Aruba.platform.directory? d }
|
83
83
|
|
84
|
-
fail "No existing fixtures directory found in #{candidates.map { |d| format('"%s"', d) }.join(', ')}.
|
84
|
+
fail "No existing fixtures directory found in #{candidates.map { |d| format('"%s"', d) }.join(', ')}." unless directory
|
85
|
+
|
86
|
+
directory
|
85
87
|
end
|
86
88
|
|
87
89
|
fail %(Fixtures directory "#{@fixtures_directory}" is not a directory) unless Aruba.platform.directory?(@fixtures_directory)
|