aruba 0.9.0.pre → 0.9.0.pre2
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 +4 -4
- data/Gemfile +8 -3
- data/History.md +61 -19
- data/README.md +10 -6
- data/TODO.md +6 -1
- data/cucumber.yml +10 -6
- data/features/.nav +72 -0
- data/features/announce.feature +203 -0
- data/features/api/command/extract_text.feature +10 -0
- data/features/api/command/run.feature +6 -6
- data/features/api/command/stop_all_commands.feature +53 -0
- data/features/api/command/terminate_all_commands.feature +53 -0
- data/features/api/command/unescape_text.feature +12 -0
- data/features/api/command/which.feature +3 -3
- data/features/api/core/expand_path.feature +4 -4
- data/features/api/environment/append_environment_variable.feature +18 -8
- data/features/api/environment/prepend_environment_variable.feature +18 -8
- data/features/api/environment/set_environment_variable.feature +33 -16
- data/features/api/filesystem/cd.feature +23 -13
- data/features/api/filesystem/create_directory.feature +2 -2
- data/features/api/filesystem/disk_usage.feature +7 -6
- data/features/api/filesystem/does_exist.feature +2 -2
- data/features/api/filesystem/is_absolute.feature +2 -2
- data/features/api/filesystem/is_directory.feature +2 -2
- data/features/api/filesystem/is_file.feature +2 -2
- data/features/api/filesystem/is_relative.feature +2 -2
- data/features/api/filesystem/move.feature +119 -0
- data/features/cli/console.feature +3 -3
- data/features/commands/debug_command.feature +93 -0
- data/features/commands/environment_variables.feature +64 -0
- data/features/commands/flushing.feature +74 -0
- data/features/commands/interactive.feature +90 -0
- data/features/commands/output/all_output.feature +445 -0
- data/features/commands/output/stdout.feature +66 -0
- data/features/configuration/exit_timeout.feature +5 -5
- data/features/configuration/fixtures_directories.feature +3 -3
- data/features/configuration/fixtures_path_prefix.feature +1 -1
- data/features/configuration/home_directory.feature +4 -4
- data/features/configuration/io_timeout.feature +2 -2
- data/features/configuration/keep_ansi.feature +2 -2
- data/features/configuration/log_level.feature +3 -3
- data/features/configuration/physical_block_size.feature +3 -3
- data/features/configuration/usage.feature +159 -0
- data/features/core/cleanup_aruba_directory.feature +52 -0
- data/features/development/build.feature +16 -0
- data/features/development/test.feature +24 -0
- data/features/file_system_commands.feature +12 -12
- data/features/getting_started/supported_programming_languages.feature +89 -0
- data/features/hooks/after/command.feature +1 -1
- data/features/hooks/before/command.feature +2 -2
- data/features/matchers/collection/include_an_object.feature +72 -0
- data/features/matchers/timeouts.feature +2 -2
- data/features/output.feature +60 -181
- data/features/step_definitions/aruba_dev_steps.rb +17 -10
- data/features/step_definitions/hooks.rb +11 -0
- data/features/steps/commands/exit_statuses.feature +3 -3
- data/features/steps/commands/run.feature +0 -15
- data/features/steps/filesystem/copy.feature +45 -0
- data/features/steps/filesystem/create_directory.feature +47 -0
- data/features/steps/filesystem/create_file.feature +53 -0
- data/features/steps/filesystem/file_content.feature +1 -1
- data/features/steps/filesystem/move.feature +45 -0
- data/features/steps/filesystem/overwrite_file.feature +72 -0
- data/features/steps/filesystem/use_fixture.feature +77 -0
- data/features/usage/install.feature +8 -0
- data/{features/fixtures → fixtures}/cli-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/cli-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/README.md +0 -0
- data/{features/fixtures → fixtures}/cli-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/cli-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/cli-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/features/support/env.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app.rb +0 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +15 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/empty-app → fixtures/cli-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/cli-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/spec/support/aruba.rb +0 -0
- data/{features/fixtures → fixtures}/copy/file.txt +0 -0
- data/{features/fixtures → fixtures}/empty-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/empty-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/README.md +0 -0
- data/{features/fixtures → fixtures}/empty-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/empty-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/empty-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app.rb +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/cli-app → fixtures/empty-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/empty-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/fixtures-app/test.txt +0 -0
- data/fixtures/getting-started-app/.gitignore +4 -0
- data/fixtures/getting-started-app/Gemfile +4 -0
- data/fixtures/getting-started-app/README.md +3 -0
- data/fixtures/getting-started-app/features/support/env.rb +1 -0
- data/{features/fixtures → fixtures}/spawn_process/stderr.sh +0 -0
- data/lib/aruba/announcer.rb +6 -2
- data/lib/aruba/api.rb +0 -16
- data/lib/aruba/api/command.rb +64 -266
- data/lib/aruba/api/core.rb +24 -26
- data/lib/aruba/api/deprecated.rb +370 -12
- data/lib/aruba/api/filesystem.rb +64 -15
- data/lib/aruba/aruba_path.rb +4 -0
- data/lib/aruba/config.rb +1 -1
- data/lib/aruba/cucumber.rb +5 -449
- data/lib/aruba/cucumber/command.rb +378 -0
- data/lib/aruba/cucumber/core.rb +29 -0
- data/lib/aruba/cucumber/environment.rb +30 -0
- data/lib/aruba/cucumber/file.rb +210 -0
- data/lib/aruba/cucumber/hooks.rb +11 -14
- data/lib/aruba/cucumber/rvm.rb +3 -0
- data/lib/aruba/matchers/base/base_matcher.rb +94 -0
- data/lib/aruba/matchers/collection.rb +1 -0
- data/lib/aruba/matchers/collection/all_objects.rb +2 -0
- data/lib/aruba/matchers/collection/include_an_object.rb +120 -0
- data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -3
- data/lib/aruba/matchers/command/have_exit_status.rb +2 -11
- data/lib/aruba/matchers/command/have_finished_in_time.rb +5 -5
- data/lib/aruba/matchers/command/have_output.rb +46 -0
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +42 -0
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +42 -0
- data/lib/aruba/matchers/command/have_output_size.rb +28 -0
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +2 -2
- data/lib/aruba/matchers/file/have_same_file_content.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +1 -1
- data/lib/aruba/platforms/aruba_file_creator.rb +2 -3
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -3
- data/lib/aruba/platforms/determine_disk_usage.rb +23 -0
- data/lib/aruba/platforms/determine_file_size.rb +13 -0
- data/lib/aruba/platforms/disk_usage_calculator.rb +11 -0
- data/lib/aruba/platforms/local_environment.rb +15 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
- data/lib/aruba/platforms/unix_platform.rb +35 -14
- data/lib/aruba/process_monitor.rb +53 -7
- data/lib/aruba/processes/basic_process.rb +25 -5
- data/lib/aruba/processes/debug_process.rb +27 -25
- data/lib/aruba/processes/in_process.rb +7 -22
- data/lib/aruba/processes/spawn_process.rb +74 -31
- data/lib/aruba/rspec.rb +1 -6
- data/lib/aruba/version.rb +1 -1
- data/script/console +0 -1
- data/spec/aruba/api/environment/restore_env_spec.rb +65 -0
- data/spec/aruba/api/environment/set_env_spec.rb +42 -0
- data/spec/aruba/api/filesystem/file_size_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +10 -7
- data/spec/aruba/matchers/command/have_output_size_spec.rb +25 -0
- data/spec/aruba/matchers/command_spec.rb +135 -4
- data/spec/aruba/spawn_process_spec.rb +1 -1
- metadata +107 -65
- data/.nav +0 -12
- data/features/debug.feature +0 -15
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +0 -7
- data/features/flushing.feature +0 -26
- data/features/interactive.feature +0 -66
- data/features/no_clobber.feature +0 -25
- data/lib/aruba/disk_usage_calculator.rb +0 -7
data/lib/aruba/api/core.rb
CHANGED
@@ -53,22 +53,20 @@ module Aruba
|
|
53
53
|
fail ArgumentError, "#{expand_path(dir)} is not a directory or does not exist." unless Aruba.platform.directory? expand_path(dir)
|
54
54
|
|
55
55
|
aruba.current_directory << dir
|
56
|
+
announcer.announce :directory, expand_path(dir)
|
56
57
|
|
57
58
|
old_dir = Aruba.platform.getwd
|
58
|
-
old_oldpwd = ENV['OLDPWD']
|
59
|
-
old_pwd = ENV['PWD']
|
60
|
-
|
61
|
-
ENV['OLDPWD'] = Aruba.platform.getwd
|
62
|
-
ENV['PWD'] = File.join(aruba.root_directory, aruba.current_directory).sub(%r{/$}, '')
|
63
59
|
|
64
60
|
Aruba.platform.chdir File.join(aruba.root_directory, aruba.current_directory)
|
65
61
|
|
66
|
-
result =
|
62
|
+
result = Aruba.platform.with_environment(
|
63
|
+
'OLDPWD' => old_dir,
|
64
|
+
'PWD' => File.expand_path(File.join(aruba.root_directory, aruba.current_directory)),
|
65
|
+
&block
|
66
|
+
)
|
67
67
|
ensure
|
68
68
|
aruba.current_directory.pop
|
69
69
|
Aruba.platform.chdir old_dir
|
70
|
-
ENV['OLDPWD'] = old_oldpwd
|
71
|
-
ENV['PWD'] = old_pwd
|
72
70
|
end
|
73
71
|
|
74
72
|
return result
|
@@ -77,6 +75,7 @@ module Aruba
|
|
77
75
|
fail ArgumentError, "#{expand_path(dir)} is not a directory or does not exist." unless Aruba.platform.directory? expand_path(dir)
|
78
76
|
|
79
77
|
aruba.current_directory << dir
|
78
|
+
announcer.announce :directory, expand_path(dir)
|
80
79
|
|
81
80
|
self
|
82
81
|
end
|
@@ -129,22 +128,32 @@ module Aruba
|
|
129
128
|
# rubocop:enable Metrics/LineLength
|
130
129
|
|
131
130
|
if RUBY_VERSION < '1.9'
|
132
|
-
prefix = file_name.chars.to_a[0]
|
133
|
-
rest = file_name.chars.to_a[
|
131
|
+
prefix = file_name.chars.to_a[0].to_s
|
132
|
+
rest = if file_name.chars.to_a[2..-1].nil?
|
133
|
+
nil
|
134
|
+
else
|
135
|
+
file_name.chars.to_a[2..-1].join
|
136
|
+
end
|
134
137
|
else
|
135
138
|
prefix = file_name[0]
|
136
|
-
rest = file_name[
|
139
|
+
rest = file_name[2..-1]
|
137
140
|
end
|
138
141
|
|
139
142
|
if aruba.config.fixtures_path_prefix == prefix
|
140
|
-
File.join
|
143
|
+
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
144
|
+
|
145
|
+
# rubocop:disable Metrics/LineLength
|
146
|
+
fail ArgumentError, %(Fixture "#{rest}" does not exist in fixtures directory "#{aruba.fixtures_directory}". This was the one we found first on your system from all possible candidates: #{aruba.config.fixtures_directories.map { |p| format('"%s"', p) }.join(', ')}.) unless Aruba.platform.exist? path
|
147
|
+
# rubocop:enable Metrics/LineLength
|
148
|
+
|
149
|
+
path
|
141
150
|
elsif '~' == prefix
|
142
151
|
path = with_environment do
|
143
152
|
ArubaPath.new(File.expand_path(file_name))
|
144
153
|
end
|
145
154
|
|
146
|
-
fail 'Expanding "~/" to "/" is not allowed' if path.to_s == '/'
|
147
|
-
fail %(Expanding "~/" to a relative path "#{path}" is not allowed) unless path.absolute?
|
155
|
+
fail ArgumentError, 'Expanding "~/" to "/" is not allowed' if path.to_s == '/'
|
156
|
+
fail ArgumentError, %(Expanding "~/" to a relative path "#{path}" is not allowed) unless path.absolute?
|
148
157
|
|
149
158
|
path.to_s
|
150
159
|
else
|
@@ -163,23 +172,12 @@ module Aruba
|
|
163
172
|
# @yield
|
164
173
|
# The block of code which should be run with the modified environment variables
|
165
174
|
def with_environment(env = {}, &block)
|
166
|
-
if RUBY_VERSION <= '1.9.3'
|
167
|
-
old_env = ENV.to_hash.dup
|
168
|
-
else
|
169
|
-
old_env = ENV.to_h.dup
|
170
|
-
end
|
171
|
-
|
172
175
|
old_aruba_env = aruba.environment.to_h
|
173
176
|
|
174
|
-
|
175
|
-
|
176
|
-
block.call if block_given?
|
177
|
+
Aruba.platform.with_environment aruba.environment.update(env).to_h, &block
|
177
178
|
ensure
|
178
179
|
aruba.environment.clear
|
179
180
|
aruba.environment.update old_aruba_env
|
180
|
-
|
181
|
-
ENV.clear
|
182
|
-
ENV.update old_env
|
183
181
|
end
|
184
182
|
end
|
185
183
|
end
|
data/lib/aruba/api/deprecated.rb
CHANGED
@@ -75,9 +75,9 @@ module Aruba
|
|
75
75
|
|
76
76
|
# @deprecated
|
77
77
|
def _read_interactive
|
78
|
-
Aruba.platform.deprecated('The use of "#_read_interactive" is deprecated. Please use "
|
78
|
+
Aruba.platform.deprecated('The use of "#_read_interactive" is deprecated. Please use "last_command_started.stdout" instead')
|
79
79
|
|
80
|
-
|
80
|
+
last_command_started.stdout
|
81
81
|
end
|
82
82
|
|
83
83
|
# @deprecated
|
@@ -93,9 +93,9 @@ module Aruba
|
|
93
93
|
|
94
94
|
# @deprecated
|
95
95
|
def _write_interactive(input)
|
96
|
-
Aruba.platform.deprecated('The use of "#_write_interactive" is deprecated. Please use "#
|
96
|
+
Aruba.platform.deprecated('The use of "#_write_interactive" is deprecated. Please use "#last_command_started.write()" instead')
|
97
97
|
|
98
|
-
|
98
|
+
last_command_started.write(input)
|
99
99
|
end
|
100
100
|
|
101
101
|
# @deprecated
|
@@ -133,7 +133,7 @@ module Aruba
|
|
133
133
|
def mod?(file, perms, &block)
|
134
134
|
Aruba.platform.deprecated('The use of "#mod?" is deprecated. Use "expect().to have_permissions()" instead')
|
135
135
|
|
136
|
-
expect(Array(file)).to
|
136
|
+
expect(Array(file)).to all_objects have_permissions(perms)
|
137
137
|
end
|
138
138
|
|
139
139
|
# @deprecated
|
@@ -181,7 +181,7 @@ module Aruba
|
|
181
181
|
def check_file_presence(paths, expect_presence = true)
|
182
182
|
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')
|
183
183
|
|
184
|
-
|
184
|
+
stop_all_commands
|
185
185
|
|
186
186
|
Array(paths).each do |path|
|
187
187
|
if path.kind_of? Regexp
|
@@ -216,7 +216,8 @@ module Aruba
|
|
216
216
|
#
|
217
217
|
def check_file_size(paths_and_sizes)
|
218
218
|
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')
|
219
|
-
|
219
|
+
|
220
|
+
stop_all_commands
|
220
221
|
|
221
222
|
paths_and_sizes.each do |path, size|
|
222
223
|
expect(path).to have_file_size size
|
@@ -244,7 +245,7 @@ module Aruba
|
|
244
245
|
def check_binary_file_content(file, reference_file, expect_match = true)
|
245
246
|
Aruba.platform.deprecated('The use of "#check_binary_file_content" is deprecated. Use "expect(file).to have_same_file_content_like(file)"')
|
246
247
|
|
247
|
-
|
248
|
+
stop_all_commands
|
248
249
|
|
249
250
|
if expect_match
|
250
251
|
expect(file).to have_same_file_content_like reference_file
|
@@ -264,7 +265,7 @@ module Aruba
|
|
264
265
|
def check_directory_presence(paths, expect_presence)
|
265
266
|
Aruba.platform.deprecated('The use of "#check_directory_presence" is deprecated. Use "expect(directory).to be_an_existing_directory"')
|
266
267
|
|
267
|
-
|
268
|
+
stop_all_commands
|
268
269
|
|
269
270
|
paths.each do |path|
|
270
271
|
path = expand_path(path)
|
@@ -281,8 +282,9 @@ module Aruba
|
|
281
282
|
def prep_for_fs_check(&block)
|
282
283
|
Aruba.platform.deprecated('The use of "prep_for_fs_check" is deprecated. Use apropriate methods and the new rspec matchers instead')
|
283
284
|
|
284
|
-
|
285
|
-
|
285
|
+
stop_all_commands
|
286
|
+
|
287
|
+
cd('') { block.call }
|
286
288
|
end
|
287
289
|
|
288
290
|
# @deprecated
|
@@ -322,7 +324,7 @@ module Aruba
|
|
322
324
|
def check_file_content(file, content, expect_match = true)
|
323
325
|
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/')
|
324
326
|
|
325
|
-
|
327
|
+
stop_all_commands
|
326
328
|
|
327
329
|
if expect_match
|
328
330
|
expect(file).to have_file_content content
|
@@ -499,6 +501,7 @@ module Aruba
|
|
499
501
|
|
500
502
|
aruba.root_directory
|
501
503
|
end
|
504
|
+
|
502
505
|
# The path to the directory which contains fixtures
|
503
506
|
# You might want to overwrite this method to place your data else where.
|
504
507
|
#
|
@@ -514,6 +517,11 @@ module Aruba
|
|
514
517
|
# rubocop:disable Metrics/CyclomaticComplexity
|
515
518
|
# rubocop:disable Metrics/MethodLength
|
516
519
|
def check_for_deprecated_variables
|
520
|
+
if defined? @aruba_exit_timeout
|
521
|
+
Aruba.platform.deprecated('The use of "@aruba_exit_timeout" is deprecated. Use "#aruba.config.exit_timeout = <numeric>" instead')
|
522
|
+
aruba.config.exit_timeout = @aruba_exit_timeout
|
523
|
+
end
|
524
|
+
|
517
525
|
if defined? @aruba_io_wait_seconds
|
518
526
|
Aruba.platform.deprecated('The use of "@aruba_io_wait_seconds" is deprecated. Use "#aruba.config.io_wait_timeout = <numeric>" instead')
|
519
527
|
aruba.config.io_wait_timeout = @aruba_io_wait_seconds
|
@@ -521,16 +529,366 @@ module Aruba
|
|
521
529
|
|
522
530
|
if defined? @keep_ansi
|
523
531
|
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')
|
532
|
+
|
524
533
|
aruba.config.remove_ansi_escape_sequences = false
|
525
534
|
end
|
526
535
|
|
527
536
|
if defined? @aruba_root_directory
|
528
537
|
Aruba.platform.deprecated('The use of "@aruba_root_directory" is deprecated. Use "#aruba.config.root_directory = <string>" instead')
|
538
|
+
|
529
539
|
aruba.config.root_directory = @aruba_root_directory.to_s
|
530
540
|
end
|
531
541
|
end
|
532
542
|
# rubocop:enable Metrics/CyclomaticComplexity
|
533
543
|
# rubocop:enable Metrics/MethodLength
|
544
|
+
|
545
|
+
# Last command started
|
546
|
+
def last_command
|
547
|
+
Aruba.platform.deprecated('The use of "#last_command" is deprecated. Use "#last_command_started"')
|
548
|
+
|
549
|
+
process_monitor.last_command_started
|
550
|
+
end
|
551
|
+
|
552
|
+
# @deprecated
|
553
|
+
#
|
554
|
+
# Full compare arg1 and arg2
|
555
|
+
#
|
556
|
+
# @return [TrueClass, FalseClass]
|
557
|
+
# If arg1 is exactly the same as arg2 return true, otherwise false
|
558
|
+
def assert_exact_output(expected, actual)
|
559
|
+
# rubocop:disable Metrics/LineLength
|
560
|
+
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"')
|
561
|
+
# rubocop:enable Metrics/LineLength
|
562
|
+
|
563
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
564
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to eq Aruba.platform.unescape(expected, aruba.config.keep_ansi)
|
565
|
+
end
|
566
|
+
|
567
|
+
# @deprecated
|
568
|
+
#
|
569
|
+
# Partial compare arg1 and arg2
|
570
|
+
#
|
571
|
+
# @return [TrueClass, FalseClass]
|
572
|
+
# If arg2 contains arg1 return true, otherwise false
|
573
|
+
def assert_partial_output(expected, actual)
|
574
|
+
# rubocop:disable Metrics/LineLength
|
575
|
+
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"')
|
576
|
+
# rubocop:enable Metrics/LineLength
|
577
|
+
|
578
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
579
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to include(Aruba.platform.unescape(expected, aruba.config.keep_ansi))
|
580
|
+
end
|
581
|
+
|
582
|
+
# @deprecated
|
583
|
+
#
|
584
|
+
# Regex Compare arg1 and arg2
|
585
|
+
#
|
586
|
+
# @return [TrueClass, FalseClass]
|
587
|
+
# If arg2 matches arg1 return true, otherwise false
|
588
|
+
def assert_matching_output(expected, actual)
|
589
|
+
# rubocop:disable Metrics/LineLength
|
590
|
+
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"')
|
591
|
+
# rubocop:enable Metrics/LineLength
|
592
|
+
|
593
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
594
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
|
595
|
+
end
|
596
|
+
|
597
|
+
# @deprecated
|
598
|
+
#
|
599
|
+
# Negative regex compare arg1 and arg2
|
600
|
+
#
|
601
|
+
# @return [TrueClass, FalseClass]
|
602
|
+
# If arg2 does not match arg1 return true, otherwise false
|
603
|
+
def assert_not_matching_output(expected, actual)
|
604
|
+
# rubocop:disable Metrics/LineLength
|
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
|
+
# rubocop:enable Metrics/LineLength
|
607
|
+
|
608
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
609
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
|
610
|
+
end
|
611
|
+
|
612
|
+
# @deprecated
|
613
|
+
#
|
614
|
+
# Negative partial compare arg1 and arg2
|
615
|
+
#
|
616
|
+
# @return [TrueClass, FalseClass]
|
617
|
+
# If arg2 does not match/include arg1 return true, otherwise false
|
618
|
+
def assert_no_partial_output(unexpected, actual)
|
619
|
+
# rubocop:disable Metrics/LineLength
|
620
|
+
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"')
|
621
|
+
# rubocop:enable Metrics/LineLength
|
622
|
+
|
623
|
+
actual.force_encoding(unexpected.encoding) if RUBY_VERSION >= "1.9"
|
624
|
+
if Regexp === unexpected
|
625
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to match unexpected
|
626
|
+
else
|
627
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to include(unexpected)
|
628
|
+
end
|
629
|
+
end
|
630
|
+
|
631
|
+
# @deprecated
|
632
|
+
#
|
633
|
+
# Partial compare output of interactive command and arg1
|
634
|
+
#
|
635
|
+
# @return [TrueClass, FalseClass]
|
636
|
+
# If output of interactive command includes arg1 return true, otherwise false
|
637
|
+
def assert_partial_output_interactive(expected)
|
638
|
+
# rubocop:disable Metrics/LineLength
|
639
|
+
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"')
|
640
|
+
# rubocop:enable Metrics/LineLength
|
641
|
+
|
642
|
+
Aruba.platform.unescape(last_command_started.stdout, aruba.config.keep_ansi).include?(Aruba.platform.unescape(expected, aruba.config.keep_ansi)) ? true : false
|
643
|
+
end
|
644
|
+
|
645
|
+
# @deprecated
|
646
|
+
#
|
647
|
+
# Check if command succeeded and if arg1 is included in output
|
648
|
+
#
|
649
|
+
# @return [TrueClass, FalseClass]
|
650
|
+
# If exit status is 0 and arg1 is included in output return true, otherwise false
|
651
|
+
def assert_passing_with(expected)
|
652
|
+
# rubocop:disable Metrics/LineLength
|
653
|
+
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"')
|
654
|
+
# rubocop:enable Metrics/LineLength
|
655
|
+
|
656
|
+
assert_success(true)
|
657
|
+
assert_partial_output(expected, all_output)
|
658
|
+
end
|
659
|
+
|
660
|
+
# @deprecated
|
661
|
+
#
|
662
|
+
# Check if command failed and if arg1 is included in output
|
663
|
+
#
|
664
|
+
# @return [TrueClass, FalseClass]
|
665
|
+
# If exit status is not equal 0 and arg1 is included in output return true, otherwise false
|
666
|
+
def assert_failing_with(expected)
|
667
|
+
# rubocop:disable Metrics/LineLength
|
668
|
+
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"')
|
669
|
+
# rubocop:enable Metrics/LineLength
|
670
|
+
|
671
|
+
assert_success(false)
|
672
|
+
assert_partial_output(expected, all_output)
|
673
|
+
end
|
674
|
+
|
675
|
+
# @deprecated
|
676
|
+
#
|
677
|
+
# Check exit status of process
|
678
|
+
#
|
679
|
+
# @return [TrueClass, FalseClass]
|
680
|
+
# If arg1 is true, return true if command was successful
|
681
|
+
# If arg1 is false, return true if command failed
|
682
|
+
def assert_success(success)
|
683
|
+
# rubocop:disable Metrics/LineLength
|
684
|
+
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)')
|
685
|
+
# rubocop:enable Metrics/LineLength
|
686
|
+
|
687
|
+
if success
|
688
|
+
expect(last_command_started).to be_successfully_executed
|
689
|
+
else
|
690
|
+
expect(last_command_started).not_to be_successfully_executed
|
691
|
+
end
|
692
|
+
end
|
693
|
+
|
694
|
+
# @deprecated
|
695
|
+
def assert_exit_status(status)
|
696
|
+
# rubocop:disable Metrics/LineLength
|
697
|
+
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).to have_exit_status(status)"')
|
698
|
+
# rubocop:enable Metrics/LineLength
|
699
|
+
|
700
|
+
expect(last_command_started).to have_exit_status(status)
|
701
|
+
end
|
702
|
+
|
703
|
+
# @deprecated
|
704
|
+
def assert_not_exit_status(status)
|
705
|
+
# rubocop:disable Metrics/LineLength
|
706
|
+
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).not_to have_exit_status(status)"')
|
707
|
+
# rubocop:enable Metrics/LineLength
|
708
|
+
|
709
|
+
expect(last_exit_status).not_to eq(status),
|
710
|
+
append_output_to("Exit status was #{last_exit_status} which was not expected.")
|
711
|
+
end
|
712
|
+
|
713
|
+
# @deprecated
|
714
|
+
def append_output_to(message)
|
715
|
+
Aruba.platform.deprecated('The use of "#append_output_to" is deprecated')
|
716
|
+
|
717
|
+
"#{message} Output:\n\n#{all_output}\n"
|
718
|
+
end
|
719
|
+
|
720
|
+
# @deprecated
|
721
|
+
def register_process(*args)
|
722
|
+
# Aruba.platform.deprecated('The use of "#register_process" is deprecated')
|
723
|
+
|
724
|
+
process_monitor.register_process(*args)
|
725
|
+
end
|
726
|
+
|
727
|
+
# @deprecated
|
728
|
+
def get_process(wanted)
|
729
|
+
# Aruba.platform.deprecated('The use of "#get_process" is deprecated')
|
730
|
+
|
731
|
+
process_monitor.get_process(wanted)
|
732
|
+
end
|
733
|
+
|
734
|
+
# @deprecated
|
735
|
+
#
|
736
|
+
# Fetch output (stdout, stderr) from command
|
737
|
+
#
|
738
|
+
# @param [String] cmd
|
739
|
+
# The command
|
740
|
+
def output_from(cmd)
|
741
|
+
# Aruba.platform.deprecated('The use of "#output_from" is deprecated')
|
742
|
+
|
743
|
+
process_monitor.output_from(cmd)
|
744
|
+
end
|
745
|
+
|
746
|
+
# @deprecated
|
747
|
+
#
|
748
|
+
# Fetch stdout from command
|
749
|
+
#
|
750
|
+
# @param [String] cmd
|
751
|
+
# The command
|
752
|
+
def stdout_from(cmd)
|
753
|
+
# Aruba.platform.deprecated('The use of "#stdout_from" is deprecated')
|
754
|
+
|
755
|
+
process_monitor.stdout_from(cmd)
|
756
|
+
end
|
757
|
+
|
758
|
+
# @deprecated
|
759
|
+
#
|
760
|
+
# Fetch stderr from command
|
761
|
+
#
|
762
|
+
# @param [String] cmd
|
763
|
+
# The command
|
764
|
+
def stderr_from(cmd)
|
765
|
+
# Aruba.platform.deprecated('The use of "#stderr_from" is deprecated')
|
766
|
+
|
767
|
+
process_monitor.stderr_from(cmd)
|
768
|
+
end
|
769
|
+
|
770
|
+
# @deprecated
|
771
|
+
#
|
772
|
+
# Get stdout of all processes
|
773
|
+
#
|
774
|
+
# @return [String]
|
775
|
+
# The stdout of all process which have run before
|
776
|
+
def all_stdout
|
777
|
+
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')
|
778
|
+
|
779
|
+
process_monitor.all_stdout
|
780
|
+
end
|
781
|
+
|
782
|
+
# @deprecated
|
783
|
+
#
|
784
|
+
# Get stderr of all processes
|
785
|
+
#
|
786
|
+
# @return [String]
|
787
|
+
# The stderr of all process which have run before
|
788
|
+
def all_stderr
|
789
|
+
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')
|
790
|
+
|
791
|
+
process_monitor.all_stderr
|
792
|
+
end
|
793
|
+
|
794
|
+
# @deprecated
|
795
|
+
#
|
796
|
+
# Get stderr and stdout of all processes
|
797
|
+
#
|
798
|
+
# @return [String]
|
799
|
+
# The stderr and stdout of all process which have run before
|
800
|
+
def all_output
|
801
|
+
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')
|
802
|
+
|
803
|
+
process_monitor.all_output
|
804
|
+
end
|
805
|
+
|
806
|
+
# @deprecated
|
807
|
+
#
|
808
|
+
# Default exit timeout for running commands with aruba
|
809
|
+
#
|
810
|
+
# Overwrite this method if you want a different timeout or set
|
811
|
+
# `@aruba_timeout_seconds`.
|
812
|
+
def exit_timeout
|
813
|
+
Aruba.platform.deprecated('The use of "#exit_timeout" is deprecated. Use "aruba.config.exit_timeout" instead.')
|
814
|
+
|
815
|
+
aruba.config.exit_timeout
|
816
|
+
end
|
817
|
+
|
818
|
+
# @deprecated
|
819
|
+
#
|
820
|
+
# Default io wait timeout
|
821
|
+
#
|
822
|
+
# Overwrite this method if you want a different timeout or set
|
823
|
+
# `@aruba_io_wait_seconds
|
824
|
+
def io_wait
|
825
|
+
Aruba.platform.deprecated('The use of "#io_wait" is deprecated. Use "aruba.config.io_wait_timeout" instead')
|
826
|
+
|
827
|
+
aruba.config.io_wait_timeout
|
828
|
+
end
|
829
|
+
|
830
|
+
# @deprecated
|
831
|
+
# Only processes
|
832
|
+
def only_processes
|
833
|
+
Aruba.platform.deprecated('The use of "#only_processes" is deprecated. Use "#all_commands" instead')
|
834
|
+
|
835
|
+
process_monitor.only_processes
|
836
|
+
end
|
837
|
+
|
838
|
+
# @deprecated
|
839
|
+
def last_exit_status
|
840
|
+
Aruba.platform.deprecated('The use of "#last_exit_status" is deprecated. Use "#last_command_(started|stopped).exit_status" instead')
|
841
|
+
|
842
|
+
process_monitor.last_exit_status
|
843
|
+
end
|
844
|
+
|
845
|
+
# @deprecated
|
846
|
+
def stop_process(process)
|
847
|
+
# Aruba.platform.deprecated('The use of "#stop_process" is deprecated. Use "#last_command_(started|stopped).stop" instead')
|
848
|
+
|
849
|
+
@last_exit_status = process_monitor.stop_process(process)
|
850
|
+
end
|
851
|
+
|
852
|
+
# @deprecated
|
853
|
+
def terminate_process(process)
|
854
|
+
# Aruba.platform.deprecated('The use of "#terminate_process" is deprecated. Use "#last_command_(started|stopped).terminate" instead')
|
855
|
+
|
856
|
+
process_monitor.terminate_process(process)
|
857
|
+
end
|
858
|
+
|
859
|
+
# @deprecated
|
860
|
+
def stop_processes!
|
861
|
+
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "#stop_all_commands" instead')
|
862
|
+
|
863
|
+
stop_all_commands
|
864
|
+
end
|
865
|
+
|
866
|
+
# @deprecated
|
867
|
+
#
|
868
|
+
# Terminate all running processes
|
869
|
+
def terminate_processes!
|
870
|
+
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "all_commands.each(&:terminate)" instead')
|
871
|
+
|
872
|
+
all_commands.each(&:terminate)
|
873
|
+
end
|
874
|
+
|
875
|
+
# @deprecated
|
876
|
+
#
|
877
|
+
# Access to announcer
|
878
|
+
def announcer
|
879
|
+
# Aruba.platform.deprecated('The use of "#announcer" is deprecated. Use "aruba.announcer" instead')
|
880
|
+
|
881
|
+
@announcer ||= Announcer.new(
|
882
|
+
self,
|
883
|
+
:stdout => defined?(@announce_stdout),
|
884
|
+
:stderr => defined?(@announce_stderr),
|
885
|
+
:dir => defined?(@announce_dir),
|
886
|
+
:cmd => defined?(@announce_cmd),
|
887
|
+
:env => defined?(@announce_env)
|
888
|
+
)
|
889
|
+
|
890
|
+
@announcer
|
891
|
+
end
|
534
892
|
end
|
535
893
|
end
|
536
894
|
end
|