aruba 1.0.0.pre.alpha.2 → 1.0.0.pre.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/bin/bootstrap
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
set -e
|
4
|
-
|
5
|
-
info_msg="\e[0;32m[INFO]\e[39;49m"
|
6
|
-
error_msg="\e[0;31mFAILED\e[39;49m"
|
7
|
-
|
8
|
-
# TODO: these are Unix specific
|
9
|
-
TMPDIR="${TMPDIR:=/tmp}"
|
10
|
-
logfile=`mktemp -t aruba_tests.XXXXXXXXXX`
|
11
|
-
|
12
|
-
output_error_log() {
|
13
|
-
[[ -f "$logfile" ]] && ( cat "logfile" >&2; rm -f "$logfile")
|
14
|
-
}
|
15
|
-
|
16
|
-
check_for_binary() {
|
17
|
-
name="$1"
|
18
|
-
|
19
|
-
echo -ne "$info_msg Checking if $name installed? "
|
20
|
-
which "$name" >/dev/null 2>"$logfile" || ( echo -e "$error_msg\n\nCould not find \`$name\`. Please install $name or add it to PATH"; output_error_log; exit 1 )
|
21
|
-
echo OK
|
22
|
-
}
|
23
|
-
|
24
|
-
check_for_binary "ruby"
|
25
|
-
# check_for_binary "bash"
|
26
|
-
# check_for_binary "zsh"
|
27
|
-
# check_for_binary "python"
|
28
|
-
# check_for_binary "javac"
|
29
|
-
|
30
|
-
echo -e "$info_msg rubygem \"bundler\" "
|
31
|
-
gem install bundler
|
32
|
-
|
33
|
-
echo -e "$info_msg \"bundle install\" "
|
34
|
-
bundle install $*
|
data/lib/aruba/api/command.rb
DELETED
@@ -1,309 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
require 'aruba/platform'
|
4
|
-
require 'aruba/command'
|
5
|
-
|
6
|
-
# require 'win32/file' if File::ALT_SEPARATOR
|
7
|
-
|
8
|
-
# Aruba
|
9
|
-
module Aruba
|
10
|
-
class << self
|
11
|
-
# @deprecated
|
12
|
-
attr_accessor :process
|
13
|
-
end
|
14
|
-
|
15
|
-
# @deprecated
|
16
|
-
# self.process = Aruba::Processes::SpawnProcess
|
17
|
-
end
|
18
|
-
|
19
|
-
# Aruba
|
20
|
-
module Aruba
|
21
|
-
# Api
|
22
|
-
module Api
|
23
|
-
# Command module
|
24
|
-
module Commands
|
25
|
-
# Resolve path for command using the PATH-environment variable
|
26
|
-
#
|
27
|
-
# @param [#to_s] program
|
28
|
-
# The name of the program which should be resolved
|
29
|
-
#
|
30
|
-
# @param [String] path
|
31
|
-
# The PATH, a string concatenated with ":", e.g. /usr/bin/:/bin on a
|
32
|
-
# UNIX-system
|
33
|
-
def which(program, path = nil)
|
34
|
-
with_environment do
|
35
|
-
# ENV is set within this block
|
36
|
-
path = ENV['PATH'] if path.nil?
|
37
|
-
|
38
|
-
Aruba.platform.which(program, path)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Pipe data in file
|
43
|
-
#
|
44
|
-
# @param [String] file_name
|
45
|
-
# The file which should be used to pipe in data
|
46
|
-
def pipe_in_file(file_name)
|
47
|
-
file_name = expand_path(file_name)
|
48
|
-
|
49
|
-
File.open(file_name, 'r').each_line do |line|
|
50
|
-
last_command_started.write(line)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Return all commands
|
55
|
-
#
|
56
|
-
# @return [Array]
|
57
|
-
# List of commands
|
58
|
-
def all_commands
|
59
|
-
aruba.command_monitor.registered_commands
|
60
|
-
end
|
61
|
-
|
62
|
-
# Last command started
|
63
|
-
def last_command_started
|
64
|
-
aruba.command_monitor.last_command_started
|
65
|
-
end
|
66
|
-
|
67
|
-
# Last command stopped
|
68
|
-
def last_command_stopped
|
69
|
-
aruba.command_monitor.last_command_stopped
|
70
|
-
end
|
71
|
-
|
72
|
-
# Stop all commands
|
73
|
-
#
|
74
|
-
# @yield [Command]
|
75
|
-
# If block is given use it to filter the commands which should be
|
76
|
-
# stoppend.
|
77
|
-
def stop_all_commands(&block)
|
78
|
-
cmds = if block_given?
|
79
|
-
all_commands.select(&block)
|
80
|
-
else
|
81
|
-
all_commands
|
82
|
-
end
|
83
|
-
|
84
|
-
cmds.each(&:stop)
|
85
|
-
|
86
|
-
self
|
87
|
-
end
|
88
|
-
|
89
|
-
# Terminate all commands
|
90
|
-
#
|
91
|
-
# @yield [Command]
|
92
|
-
# If block is given use it to filter the commands which should be
|
93
|
-
# terminated.
|
94
|
-
def terminate_all_commands(&block)
|
95
|
-
cmds = if block_given?
|
96
|
-
all_commands.select(&block)
|
97
|
-
else
|
98
|
-
all_commands
|
99
|
-
end
|
100
|
-
|
101
|
-
cmds.each(&:terminate)
|
102
|
-
|
103
|
-
self
|
104
|
-
end
|
105
|
-
|
106
|
-
# Find a started command
|
107
|
-
#
|
108
|
-
# @param [String, Command] commandline
|
109
|
-
# The commandline
|
110
|
-
def find_command(commandline)
|
111
|
-
aruba.command_monitor.find(commandline)
|
112
|
-
end
|
113
|
-
|
114
|
-
# Run given command and stop it if timeout is reached
|
115
|
-
#
|
116
|
-
# @param [String] cmd
|
117
|
-
# The command which should be executed
|
118
|
-
#
|
119
|
-
# @param [Hash] opts
|
120
|
-
# Options
|
121
|
-
#
|
122
|
-
# @option [Integer] exit_timeout
|
123
|
-
# If the timeout is reached the command will be killed
|
124
|
-
#
|
125
|
-
# @option [Integer] io_wait_timeout
|
126
|
-
# Wait for IO to finish
|
127
|
-
#
|
128
|
-
# @option [Integer] startup_wait_time
|
129
|
-
# Wait for a command to start
|
130
|
-
#
|
131
|
-
# @option [String] stop_signal
|
132
|
-
# Use signal to stop command
|
133
|
-
#
|
134
|
-
# @yield [SpawnProcess]
|
135
|
-
# Run block with process
|
136
|
-
#
|
137
|
-
# rubocop:disable Metrics/MethodLength
|
138
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
139
|
-
def run_command(*args)
|
140
|
-
fail ArgumentError, 'Please pass at least a command as first argument.' if args.empty?
|
141
|
-
|
142
|
-
cmd = args.shift
|
143
|
-
|
144
|
-
if args.last.is_a? Hash
|
145
|
-
opts = args.pop
|
146
|
-
|
147
|
-
exit_timeout = opts[:exit_timeout].nil? ? aruba.config.exit_timeout : opts[:exit_timeout]
|
148
|
-
io_wait_timeout = opts[:io_wait_timeout].nil? ? aruba.config.io_wait_timeout : opts[:io_wait_timeout]
|
149
|
-
stop_signal = opts[:stop_signal].nil? ? aruba.config.stop_signal : opts[:stop_signal]
|
150
|
-
startup_wait_time = opts[:startup_wait_time].nil? ? aruba.config.startup_wait_time : opts[:startup_wait_time]
|
151
|
-
else
|
152
|
-
if args.size > 1
|
153
|
-
# rubocop:disable Metrics/LineLength
|
154
|
-
Aruba.platform.deprecated("Please pass options to `#run` as named parameters/hash and don\'t use the old style, e.g. `#run_command('cmd', :exit_timeout => 5)`.")
|
155
|
-
# rubocop:enable Metrics/LineLength
|
156
|
-
end
|
157
|
-
|
158
|
-
exit_timeout = args[0].nil? ? aruba.config.exit_timeout : args[0]
|
159
|
-
io_wait_timeout = args[1].nil? ? aruba.config.io_wait_timeout : args[1]
|
160
|
-
stop_signal = args[2].nil? ? aruba.config.stop_signal : args[2]
|
161
|
-
startup_wait_time = args[3].nil? ? aruba.config.startup_wait_time : args[3]
|
162
|
-
end
|
163
|
-
|
164
|
-
cmd = replace_variables(cmd)
|
165
|
-
|
166
|
-
@commands ||= []
|
167
|
-
@commands << cmd
|
168
|
-
|
169
|
-
environment = aruba.environment
|
170
|
-
working_directory = expand_path('.')
|
171
|
-
event_bus = aruba.event_bus
|
172
|
-
|
173
|
-
cmd = Aruba.platform.detect_ruby(cmd)
|
174
|
-
|
175
|
-
mode = if Aruba.process
|
176
|
-
# rubocop:disable Metrics/LineLength
|
177
|
-
Aruba.platform.deprecated('The use of "Aruba.process = <process>" and "Aruba.process.main_class" is deprecated. Use "Aruba.configure { |config| config.command_launcher = :in_process|:debug|:spawn }" and "Aruba.configure { |config| config.main_class = <klass> }" instead.')
|
178
|
-
# rubocop:enable Metrics/LineLength
|
179
|
-
Aruba.process
|
180
|
-
else
|
181
|
-
aruba.config.command_launcher
|
182
|
-
end
|
183
|
-
|
184
|
-
main_class = if Aruba.process.respond_to?(:main_class) && Aruba.process.main_class
|
185
|
-
# rubocop:disable Metrics/LineLength
|
186
|
-
Aruba.platform.deprecated('The use of "Aruba.process = <process>" and "Aruba.process.main_class" is deprecated. Use "Aruba.configure { |config| config.command_launcher = :in_process|:debug|:spawn }" and "Aruba.configure { |config| config.main_class = <klass> }" instead.')
|
187
|
-
# rubocop:enable Metrics/LineLength
|
188
|
-
Aruba.process.main_class
|
189
|
-
else
|
190
|
-
aruba.config.main_class
|
191
|
-
end
|
192
|
-
|
193
|
-
command = Command.new(
|
194
|
-
cmd,
|
195
|
-
:mode => mode,
|
196
|
-
:exit_timeout => exit_timeout,
|
197
|
-
:io_wait_timeout => io_wait_timeout,
|
198
|
-
:working_directory => working_directory,
|
199
|
-
:environment => environment.to_hash,
|
200
|
-
:main_class => main_class,
|
201
|
-
:stop_signal => stop_signal,
|
202
|
-
:startup_wait_time => startup_wait_time,
|
203
|
-
:event_bus => event_bus
|
204
|
-
)
|
205
|
-
|
206
|
-
if aruba.config.before? :cmd
|
207
|
-
# rubocop:disable Metrics/LineLength
|
208
|
-
Aruba.platform.deprecated('The use of "before"-hook" ":cmd" is deprecated. Use ":command" instead. Please be aware that this hook gets the command passed in not the cmdline itself. To get the commandline use "#cmd.commandline"')
|
209
|
-
# rubocop:enable Metrics/LineLength
|
210
|
-
aruba.config.before(:cmd, self, cmd)
|
211
|
-
end
|
212
|
-
|
213
|
-
aruba.config.before(:command, self, command)
|
214
|
-
|
215
|
-
command.start
|
216
|
-
|
217
|
-
aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal
|
218
|
-
|
219
|
-
aruba.config.after(:command, self, command)
|
220
|
-
|
221
|
-
block_given? ? yield(command) : command
|
222
|
-
end
|
223
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
224
|
-
# rubocop:enable Metrics/MethodLength
|
225
|
-
|
226
|
-
# Run a command with aruba
|
227
|
-
#
|
228
|
-
# Checks for error during command execution and checks the output to detect
|
229
|
-
# an timeout error.
|
230
|
-
#
|
231
|
-
# @param [String] cmd
|
232
|
-
# The command to be executed
|
233
|
-
#
|
234
|
-
# @param [Hash] options
|
235
|
-
# Options for aruba
|
236
|
-
#
|
237
|
-
# @option [TrueClass,FalseClass] fail_on_error
|
238
|
-
# Should aruba fail on error?
|
239
|
-
#
|
240
|
-
# @option [Integer] exit_timeout
|
241
|
-
# Timeout for execution
|
242
|
-
#
|
243
|
-
# @option [Integer] io_wait_timeout
|
244
|
-
# Timeout for IO - STDERR, STDOUT
|
245
|
-
#
|
246
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
247
|
-
# rubocop:disable Metrics/MethodLength
|
248
|
-
def run_command_and_stop(*args)
|
249
|
-
fail ArgumentError, 'Please pass at least a command as first argument.' if args.empty?
|
250
|
-
|
251
|
-
cmd = args.shift
|
252
|
-
|
253
|
-
if args.last.is_a? Hash
|
254
|
-
opts = args.pop
|
255
|
-
fail_on_error = opts.delete(:fail_on_error) == true ? true : false
|
256
|
-
else
|
257
|
-
if args.size > 1
|
258
|
-
# rubocop:disable Metrics/LineLength
|
259
|
-
Aruba.platform.deprecated("Please pass options to `#run_command_and_stop` as named parameters/hash and don\'t use the old style with positional parameters, NEW: e.g. `#run_command_and_stop('cmd', :exit_timeout => 5)`.")
|
260
|
-
# rubocop:enable Metrics/LineLength
|
261
|
-
end
|
262
|
-
|
263
|
-
fail_on_error = args[0] == false ? false : true
|
264
|
-
|
265
|
-
opts = {
|
266
|
-
:exit_timeout => (args[1] || aruba.config.exit_timeout),
|
267
|
-
:io_wait_timeout => (args[2] || aruba.config.io_wait_timeout),
|
268
|
-
:stop_signal => (args[3] || aruba.config.stop_signal),
|
269
|
-
:startup_wait_time => (args[4] || aruba.config.startup_wait_time)
|
270
|
-
}
|
271
|
-
end
|
272
|
-
|
273
|
-
command = run_command(cmd, opts)
|
274
|
-
command.stop
|
275
|
-
|
276
|
-
if Aruba::VERSION < '1'
|
277
|
-
@last_exit_status = command.exit_status
|
278
|
-
@timed_out = command.timed_out?
|
279
|
-
end
|
280
|
-
|
281
|
-
if fail_on_error
|
282
|
-
begin
|
283
|
-
expect(command).to have_finished_in_time
|
284
|
-
expect(command).to be_successfully_executed
|
285
|
-
rescue ::RSpec::Expectations::ExpectationNotMetError => e
|
286
|
-
aruba.announcer.activate(aruba.config.activate_announcer_on_command_failure)
|
287
|
-
raise e
|
288
|
-
end
|
289
|
-
end
|
290
|
-
end
|
291
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
292
|
-
# rubocop:enable Metrics/MethodLength
|
293
|
-
|
294
|
-
# Provide data to command via stdin
|
295
|
-
#
|
296
|
-
# @param [String] input
|
297
|
-
# The input for the command
|
298
|
-
def type(input)
|
299
|
-
return close_input if "" == input
|
300
|
-
last_command_started.write(input << "\n")
|
301
|
-
end
|
302
|
-
|
303
|
-
# Close stdin
|
304
|
-
def close_input
|
305
|
-
last_command_started.close_io(:stdin)
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
data/lib/aruba/api/deprecated.rb
DELETED
@@ -1,895 +0,0 @@
|
|
1
|
-
require 'aruba/platforms/announcer'
|
2
|
-
|
3
|
-
# Aruba
|
4
|
-
module Aruba
|
5
|
-
# Api
|
6
|
-
module Api
|
7
|
-
# Deprecated
|
8
|
-
module Deprecated
|
9
|
-
# @deprecated
|
10
|
-
# The path to the directory which should contain all your test data
|
11
|
-
# You might want to overwrite this method to place your data else where.
|
12
|
-
#
|
13
|
-
# @return [Array]
|
14
|
-
# The directory path: Each subdirectory is a member of an array
|
15
|
-
def dirs
|
16
|
-
Aruba.platform.deprecated('The use of "@dirs" is deprecated. Use "Aruba.configure { |c| c.current_directory = \'path/to/dir\' }" instead to set the "current_directory') if defined? @dirs
|
17
|
-
Aruba.platform.deprecated('The use of "dirs" deprecated. Use "Aruba.configure { |c| c.current_directory = \'path/to/dir\' }" instead to set the "current_directory and "expand_path(".")" to get the current directory or use "#cd(\'.\') { # your code }" to run code in the current directory')
|
18
|
-
|
19
|
-
@dirs ||= aruba.current_directory
|
20
|
-
end
|
21
|
-
|
22
|
-
# @deprecated
|
23
|
-
# Get access to current dir
|
24
|
-
#
|
25
|
-
# @return
|
26
|
-
# Current directory
|
27
|
-
def current_directory
|
28
|
-
Aruba.platform.deprecated(%(The use of "current_directory" deprecated. Use "expand_path(".")" to get the current directory or "#cd" to run code in the current directory. #{caller.first}))
|
29
|
-
|
30
|
-
aruba.current_directory.to_s
|
31
|
-
end
|
32
|
-
|
33
|
-
# @deprecated
|
34
|
-
# Clean the current directory
|
35
|
-
def clean_current_directory
|
36
|
-
Aruba.platform.deprecated('The use of "clean_current_directory" is deprecated. Either use "#setup_aruba" or `#remove(\'.\') to clean up aruba\'s working directory before your tests are run')
|
37
|
-
|
38
|
-
setup_aruba
|
39
|
-
end
|
40
|
-
|
41
|
-
# @deprecated
|
42
|
-
# Execute block in current directory
|
43
|
-
#
|
44
|
-
# @yield
|
45
|
-
# The block which should be run in current directory
|
46
|
-
def in_current_directory(&block)
|
47
|
-
Aruba.platform.deprecated('The use of "in_current_directory" deprecated. Use "#cd(\'.\') { # your code }" instead. But be aware, `cd` requires a previously created directory')
|
48
|
-
|
49
|
-
create_directory '.' unless directory?('.')
|
50
|
-
cd('.', &block)
|
51
|
-
end
|
52
|
-
|
53
|
-
# @deprecated
|
54
|
-
def detect_ruby(cmd)
|
55
|
-
Aruba.platform.deprecated('The use of "#detect_ruby" is deprecated')
|
56
|
-
|
57
|
-
Aruba.platform.detect_ruby cmd
|
58
|
-
end
|
59
|
-
|
60
|
-
# @deprecated
|
61
|
-
def current_ruby
|
62
|
-
Aruba.platform.deprecated('The use of "#current_ruby" is deprecated')
|
63
|
-
|
64
|
-
Aruba.platform.current_ruby cmd
|
65
|
-
end
|
66
|
-
|
67
|
-
# @deprecated
|
68
|
-
def _ensure_newline(str)
|
69
|
-
Aruba.platform.deprecated('The use of "#_ensure_newline" is deprecated')
|
70
|
-
|
71
|
-
Aruba.platform.ensure_newline cmd
|
72
|
-
end
|
73
|
-
|
74
|
-
# @deprecated
|
75
|
-
def absolute_path(*args)
|
76
|
-
Aruba.platform.deprecated('The use of "absolute_path" is deprecated. Use "expand_path" instead. But be aware that "expand_path" uses a different implementation')
|
77
|
-
|
78
|
-
File.expand_path File.join(*args), aruba.current_directory
|
79
|
-
end
|
80
|
-
|
81
|
-
# @deprecated
|
82
|
-
def _read_interactive
|
83
|
-
Aruba.platform.deprecated('The use of "#_read_interactive" is deprecated. Please use "last_command_started.stdout" instead')
|
84
|
-
|
85
|
-
last_command_started.stdout
|
86
|
-
end
|
87
|
-
|
88
|
-
# @deprecated
|
89
|
-
def announce_or_puts(msg)
|
90
|
-
Aruba.platform.deprecated('The use of "#announce_or_puts" is deprecated. Please use "#announcer.mode = :kernel" or "#announcer.mode = :puts" instead')
|
91
|
-
|
92
|
-
if(@puts)
|
93
|
-
Kernel.puts(msg)
|
94
|
-
else
|
95
|
-
puts(msg)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
# @deprecated
|
100
|
-
def _write_interactive(input)
|
101
|
-
Aruba.platform.deprecated('The use of "#_write_interactive" is deprecated. Please use "#last_command_started.write()" instead')
|
102
|
-
|
103
|
-
last_command_started.write(input)
|
104
|
-
end
|
105
|
-
|
106
|
-
# @deprecated
|
107
|
-
def eot
|
108
|
-
Aruba.platform.deprecated(%{\e[35m The \"#eot\"-method is deprecated. It will be deleted with the next major version. Please use \"#close_input\"-method instead.\e[0m})
|
109
|
-
|
110
|
-
close_input
|
111
|
-
end
|
112
|
-
|
113
|
-
# Run a command interactively
|
114
|
-
#
|
115
|
-
# @param [String] cmd
|
116
|
-
# The command to by run
|
117
|
-
#
|
118
|
-
# @see #cmd
|
119
|
-
# @deprectated
|
120
|
-
def run_interactive(cmd)
|
121
|
-
Aruba.platform.deprecated('The use of "#run_interactive" is deprecated. You can simply use "run" instead')
|
122
|
-
|
123
|
-
run_command(cmd)
|
124
|
-
end
|
125
|
-
|
126
|
-
# @deprecated
|
127
|
-
# Create an empty file
|
128
|
-
#
|
129
|
-
# @param [String] file_name
|
130
|
-
# The name of the file
|
131
|
-
def touch_file(*args)
|
132
|
-
Aruba.platform.deprecated('The use of "#touch_file" is deprecated. Use "#touch" instead')
|
133
|
-
|
134
|
-
touch(*args)
|
135
|
-
end
|
136
|
-
|
137
|
-
# @deprecated
|
138
|
-
def mod?(file, perms, &block)
|
139
|
-
Aruba.platform.deprecated('The use of "#mod?" is deprecated. Use "expect().to have_permissions()" instead')
|
140
|
-
|
141
|
-
expect(Array(file)).to Aruba::Matchers.all have_permissions(perms)
|
142
|
-
end
|
143
|
-
|
144
|
-
# @deprecated
|
145
|
-
# Remove file
|
146
|
-
#
|
147
|
-
# @param [String] file_name
|
148
|
-
# The file which should be deleted in current directory
|
149
|
-
def remove_file(*args)
|
150
|
-
Aruba.platform.deprecated('The use of "#remove_file" is deprecated. Use "#remove" instead')
|
151
|
-
|
152
|
-
remove(*args)
|
153
|
-
end
|
154
|
-
|
155
|
-
# @deprecated
|
156
|
-
def create_dir(*args)
|
157
|
-
Aruba.platform.deprecated('The use of "#create_dir" is deprecated. Use "#create_directory" instead')
|
158
|
-
create_directory(*args)
|
159
|
-
end
|
160
|
-
|
161
|
-
# @deprecated
|
162
|
-
# Remove directory
|
163
|
-
#
|
164
|
-
# @param [String] directory_name
|
165
|
-
# The name of the directory which should be removed
|
166
|
-
def remove_directory(*args)
|
167
|
-
Aruba.platform.deprecated('The use of "remove_directory" is deprecated. Use "remove" instead')
|
168
|
-
remove(*args)
|
169
|
-
end
|
170
|
-
|
171
|
-
# @deprecated
|
172
|
-
def remove_dir(*args)
|
173
|
-
Aruba.platform.deprecated('The use of "remove_dir" is deprecated. Use "remove" instead')
|
174
|
-
remove(*args)
|
175
|
-
end
|
176
|
-
|
177
|
-
# @deprecated
|
178
|
-
#
|
179
|
-
# Check if paths are present
|
180
|
-
#
|
181
|
-
# @param [#each] paths
|
182
|
-
# The paths which should be checked
|
183
|
-
#
|
184
|
-
# @param [true,false] expect_presence
|
185
|
-
# Should the given paths be present (true) or absent (false)
|
186
|
-
def check_file_presence(paths, expect_presence = true)
|
187
|
-
Aruba.platform.deprecated('The use of "check_file_presence" is deprecated. Use "expect().to be_an_existing_file" or "expect(all_paths).to all match /pattern/" instead')
|
188
|
-
|
189
|
-
stop_all_commands
|
190
|
-
|
191
|
-
Array(paths).each do |path|
|
192
|
-
if path.kind_of? Regexp
|
193
|
-
if expect_presence
|
194
|
-
expect(all_paths).to match_path_pattern(path)
|
195
|
-
else
|
196
|
-
expect(all_paths).not_to match_path_pattern(path)
|
197
|
-
end
|
198
|
-
else
|
199
|
-
if expect_presence
|
200
|
-
expect(path).to be_an_existing_file
|
201
|
-
else
|
202
|
-
expect(path).not_to be_an_existing_file
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
# @deprecated
|
209
|
-
# Check the file size of paths
|
210
|
-
#
|
211
|
-
# @params [Hash] paths_and_sizes
|
212
|
-
# A hash containing the path (key) and the expected size (value)
|
213
|
-
#
|
214
|
-
# @example
|
215
|
-
#
|
216
|
-
# paths_and_sizes = {
|
217
|
-
# 'file' => 10
|
218
|
-
# }
|
219
|
-
#
|
220
|
-
# check_file_size(paths_and_sizes)
|
221
|
-
#
|
222
|
-
def check_file_size(paths_and_sizes)
|
223
|
-
Aruba.platform.deprecated('The use of "#check_file_size" is deprecated. Use "expect(file).to have_file_size(size)", "expect(all_files).to all have_file_size(1)", "expect(all_files).to include a_file_with_size(1)" instead')
|
224
|
-
|
225
|
-
stop_all_commands
|
226
|
-
|
227
|
-
paths_and_sizes.each do |path, size|
|
228
|
-
expect(path).to have_file_size size
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
# @deprecated
|
233
|
-
def check_exact_file_content(file, exact_content, expect_match = true)
|
234
|
-
Aruba.platform.deprecated('The use of "#check_exact_file_content" is deprecated. Use "expect(file).to have_file_content(content)" with a string')
|
235
|
-
|
236
|
-
check_file_content(file, exact_content, expect_match)
|
237
|
-
end
|
238
|
-
|
239
|
-
# @deprecated
|
240
|
-
# Check if the content of file against the content of a reference file
|
241
|
-
#
|
242
|
-
# @param [String] file
|
243
|
-
# The file to be checked
|
244
|
-
#
|
245
|
-
# @param [String] reference_file
|
246
|
-
# The reference file
|
247
|
-
#
|
248
|
-
# @param [true, false] expect_match
|
249
|
-
# Must the content be in the file or not
|
250
|
-
def check_binary_file_content(file, reference_file, expect_match = true)
|
251
|
-
Aruba.platform.deprecated('The use of "#check_binary_file_content" is deprecated. Use "expect(file).to have_same_file_content_like(file)"')
|
252
|
-
|
253
|
-
stop_all_commands
|
254
|
-
|
255
|
-
if expect_match
|
256
|
-
expect(file).to have_same_file_content_like reference_file
|
257
|
-
else
|
258
|
-
expect(file).not_to have_same_file_content_like reference_file
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
# @deprecated
|
263
|
-
# Check presence of a directory
|
264
|
-
#
|
265
|
-
# @param [Array] paths
|
266
|
-
# The paths to be checked
|
267
|
-
#
|
268
|
-
# @param [true, false] expect_presence
|
269
|
-
# Should the directory be there or should the directory not be there
|
270
|
-
def check_directory_presence(paths, expect_presence)
|
271
|
-
Aruba.platform.deprecated('The use of "#check_directory_presence" is deprecated. Use "expect(directory).to be_an_existing_directory"')
|
272
|
-
|
273
|
-
stop_all_commands
|
274
|
-
|
275
|
-
paths.each do |path|
|
276
|
-
path = expand_path(path)
|
277
|
-
|
278
|
-
if expect_presence
|
279
|
-
expect(path).to be_an_existing_directory
|
280
|
-
else
|
281
|
-
expect(path).not_to be_an_existing_directory
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
# @deprecated
|
287
|
-
def prep_for_fs_check(&block)
|
288
|
-
Aruba.platform.deprecated('The use of "prep_for_fs_check" is deprecated. Use apropriate methods and the new rspec matchers instead')
|
289
|
-
|
290
|
-
stop_all_commands
|
291
|
-
|
292
|
-
cd('') { yield }
|
293
|
-
end
|
294
|
-
|
295
|
-
# @deprecated
|
296
|
-
def assert_exit_status_and_partial_output(expect_to_pass, expected)
|
297
|
-
Aruba.platform.deprecated('The use of "assert_exit_status_and_partial_output" is deprecated. Use "#assert_access" and "#assert_partial_output" instead')
|
298
|
-
|
299
|
-
assert_success(expect_to_pass)
|
300
|
-
assert_partial_output(expected, all_output)
|
301
|
-
end
|
302
|
-
|
303
|
-
# TODO: Remove this. Call more methods elsewhere instead. Reveals more intent.
|
304
|
-
# @deprecated
|
305
|
-
def assert_exit_status_and_output(expect_to_pass, expected_output, expect_exact_output)
|
306
|
-
assert_success(expect_to_pass)
|
307
|
-
if expect_exact_output
|
308
|
-
assert_exact_output(expected_output, all_output)
|
309
|
-
else
|
310
|
-
assert_partial_output(expected_output, all_output)
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
# Check the content of file
|
315
|
-
#
|
316
|
-
# It supports partial content as well. And it is up to you to decided if
|
317
|
-
# the content must be there or not.
|
318
|
-
#
|
319
|
-
# @param [String] file
|
320
|
-
# The file to be checked
|
321
|
-
#
|
322
|
-
# @param [String, Regexp] content
|
323
|
-
# The content which must/must not be in the file. If content is
|
324
|
-
# a String exact match is done, if content is a Regexp then file
|
325
|
-
# is matched using regular expression
|
326
|
-
#
|
327
|
-
# @param [true, false] expect_match
|
328
|
-
# Must the content be in the file or not
|
329
|
-
def check_file_content(file, content, expect_match = true)
|
330
|
-
Aruba.platform.deprecated('The use of "#check_file_content" is deprecated. Use "expect(file).to have_file_content(content)" instead. For eq match use string, for partial match use /regex/')
|
331
|
-
|
332
|
-
stop_all_commands
|
333
|
-
|
334
|
-
if expect_match
|
335
|
-
expect(file).to have_file_content content
|
336
|
-
else
|
337
|
-
expect(file).not_to have_file_content content
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
# @deprecated
|
342
|
-
def _mkdir(dir_name)
|
343
|
-
Aruba.platform.deprecated('The use of "#_mkdir" is deprecated')
|
344
|
-
|
345
|
-
Aruba.platform.mkdir(dir_name)
|
346
|
-
end
|
347
|
-
|
348
|
-
# @deprecated
|
349
|
-
def _rm(dir_name)
|
350
|
-
Aruba.platform.deprecated('The use of "#_rm_rf" is deprecated')
|
351
|
-
|
352
|
-
Aruba.platform.rm(dir_name)
|
353
|
-
end
|
354
|
-
|
355
|
-
# @deprecated
|
356
|
-
def current_dir(*args, &block)
|
357
|
-
Aruba.platform.deprecated('The use of "#current_dir" is deprecated. Use "#current_directory" instead')
|
358
|
-
|
359
|
-
current_directory(*args, &block)
|
360
|
-
end
|
361
|
-
|
362
|
-
# @deprecated
|
363
|
-
def clean_current_dir(*args, &block)
|
364
|
-
Aruba.platform.deprecated('The use of "clean_current_dir" is deprecated. Either use "#setup_aruba" or `#remove(\'.\') to clean up aruba\'s working directory before your tests are run')
|
365
|
-
|
366
|
-
setup_aruba
|
367
|
-
end
|
368
|
-
|
369
|
-
# @deprecated
|
370
|
-
def in_current_dir(&block)
|
371
|
-
Aruba.platform.deprecated('The use of "in_current_dir" is deprecated. Use "#cd(\'.\') { }" instead')
|
372
|
-
|
373
|
-
create_directory '.' unless directory?('.')
|
374
|
-
cd('.', &block)
|
375
|
-
end
|
376
|
-
|
377
|
-
# @deprecated
|
378
|
-
# Run block with environment
|
379
|
-
#
|
380
|
-
# @param [Hash] env
|
381
|
-
# The variables to be used for block.
|
382
|
-
#
|
383
|
-
# @yield
|
384
|
-
# The block of code which should be run with the changed environment variables
|
385
|
-
def with_env(env = {}, &block)
|
386
|
-
Aruba.platform.deprecated('The use of "#with_env" is deprecated. Use "#with_environment {}" instead. But be careful this uses a different implementation')
|
387
|
-
|
388
|
-
env.each do |k,v|
|
389
|
-
set_env k, v
|
390
|
-
end
|
391
|
-
yield
|
392
|
-
restore_env
|
393
|
-
end
|
394
|
-
|
395
|
-
# @deprecated
|
396
|
-
# Restore original process environment
|
397
|
-
def restore_env
|
398
|
-
# No output because we need to reset env on each scenario/spec run
|
399
|
-
# Aruba.platform.deprecated('The use of "#restore_env" is deprecated. If you use "set_environment_variable" there\'s no need to restore the environment')
|
400
|
-
#
|
401
|
-
original_env.each do |key, value|
|
402
|
-
if value
|
403
|
-
ENV[key] = value
|
404
|
-
aruba.environment[key] = value
|
405
|
-
else
|
406
|
-
aruba.environment.delete key
|
407
|
-
ENV.delete key
|
408
|
-
end
|
409
|
-
end
|
410
|
-
end
|
411
|
-
|
412
|
-
# @deprecated
|
413
|
-
# Set environment variable
|
414
|
-
#
|
415
|
-
# @param [String] key
|
416
|
-
# The name of the environment variable as string, e.g. 'HOME'
|
417
|
-
#
|
418
|
-
# @param [String] value
|
419
|
-
# The value of the environment variable. Needs to be a string.
|
420
|
-
def set_env(key, value)
|
421
|
-
Aruba.platform.deprecated('The use of "#set_env" is deprecated. Please use "set_environment_variable" instead. But be careful, this method uses a different kind of implementation')
|
422
|
-
|
423
|
-
aruba.announcer.announce(:environment, key, value)
|
424
|
-
set_environment_variable key, value
|
425
|
-
|
426
|
-
original_env[key] = ENV.delete(key) unless original_env.key? key
|
427
|
-
ENV[key] = value
|
428
|
-
end
|
429
|
-
|
430
|
-
# @deprecated
|
431
|
-
def original_env
|
432
|
-
# Aruba.platform.deprecated('The use of "#original_env" is deprecated')
|
433
|
-
|
434
|
-
@original_env ||= {}
|
435
|
-
end
|
436
|
-
|
437
|
-
# @deprecated
|
438
|
-
def filesystem_permissions(*args)
|
439
|
-
Aruba.platform.deprecated('The use of "#filesystem_permissions" is deprecated. Please use "#chmod" instead')
|
440
|
-
|
441
|
-
chmod(*args)
|
442
|
-
end
|
443
|
-
|
444
|
-
# Check file system permissions of file
|
445
|
-
#
|
446
|
-
# @param [Octal] expected_permissions
|
447
|
-
# Expected file system permissions, e.g. 0755
|
448
|
-
# @param [String] file_names
|
449
|
-
# The file name(s)
|
450
|
-
# @param [Boolean] expected_result
|
451
|
-
# Are the permissions expected to be mode or are they expected not to be mode?
|
452
|
-
def check_filesystem_permissions(*args)
|
453
|
-
Aruba.platform.deprecated('The use of "#check_filesystem_permissions" is deprecated. Please use "expect().to have_permissions perms" instead')
|
454
|
-
|
455
|
-
args = args.flatten
|
456
|
-
|
457
|
-
expected_permissions = args.shift
|
458
|
-
expected_result = args.pop
|
459
|
-
|
460
|
-
args.each do |p|
|
461
|
-
raise "Expected #{p} to be present" unless exist? p
|
462
|
-
|
463
|
-
if expected_result
|
464
|
-
expect(p).to have_permissions expected_permissions
|
465
|
-
else
|
466
|
-
expect(p).not_to have_permissions expected_permissions
|
467
|
-
end
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
|
-
# @deprecated
|
472
|
-
def _create_file(name, content, check_presence)
|
473
|
-
Aruba.platform.deprecated('The use of "#_create_file" is deprecated. It will be removed soon')
|
474
|
-
|
475
|
-
ArubaFileCreator.new.write(expand_path(name), content, check_presence)
|
476
|
-
|
477
|
-
self
|
478
|
-
end
|
479
|
-
|
480
|
-
# @deprecated
|
481
|
-
def _create_fixed_size_file(file_name, file_size, check_presence)
|
482
|
-
Aruba.platform.deprecated('The use of "#_create_fixed_size_file" is deprecated. It will be removed soon')
|
483
|
-
|
484
|
-
ArubaFixedSizeFileCreator.new.write(expand_path(name), size, check_presence)
|
485
|
-
|
486
|
-
self
|
487
|
-
end
|
488
|
-
|
489
|
-
# @deprecated
|
490
|
-
# Unescape string
|
491
|
-
#
|
492
|
-
# @param [String] string
|
493
|
-
# The string which should be unescaped, e.g. the output of a command
|
494
|
-
#
|
495
|
-
# @return
|
496
|
-
# The string stripped from escape sequences
|
497
|
-
def unescape(string, keep_ansi = false)
|
498
|
-
Aruba.platform.deprecated('The use of "#unescape" is deprecated. Please use "#sanitize_text" intead')
|
499
|
-
|
500
|
-
string = unescape_text(string)
|
501
|
-
string = extract_text(string) if !keep_ansi || !aruba.config.keep_ansi || aruba.config.remove_ansi_escape_sequences
|
502
|
-
|
503
|
-
string
|
504
|
-
end
|
505
|
-
|
506
|
-
# @deprecated
|
507
|
-
# The root directory of aruba
|
508
|
-
def root_directory
|
509
|
-
Aruba.platform.deprecated('The use of "#root_directory" is deprecated. Use "aruba.root_directory" instead')
|
510
|
-
|
511
|
-
aruba.root_directory
|
512
|
-
end
|
513
|
-
|
514
|
-
# The path to the directory which contains fixtures
|
515
|
-
# You might want to overwrite this method to place your data else where.
|
516
|
-
#
|
517
|
-
# @return [String]
|
518
|
-
# The directory to where your fixtures are stored
|
519
|
-
def fixtures_directory
|
520
|
-
Aruba.platform.deprecated('The use of "#fixtures_directory" is deprecated. Use "aruba.fixtures_directory" instead')
|
521
|
-
|
522
|
-
aruba.fixtures_directory
|
523
|
-
end
|
524
|
-
|
525
|
-
# @deprecated
|
526
|
-
def check_for_deprecated_variables
|
527
|
-
if defined? @aruba_exit_timeout
|
528
|
-
Aruba.platform.deprecated('The use of "@aruba_exit_timeout" is deprecated. Use "#aruba.config.exit_timeout = <numeric>" instead')
|
529
|
-
aruba.config.exit_timeout = @aruba_exit_timeout
|
530
|
-
end
|
531
|
-
|
532
|
-
if defined? @aruba_io_wait_seconds
|
533
|
-
Aruba.platform.deprecated('The use of "@aruba_io_wait_seconds" is deprecated. Use "#aruba.config.io_wait_timeout = <numeric>" instead')
|
534
|
-
aruba.config.io_wait_timeout = @aruba_io_wait_seconds
|
535
|
-
end
|
536
|
-
|
537
|
-
if defined? @keep_ansi
|
538
|
-
Aruba.platform.deprecated('The use of "@aruba_keep_ansi" is deprecated. Use "#aruba.config.remove_ansi_escape_sequences = <true|false>" instead. Be aware that it uses an inverted logic')
|
539
|
-
|
540
|
-
aruba.config.remove_ansi_escape_sequences = false
|
541
|
-
end
|
542
|
-
|
543
|
-
if defined? @aruba_root_directory
|
544
|
-
Aruba.platform.deprecated('The use of "@aruba_root_directory" is deprecated. Use "#aruba.config.root_directory = <string>" instead')
|
545
|
-
|
546
|
-
aruba.config.root_directory = @aruba_root_directory.to_s
|
547
|
-
end
|
548
|
-
end
|
549
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
550
|
-
# rubocop:enable Metrics/MethodLength
|
551
|
-
|
552
|
-
# Last command started
|
553
|
-
def last_command
|
554
|
-
Aruba.platform.deprecated('The use of "#last_command" is deprecated. Use "#last_command_started"')
|
555
|
-
|
556
|
-
process_monitor.last_command_started
|
557
|
-
end
|
558
|
-
|
559
|
-
# @deprecated
|
560
|
-
#
|
561
|
-
# Full compare arg1 and arg2
|
562
|
-
#
|
563
|
-
# @return [TrueClass, FalseClass]
|
564
|
-
# If arg1 is exactly the same as arg2 return true, otherwise false
|
565
|
-
def assert_exact_output(expected, actual)
|
566
|
-
Aruba.platform.deprecated('The use of "#assert_exact_output" is deprecated. Use "expect(command).to have_output \'exact\'" instead. There are also special matchers for "stdout" and "stderr"')
|
567
|
-
|
568
|
-
actual.force_encoding(expected.encoding)
|
569
|
-
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to eq Aruba.platform.unescape(expected, aruba.config.keep_ansi)
|
570
|
-
end
|
571
|
-
|
572
|
-
# @deprecated
|
573
|
-
#
|
574
|
-
# Partial compare arg1 and arg2
|
575
|
-
#
|
576
|
-
# @return [TrueClass, FalseClass]
|
577
|
-
# If arg2 contains arg1 return true, otherwise false
|
578
|
-
def assert_partial_output(expected, actual)
|
579
|
-
Aruba.platform.deprecated('The use of "#assert_partial_output" is deprecated. Use "expect(command).to have_output /partial/" instead. There are also special matchers for "stdout" and "stderr"')
|
580
|
-
|
581
|
-
actual.force_encoding(expected.encoding)
|
582
|
-
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to include(Aruba.platform.unescape(expected, aruba.config.keep_ansi))
|
583
|
-
end
|
584
|
-
|
585
|
-
# @deprecated
|
586
|
-
#
|
587
|
-
# Regex Compare arg1 and arg2
|
588
|
-
#
|
589
|
-
# @return [TrueClass, FalseClass]
|
590
|
-
# If arg2 matches arg1 return true, otherwise false
|
591
|
-
def assert_matching_output(expected, actual)
|
592
|
-
Aruba.platform.deprecated('The use of "#assert_matching_output" is deprecated. Use "expect(command).to have_output /partial/" instead. There are also special matchers for "stdout" and "stderr"')
|
593
|
-
|
594
|
-
actual.force_encoding(expected.encoding)
|
595
|
-
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
|
596
|
-
end
|
597
|
-
|
598
|
-
# @deprecated
|
599
|
-
#
|
600
|
-
# Negative regex compare arg1 and arg2
|
601
|
-
#
|
602
|
-
# @return [TrueClass, FalseClass]
|
603
|
-
# If arg2 does not match arg1 return true, otherwise false
|
604
|
-
def assert_not_matching_output(expected, actual)
|
605
|
-
Aruba.platform.deprecated('The use of "#assert_not_matching_output" is deprecated. Use "expect(command).not_to have_output /partial/" instead. There are also special matchers for "stdout" and "stderr"')
|
606
|
-
|
607
|
-
actual.force_encoding(expected.encoding)
|
608
|
-
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
|
609
|
-
end
|
610
|
-
|
611
|
-
# @deprecated
|
612
|
-
#
|
613
|
-
# Negative partial compare arg1 and arg2
|
614
|
-
#
|
615
|
-
# @return [TrueClass, FalseClass]
|
616
|
-
# If arg2 does not match/include arg1 return true, otherwise false
|
617
|
-
def assert_no_partial_output(unexpected, actual)
|
618
|
-
Aruba.platform.deprecated('The use of "#assert_no_partial_output" is deprecated. Use "expect(command).not_to have_output /partial/" instead. There are also special matchers for "stdout" and "stderr"')
|
619
|
-
|
620
|
-
actual.force_encoding(unexpected.encoding)
|
621
|
-
if Regexp === unexpected
|
622
|
-
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to match unexpected
|
623
|
-
else
|
624
|
-
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to include(unexpected)
|
625
|
-
end
|
626
|
-
end
|
627
|
-
|
628
|
-
# @deprecated
|
629
|
-
#
|
630
|
-
# Partial compare output of interactive command and arg1
|
631
|
-
#
|
632
|
-
# @return [TrueClass, FalseClass]
|
633
|
-
# If output of interactive command includes arg1 return true, otherwise false
|
634
|
-
def assert_partial_output_interactive(expected)
|
635
|
-
Aruba.platform.deprecated('The use of "#assert_partial_output_interactive" is deprecated. Use "expect(last_command_started).to have_output /partial/" instead. There are also special matchers for "stdout" and "stderr"')
|
636
|
-
|
637
|
-
Aruba.platform.unescape(last_command_started.stdout, aruba.config.keep_ansi).include?(Aruba.platform.unescape(expected, aruba.config.keep_ansi)) ? true : false
|
638
|
-
end
|
639
|
-
|
640
|
-
# @deprecated
|
641
|
-
#
|
642
|
-
# Check if command succeeded and if arg1 is included in output
|
643
|
-
#
|
644
|
-
# @return [TrueClass, FalseClass]
|
645
|
-
# If exit status is 0 and arg1 is included in output return true, otherwise false
|
646
|
-
def assert_passing_with(expected)
|
647
|
-
Aruba.platform.deprecated('The use of "#assert_passing_with" is deprecated. Use "expect(all_commands).to all(be_successfully_executed).and include_an_object(have_output(/partial/))" or something similar instead. There are also special matchers for "stdout" and "stderr"')
|
648
|
-
|
649
|
-
assert_success(true)
|
650
|
-
assert_partial_output(expected, all_output)
|
651
|
-
end
|
652
|
-
|
653
|
-
# @deprecated
|
654
|
-
#
|
655
|
-
# Check if command failed and if arg1 is included in output
|
656
|
-
#
|
657
|
-
# @return [TrueClass, FalseClass]
|
658
|
-
# If exit status is not equal 0 and arg1 is included in output return true, otherwise false
|
659
|
-
def assert_failing_with(expected)
|
660
|
-
Aruba.platform.deprecated('The use of "#assert_passing_with" is deprecated. Use "expect(all_commands).not_to include_an_object(be_successfully_executed).and include_an_object(have_output(/partial/))" or something similar instead. There are also special matchers for "stdout" and "stderr"')
|
661
|
-
|
662
|
-
assert_success(false)
|
663
|
-
assert_partial_output(expected, all_output)
|
664
|
-
end
|
665
|
-
|
666
|
-
# @deprecated
|
667
|
-
#
|
668
|
-
# Check exit status of process
|
669
|
-
#
|
670
|
-
# @return [TrueClass, FalseClass]
|
671
|
-
# If arg1 is true, return true if command was successful
|
672
|
-
# If arg1 is false, return true if command failed
|
673
|
-
def assert_success(success)
|
674
|
-
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).to be_successfully_executed" or with "not_to" or the negative form "have_failed_running" (requires rspec >= 3.1)')
|
675
|
-
|
676
|
-
if success
|
677
|
-
expect(last_command_started).to be_successfully_executed
|
678
|
-
else
|
679
|
-
expect(last_command_started).not_to be_successfully_executed
|
680
|
-
end
|
681
|
-
end
|
682
|
-
|
683
|
-
# @deprecated
|
684
|
-
def assert_exit_status(status)
|
685
|
-
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).to have_exit_status(status)"')
|
686
|
-
|
687
|
-
expect(last_command_started).to have_exit_status(status)
|
688
|
-
end
|
689
|
-
|
690
|
-
# @deprecated
|
691
|
-
def assert_not_exit_status(status)
|
692
|
-
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).not_to have_exit_status(status)"')
|
693
|
-
|
694
|
-
expect(last_exit_status).not_to eq(status),
|
695
|
-
append_output_to("Exit status was #{last_exit_status} which was not expected.")
|
696
|
-
end
|
697
|
-
|
698
|
-
# @deprecated
|
699
|
-
def append_output_to(message)
|
700
|
-
Aruba.platform.deprecated('The use of "#append_output_to" is deprecated')
|
701
|
-
|
702
|
-
"#{message} Output:\n\n#{all_output}\n"
|
703
|
-
end
|
704
|
-
|
705
|
-
# @deprecated
|
706
|
-
def register_process(*args)
|
707
|
-
# Aruba.platform.deprecated('The use of "#register_process" is deprecated')
|
708
|
-
|
709
|
-
process_monitor.register_process(*args)
|
710
|
-
end
|
711
|
-
|
712
|
-
# @deprecated
|
713
|
-
def get_process(wanted)
|
714
|
-
# Aruba.platform.deprecated('The use of "#get_process" is deprecated')
|
715
|
-
|
716
|
-
process_monitor.get_process(wanted)
|
717
|
-
end
|
718
|
-
|
719
|
-
# @deprecated
|
720
|
-
#
|
721
|
-
# Fetch output (stdout, stderr) from command
|
722
|
-
#
|
723
|
-
# @param [String] cmd
|
724
|
-
# The command
|
725
|
-
def output_from(cmd)
|
726
|
-
# Aruba.platform.deprecated('The use of "#output_from" is deprecated')
|
727
|
-
|
728
|
-
process_monitor.output_from(cmd)
|
729
|
-
end
|
730
|
-
|
731
|
-
# @deprecated
|
732
|
-
#
|
733
|
-
# Fetch stdout from command
|
734
|
-
#
|
735
|
-
# @param [String] cmd
|
736
|
-
# The command
|
737
|
-
def stdout_from(cmd)
|
738
|
-
# Aruba.platform.deprecated('The use of "#stdout_from" is deprecated')
|
739
|
-
|
740
|
-
process_monitor.stdout_from(cmd)
|
741
|
-
end
|
742
|
-
|
743
|
-
# @deprecated
|
744
|
-
#
|
745
|
-
# Fetch stderr from command
|
746
|
-
#
|
747
|
-
# @param [String] cmd
|
748
|
-
# The command
|
749
|
-
def stderr_from(cmd)
|
750
|
-
# Aruba.platform.deprecated('The use of "#stderr_from" is deprecated')
|
751
|
-
|
752
|
-
process_monitor.stderr_from(cmd)
|
753
|
-
end
|
754
|
-
|
755
|
-
# @deprecated
|
756
|
-
#
|
757
|
-
# Get stdout of all processes
|
758
|
-
#
|
759
|
-
# @return [String]
|
760
|
-
# The stdout of all process which have run before
|
761
|
-
def all_stdout
|
762
|
-
Aruba.platform.deprecated('The use of "#all_stdout" is deprecated. Use `all_commands.map { |c| c.stdout }.join("\n") instead. If you need to check for some output use "expect(all_commands).to have_output_on_stdout /output/" instead')
|
763
|
-
|
764
|
-
process_monitor.all_stdout
|
765
|
-
end
|
766
|
-
|
767
|
-
# @deprecated
|
768
|
-
#
|
769
|
-
# Get stderr of all processes
|
770
|
-
#
|
771
|
-
# @return [String]
|
772
|
-
# The stderr of all process which have run before
|
773
|
-
def all_stderr
|
774
|
-
Aruba.platform.deprecated('The use of "#all_stderr" is deprecated. Use `all_commands.map { |c| c.stderr }.join("\n") instead. If you need to check for some output use "expect(all_commands).to have_output_on_stderr /output/" instead')
|
775
|
-
|
776
|
-
process_monitor.all_stderr
|
777
|
-
end
|
778
|
-
|
779
|
-
# @deprecated
|
780
|
-
#
|
781
|
-
# Get stderr and stdout of all processes
|
782
|
-
#
|
783
|
-
# @return [String]
|
784
|
-
# The stderr and stdout of all process which have run before
|
785
|
-
def all_output
|
786
|
-
Aruba.platform.deprecated('The use of "#all_output" is deprecated. Use `all_commands.map { |c| c.output }.join("\n") instead. If you need to check for some output use "expect(all_commands).to have_output /output/" instead')
|
787
|
-
|
788
|
-
process_monitor.all_output
|
789
|
-
end
|
790
|
-
|
791
|
-
# @deprecated
|
792
|
-
#
|
793
|
-
# Default exit timeout for running commands with aruba
|
794
|
-
#
|
795
|
-
# Overwrite this method if you want a different timeout or set
|
796
|
-
# `@aruba_timeout_seconds`.
|
797
|
-
def exit_timeout
|
798
|
-
Aruba.platform.deprecated('The use of "#exit_timeout" is deprecated. Use "aruba.config.exit_timeout" instead.')
|
799
|
-
|
800
|
-
aruba.config.exit_timeout
|
801
|
-
end
|
802
|
-
|
803
|
-
# @deprecated
|
804
|
-
#
|
805
|
-
# Default io wait timeout
|
806
|
-
#
|
807
|
-
# Overwrite this method if you want a different timeout or set
|
808
|
-
# `@aruba_io_wait_seconds
|
809
|
-
def io_wait
|
810
|
-
Aruba.platform.deprecated('The use of "#io_wait" is deprecated. Use "aruba.config.io_wait_timeout" instead')
|
811
|
-
|
812
|
-
aruba.config.io_wait_timeout
|
813
|
-
end
|
814
|
-
|
815
|
-
# @deprecated
|
816
|
-
# Only processes
|
817
|
-
def only_processes
|
818
|
-
Aruba.platform.deprecated('The use of "#only_processes" is deprecated. Use "#all_commands" instead')
|
819
|
-
|
820
|
-
process_monitor.only_processes
|
821
|
-
end
|
822
|
-
|
823
|
-
# @deprecated
|
824
|
-
def last_exit_status
|
825
|
-
Aruba.platform.deprecated('The use of "#last_exit_status" is deprecated. Use "#last_command_(started|stopped).exit_status" instead')
|
826
|
-
|
827
|
-
process_monitor.last_exit_status
|
828
|
-
end
|
829
|
-
|
830
|
-
# @deprecated
|
831
|
-
def stop_process(process)
|
832
|
-
# Aruba.platform.deprecated('The use of "#stop_process" is deprecated. Use "#last_command_(started|stopped).stop" instead')
|
833
|
-
|
834
|
-
@last_exit_status = process_monitor.stop_process(process)
|
835
|
-
end
|
836
|
-
|
837
|
-
# @deprecated
|
838
|
-
def terminate_process(process)
|
839
|
-
# Aruba.platform.deprecated('The use of "#terminate_process" is deprecated. Use "#last_command_(started|stopped).terminate" instead')
|
840
|
-
|
841
|
-
process_monitor.terminate_process(process)
|
842
|
-
end
|
843
|
-
|
844
|
-
# @deprecated
|
845
|
-
def stop_processes!
|
846
|
-
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "#stop_all_commands" instead')
|
847
|
-
|
848
|
-
stop_all_commands
|
849
|
-
end
|
850
|
-
|
851
|
-
# @deprecated
|
852
|
-
#
|
853
|
-
# Terminate all running processes
|
854
|
-
def terminate_processes!
|
855
|
-
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "all_commands.each(&:terminate)" instead')
|
856
|
-
|
857
|
-
all_commands.each(&:terminate)
|
858
|
-
end
|
859
|
-
|
860
|
-
# @deprecated
|
861
|
-
#
|
862
|
-
# Access to announcer
|
863
|
-
def announcer
|
864
|
-
Aruba.platform.deprecated('The use of "#announcer" is deprecated. Use "aruba.announcer" instead')
|
865
|
-
|
866
|
-
@announcer ||= Platforms::Announcer.new(
|
867
|
-
self,
|
868
|
-
:stdout => defined?(@announce_stdout),
|
869
|
-
:stderr => defined?(@announce_stderr),
|
870
|
-
:dir => defined?(@announce_dir),
|
871
|
-
:cmd => defined?(@announce_cmd),
|
872
|
-
:env => defined?(@announce_env)
|
873
|
-
)
|
874
|
-
|
875
|
-
@announcer
|
876
|
-
end
|
877
|
-
|
878
|
-
# @private
|
879
|
-
# @deprecated
|
880
|
-
def process_monitor
|
881
|
-
Aruba.platform.deprecated('The use of "#process_monitor" is deprecated.')
|
882
|
-
|
883
|
-
aruba.command_monitor
|
884
|
-
end
|
885
|
-
|
886
|
-
# @private
|
887
|
-
# @deprecated
|
888
|
-
def processes
|
889
|
-
Aruba.platform.deprecated('The use of "#process_monitor" is deprecated. Please use "#all_commands" instead.')
|
890
|
-
|
891
|
-
aruba.command_monitor.send(:processes)
|
892
|
-
end
|
893
|
-
end
|
894
|
-
end
|
895
|
-
end
|