aruba-win-fix 0.14.2
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 +7 -0
- data/.document +5 -0
- data/.gitignore +37 -0
- data/.rspec +3 -0
- data/.rubocop.yml +188 -0
- data/.simplecov +34 -0
- data/.travis.yml +47 -0
- data/.yardopts +8 -0
- data/CONTRIBUTING.md +71 -0
- data/Gemfile +83 -0
- data/History.md +579 -0
- data/LICENSE +20 -0
- data/README.md +226 -0
- data/Rakefile +49 -0
- data/TODO.md +13 -0
- data/appveyor.yml +32 -0
- data/aruba.gemspec +48 -0
- data/bin/aruba +7 -0
- data/config/.gitignore +1 -0
- data/cucumber.yml +26 -0
- data/features/.nav +72 -0
- data/features/api/command/find_command.feature +83 -0
- data/features/api/command/last_command_started.feature +50 -0
- data/features/api/command/last_command_stopped.feature +89 -0
- data/features/api/command/run.feature +414 -0
- data/features/api/command/run_simple.feature +242 -0
- data/features/api/command/send_signal.feature +53 -0
- data/features/api/command/stderr.feature +46 -0
- data/features/api/command/stdout.feature +46 -0
- data/features/api/command/stop.feature +131 -0
- data/features/api/command/stop_all_commands.feature +53 -0
- data/features/api/command/terminate_all_commands.feature +53 -0
- data/features/api/command/which.feature +37 -0
- data/features/api/core/expand_path.feature +88 -0
- data/features/api/environment/append_environment_variable.feature +128 -0
- data/features/api/environment/delete_environment_variable.feature +63 -0
- data/features/api/environment/prepend_environment_variable.feature +128 -0
- data/features/api/environment/set_environment_variable.feature +376 -0
- data/features/api/filesystem/cd.feature +184 -0
- data/features/api/filesystem/create_directory.feature +57 -0
- data/features/api/filesystem/disk_usage.feature +152 -0
- data/features/api/filesystem/does_exist.feature +62 -0
- data/features/api/filesystem/fixtures.feature +104 -0
- data/features/api/filesystem/is_absolute.feature +48 -0
- data/features/api/filesystem/is_directory.feature +53 -0
- data/features/api/filesystem/is_file.feature +54 -0
- data/features/api/filesystem/is_relative.feature +48 -0
- data/features/api/filesystem/move.feature +119 -0
- data/features/api/text/extract_text.feature +87 -0
- data/features/api/text/replace_variables.feature +45 -0
- data/features/api/text/sanitize_text.feature +228 -0
- data/features/api/text/unescape_text.feature +127 -0
- data/features/cli/console.feature +52 -0
- data/features/cli/init.feature +79 -0
- data/features/configuration/activate_announcer_on_command_failure.feature +38 -0
- data/features/configuration/command_runtime_environment.feature +129 -0
- data/features/configuration/console_history_file.feature +38 -0
- data/features/configuration/exit_timeout.feature +52 -0
- data/features/configuration/fixtures_directories.feature +38 -0
- data/features/configuration/fixtures_path_prefix.feature +23 -0
- data/features/configuration/home_directory.feature +80 -0
- data/features/configuration/io_timeout.feature +30 -0
- data/features/configuration/keep_ansi.feature +30 -0
- data/features/configuration/log_level.feature +38 -0
- data/features/configuration/physical_block_size.feature +53 -0
- data/features/configuration/remove_ansi_escape_sequences.feature +38 -0
- data/features/configuration/root_directory.feature +30 -0
- data/features/configuration/startup_wait_time.feature +48 -0
- data/features/configuration/usage.feature +159 -0
- data/features/configuration/working_directory.feature +33 -0
- data/features/development/build.feature +15 -0
- data/features/development/test.feature +24 -0
- data/features/getting_started/cleanup.feature +67 -0
- data/features/getting_started/install.feature +8 -0
- data/features/getting_started/run_commands.feature +177 -0
- data/features/getting_started/supported_testing_frameworks.feature +104 -0
- data/features/getting_started/writing_good_feature_tests.feature +38 -0
- data/features/hooks/after/command.feature +44 -0
- data/features/hooks/before/command.feature +71 -0
- data/features/matchers/collection/include_an_object.feature +72 -0
- data/features/matchers/directory/have_sub_directory.feature +110 -0
- data/features/matchers/file/be_a_command_found_in_path.feature +115 -0
- data/features/matchers/file/be_existing_executable.feature +88 -0
- data/features/matchers/file/be_existing_file.feature +82 -0
- data/features/matchers/file/have_file_content.feature +123 -0
- data/features/matchers/file/have_file_size.feature +107 -0
- data/features/matchers/path/be_an_absolute_path.feature +74 -0
- data/features/matchers/path/be_an_existing_path.feature +97 -0
- data/features/matchers/path/have_permissions.feature +118 -0
- data/features/matchers/timeouts.feature +48 -0
- data/features/platforms/jruby.feature +14 -0
- data/features/rspec/integration.feature +179 -0
- data/features/step_definitions/aruba_dev_steps.rb +56 -0
- data/features/step_definitions/hooks.rb +96 -0
- data/features/steps/command/debug.feature +92 -0
- data/features/steps/command/exit_statuses.feature +136 -0
- data/features/steps/command/in_process.feature +485 -0
- data/features/steps/command/interactive.feature +90 -0
- data/features/steps/command/output.feature +588 -0
- data/features/steps/command/run.feature +66 -0
- data/features/steps/command/send_signal.feature +104 -0
- data/features/steps/command/shell.feature +155 -0
- data/features/steps/command/stderr.feature +68 -0
- data/features/steps/command/stdout.feature +109 -0
- data/features/steps/command/stop.feature +313 -0
- data/features/steps/core/announce.feature +283 -0
- data/features/steps/environment/append_environment_variable.feature +52 -0
- data/features/steps/environment/home_variable.feature +62 -0
- data/features/steps/environment/prepend_environment_variable.feature +52 -0
- data/features/steps/environment/set_environment_variable.feature +49 -0
- data/features/steps/filesystem/append_to_file.feature +45 -0
- data/features/steps/filesystem/cd_to_directory.feature +33 -0
- data/features/steps/filesystem/check_file_content.feature +61 -0
- data/features/steps/filesystem/check_permissions_of_file.feature +39 -0
- data/features/steps/filesystem/compare_files.feature +42 -0
- data/features/steps/filesystem/copy.feature +45 -0
- data/features/steps/filesystem/create_directory.feature +57 -0
- data/features/steps/filesystem/create_file.feature +76 -0
- data/features/steps/filesystem/existence_of_directory.feature +57 -0
- data/features/steps/filesystem/existence_of_file.feature +43 -0
- data/features/steps/filesystem/file_content.feature +86 -0
- data/features/steps/filesystem/fixtures.feature +64 -0
- data/features/steps/filesystem/move.feature +45 -0
- data/features/steps/filesystem/non_existence_of_directory.feature +69 -0
- data/features/steps/filesystem/non_existence_of_file.feature +80 -0
- data/features/steps/filesystem/overwrite_file.feature +72 -0
- data/features/steps/filesystem/remove_directory.feature +38 -0
- data/features/steps/filesystem/remove_file.feature +38 -0
- data/features/steps/filesystem/use_fixture.feature +77 -0
- data/features/steps/overview.feature +60 -0
- data/features/support/aruba.rb +7 -0
- data/features/support/env.rb +33 -0
- data/features/support/jruby.rb +5 -0
- data/features/support/simplecov_setup.rb +8 -0
- data/fixtures/cli-app/.gitignore +9 -0
- data/fixtures/cli-app/.rspec +2 -0
- data/fixtures/cli-app/README.md +39 -0
- data/fixtures/cli-app/Rakefile +1 -0
- data/fixtures/cli-app/bin/cli +6 -0
- data/fixtures/cli-app/cli-app.gemspec +26 -0
- data/fixtures/cli-app/features/support/env.rb +1 -0
- data/fixtures/cli-app/lib/cli/app.rb +13 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +15 -0
- data/fixtures/cli-app/lib/cli/app/version.rb +5 -0
- data/fixtures/cli-app/script/console +14 -0
- data/fixtures/cli-app/spec/spec_helper.rb +9 -0
- data/fixtures/cli-app/spec/support/aruba.rb +1 -0
- data/fixtures/copy/file.txt +1 -0
- data/fixtures/empty-app/.gitignore +9 -0
- data/fixtures/empty-app/.rspec +2 -0
- data/fixtures/empty-app/README.md +24 -0
- data/fixtures/empty-app/Rakefile +1 -0
- data/fixtures/empty-app/cli-app.gemspec +26 -0
- data/fixtures/empty-app/lib/cli/app.rb +13 -0
- data/fixtures/empty-app/lib/cli/app/version.rb +5 -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/fixtures/spawn_process/stderr.sh +3 -0
- data/lib/aruba.rb +1 -0
- data/lib/aruba/api.rb +34 -0
- data/lib/aruba/api/command.rb +307 -0
- data/lib/aruba/api/core.rb +191 -0
- data/lib/aruba/api/deprecated.rb +897 -0
- data/lib/aruba/api/environment.rb +89 -0
- data/lib/aruba/api/filesystem.rb +392 -0
- data/lib/aruba/api/rvm.rb +44 -0
- data/lib/aruba/api/text.rb +56 -0
- data/lib/aruba/aruba_path.rb +133 -0
- data/lib/aruba/basic_configuration.rb +240 -0
- data/lib/aruba/basic_configuration/option.rb +32 -0
- data/lib/aruba/cli.rb +26 -0
- data/lib/aruba/colorizer.rb +108 -0
- data/lib/aruba/command.rb +74 -0
- data/lib/aruba/config.rb +108 -0
- data/lib/aruba/config/jruby.rb +17 -0
- data/lib/aruba/config_wrapper.rb +58 -0
- data/lib/aruba/console.rb +70 -0
- data/lib/aruba/console/help.rb +35 -0
- data/lib/aruba/contracts/absolute_path.rb +20 -0
- data/lib/aruba/contracts/enum.rb +26 -0
- data/lib/aruba/contracts/is_power_of_two.rb +22 -0
- data/lib/aruba/contracts/relative_path.rb +20 -0
- data/lib/aruba/cucumber.rb +13 -0
- data/lib/aruba/cucumber/command.rb +422 -0
- data/lib/aruba/cucumber/core.rb +5 -0
- data/lib/aruba/cucumber/environment.rb +42 -0
- data/lib/aruba/cucumber/file.rb +201 -0
- data/lib/aruba/cucumber/hooks.rb +160 -0
- data/lib/aruba/cucumber/rvm.rb +3 -0
- data/lib/aruba/cucumber/testing_frameworks.rb +95 -0
- data/lib/aruba/errors.rb +37 -0
- data/lib/aruba/event_bus.rb +59 -0
- data/lib/aruba/event_bus/name_resolver.rb +168 -0
- data/lib/aruba/events.rb +39 -0
- data/lib/aruba/extensions/string/strip.rb +25 -0
- data/lib/aruba/file_size.rb +63 -0
- data/lib/aruba/generators/script_file.rb +46 -0
- data/lib/aruba/hooks.rb +56 -0
- data/lib/aruba/in_config_wrapper.rb +24 -0
- data/lib/aruba/in_process.rb +14 -0
- data/lib/aruba/initializer.rb +222 -0
- data/lib/aruba/jruby.rb +4 -0
- data/lib/aruba/matchers/base/base_matcher.rb +96 -0
- data/lib/aruba/matchers/base/object_formatter.rb +114 -0
- data/lib/aruba/matchers/collection.rb +1 -0
- data/lib/aruba/matchers/collection/all.rb +11 -0
- data/lib/aruba/matchers/collection/include_an_object.rb +122 -0
- data/lib/aruba/matchers/command.rb +1 -0
- data/lib/aruba/matchers/command/be_successfully_executed.rb +34 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +38 -0
- data/lib/aruba/matchers/command/have_finished_in_time.rb +37 -0
- data/lib/aruba/matchers/command/have_output.rb +36 -0
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +32 -0
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +32 -0
- data/lib/aruba/matchers/command/have_output_size.rb +28 -0
- data/lib/aruba/matchers/directory.rb +1 -0
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +38 -0
- data/lib/aruba/matchers/directory/have_sub_directory.rb +53 -0
- data/lib/aruba/matchers/environment.rb +1 -0
- data/lib/aruba/matchers/file.rb +1 -0
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +36 -0
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +37 -0
- data/lib/aruba/matchers/file/be_an_existing_file.rb +38 -0
- data/lib/aruba/matchers/file/have_file_content.rb +62 -0
- data/lib/aruba/matchers/file/have_file_size.rb +47 -0
- data/lib/aruba/matchers/file/have_same_file_content.rb +48 -0
- data/lib/aruba/matchers/path.rb +1 -0
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +25 -0
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +36 -0
- data/lib/aruba/matchers/path/be_an_existing_path.rb +37 -0
- data/lib/aruba/matchers/path/have_permissions.rb +64 -0
- data/lib/aruba/matchers/path/match_path_pattern.rb +41 -0
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +25 -0
- data/lib/aruba/matchers/string.rb +1 -0
- data/lib/aruba/matchers/string/include_output_string.rb +36 -0
- data/lib/aruba/matchers/string/match_output_string.rb +37 -0
- data/lib/aruba/matchers/string/output_string_eq.rb +35 -0
- data/lib/aruba/platform.rb +25 -0
- data/lib/aruba/platforms/announcer.rb +232 -0
- data/lib/aruba/platforms/aruba_file_creator.rb +35 -0
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +35 -0
- data/lib/aruba/platforms/aruba_logger.rb +81 -0
- data/lib/aruba/platforms/command_monitor.rb +229 -0
- data/lib/aruba/platforms/determine_disk_usage.rb +28 -0
- data/lib/aruba/platforms/determine_file_size.rb +22 -0
- data/lib/aruba/platforms/disk_usage_calculator.rb +20 -0
- data/lib/aruba/platforms/filesystem_status.rb +68 -0
- data/lib/aruba/platforms/local_environment.rb +29 -0
- data/lib/aruba/platforms/simple_table.rb +54 -0
- data/lib/aruba/platforms/unix_command_string.rb +27 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +220 -0
- data/lib/aruba/platforms/unix_platform.rb +276 -0
- data/lib/aruba/platforms/unix_which.rb +85 -0
- data/lib/aruba/platforms/windows_command_string.rb +31 -0
- data/lib/aruba/platforms/windows_environment_variables.rb +89 -0
- data/lib/aruba/platforms/windows_platform.rb +42 -0
- data/lib/aruba/platforms/windows_which.rb +106 -0
- data/lib/aruba/processes/basic_process.rb +143 -0
- data/lib/aruba/processes/debug_process.rb +69 -0
- data/lib/aruba/processes/in_process.rb +125 -0
- data/lib/aruba/processes/spawn_process.rb +278 -0
- data/lib/aruba/reporting.rb +126 -0
- data/lib/aruba/rspec.rb +107 -0
- data/lib/aruba/runtime.rb +96 -0
- data/lib/aruba/setup.rb +90 -0
- data/lib/aruba/spawn_process.rb +11 -0
- data/lib/aruba/version.rb +3 -0
- data/script/bootstrap +28 -0
- data/script/console +16 -0
- data/script/test +3 -0
- 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/runtime_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +1209 -0
- data/spec/aruba/aruba_path_spec.rb +103 -0
- data/spec/aruba/basic_configuration_spec.rb +5 -0
- data/spec/aruba/configuration_spec.rb +5 -0
- data/spec/aruba/hooks_spec.rb +17 -0
- data/spec/aruba/in_config_wrapper_spec.rb +25 -0
- data/spec/aruba/jruby_spec.rb +55 -0
- data/spec/aruba/matchers/command/have_output_size_spec.rb +25 -0
- data/spec/aruba/matchers/command_spec.rb +174 -0
- data/spec/aruba/matchers/directory_spec.rb +57 -0
- data/spec/aruba/matchers/file_spec.rb +127 -0
- data/spec/aruba/matchers/path_spec.rb +88 -0
- data/spec/aruba/platform/simple_table_spec.rb +23 -0
- data/spec/aruba/platform/windows_environment_variables_spec.rb +500 -0
- data/spec/aruba/rspec_spec.rb +15 -0
- data/spec/aruba/runtime_spec.rb +29 -0
- data/spec/aruba/spawn_process_spec.rb +60 -0
- data/spec/event_bus/name_resolver_spec.rb +68 -0
- data/spec/event_bus_spec.rb +160 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/configs/.keep +0 -0
- data/spec/support/configs/aruba.rb +5 -0
- data/spec/support/configs/pry.rb +3 -0
- data/spec/support/configs/rspec.rb +15 -0
- data/spec/support/helpers/.keep +0 -0
- data/spec/support/helpers/reporting.rb +44 -0
- data/spec/support/matchers/.keep +0 -0
- data/spec/support/matchers/option.rb +35 -0
- data/spec/support/shared_contexts/.keep +0 -0
- data/spec/support/shared_contexts/aruba.rb +48 -0
- data/spec/support/shared_examples/.keep +0 -0
- data/spec/support/shared_examples/configuration.rb +116 -0
- data/spec/support/shared_examples/directory.rb +7 -0
- data/spec/support/shared_examples/file.rb +7 -0
- data/templates/css/console.css +24 -0
- data/templates/css/filesystem.css +42 -0
- data/templates/css/pygments-autumn.css +59 -0
- data/templates/files.erb +14 -0
- data/templates/images/LICENSE +22 -0
- data/templates/images/folder.png +0 -0
- data/templates/images/page_white.png +0 -0
- data/templates/images/page_white_gherkin.png +0 -0
- data/templates/images/page_white_ruby.png +0 -0
- data/templates/index.erb +20 -0
- data/templates/js/filesystem.js +5 -0
- data/templates/js/jquery-1.11.3.min.js +5 -0
- data/templates/main.erb +34 -0
- metadata +629 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
require 'rspec/expectations'
|
|
2
|
+
require 'aruba/runtime'
|
|
3
|
+
require 'aruba/errors'
|
|
4
|
+
require 'aruba/setup'
|
|
5
|
+
|
|
6
|
+
require 'aruba/config/jruby'
|
|
7
|
+
|
|
8
|
+
# Aruba
|
|
9
|
+
module Aruba
|
|
10
|
+
# Api
|
|
11
|
+
module Api
|
|
12
|
+
# Core methods of aruba
|
|
13
|
+
#
|
|
14
|
+
# Those methods do not depend on any other API method of aruba
|
|
15
|
+
module Core
|
|
16
|
+
include ::RSpec::Matchers
|
|
17
|
+
|
|
18
|
+
# Aruba Runtime
|
|
19
|
+
def aruba
|
|
20
|
+
@_aruba_runtime ||= Runtime.new
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Clean the working directory of aruba
|
|
24
|
+
#
|
|
25
|
+
# This will only clean up aruba's working directory to remove all
|
|
26
|
+
# artifacts of your tests. This does NOT clean up the current working
|
|
27
|
+
# directory.
|
|
28
|
+
def setup_aruba
|
|
29
|
+
Aruba::Setup.new(aruba).call
|
|
30
|
+
|
|
31
|
+
self
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Switch to directory
|
|
35
|
+
#
|
|
36
|
+
# @param [String] dir
|
|
37
|
+
# The directory
|
|
38
|
+
#
|
|
39
|
+
# @example Normal directory
|
|
40
|
+
# cd 'dir'
|
|
41
|
+
#
|
|
42
|
+
# @example Move up
|
|
43
|
+
# cd '..'
|
|
44
|
+
#
|
|
45
|
+
# @example Run code in directory
|
|
46
|
+
# result = cd('some-dir') { Dir.getwd }
|
|
47
|
+
#
|
|
48
|
+
# rubocop:disable Metrics/MethodLength
|
|
49
|
+
def cd(dir, &block)
|
|
50
|
+
if block_given?
|
|
51
|
+
begin
|
|
52
|
+
fail ArgumentError, "#{expand_path(dir)} is not a directory or does not exist." unless Aruba.platform.directory? expand_path(dir)
|
|
53
|
+
|
|
54
|
+
old_directory = expand_path('.')
|
|
55
|
+
aruba.current_directory << dir
|
|
56
|
+
new_directory = expand_path('.')
|
|
57
|
+
|
|
58
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(:old => old_directory, :new => new_directory)
|
|
59
|
+
|
|
60
|
+
old_dir = Aruba.platform.getwd
|
|
61
|
+
|
|
62
|
+
Aruba.platform.chdir File.join(aruba.root_directory, aruba.current_directory)
|
|
63
|
+
|
|
64
|
+
result = Aruba.platform.with_environment(
|
|
65
|
+
'OLDPWD' => old_dir,
|
|
66
|
+
'PWD' => File.expand_path(File.join(aruba.root_directory, aruba.current_directory)),
|
|
67
|
+
&block
|
|
68
|
+
)
|
|
69
|
+
ensure
|
|
70
|
+
aruba.current_directory.pop
|
|
71
|
+
Aruba.platform.chdir old_dir
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
return result
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
fail ArgumentError, "#{expand_path(dir)} is not a directory or does not exist." unless Aruba.platform.directory? expand_path(dir)
|
|
78
|
+
|
|
79
|
+
old_directory = expand_path('.')
|
|
80
|
+
aruba.current_directory << dir
|
|
81
|
+
new_directory = expand_path('.')
|
|
82
|
+
|
|
83
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(:old => old_directory, :new => new_directory)
|
|
84
|
+
|
|
85
|
+
self
|
|
86
|
+
end
|
|
87
|
+
# rubocop:enable Metrics/MethodLength
|
|
88
|
+
|
|
89
|
+
# Expand file name
|
|
90
|
+
#
|
|
91
|
+
# @param [String] file_name
|
|
92
|
+
# Name of file
|
|
93
|
+
#
|
|
94
|
+
# @param [String] dir_string
|
|
95
|
+
# Name of directory to use as starting point, otherwise current directory is used.
|
|
96
|
+
#
|
|
97
|
+
# @return [String]
|
|
98
|
+
# The full path
|
|
99
|
+
#
|
|
100
|
+
# @example Single file name
|
|
101
|
+
#
|
|
102
|
+
# # => <path>/tmp/aruba/file
|
|
103
|
+
# expand_path('file')
|
|
104
|
+
#
|
|
105
|
+
# @example Single Dot
|
|
106
|
+
#
|
|
107
|
+
# # => <path>/tmp/aruba
|
|
108
|
+
# expand_path('.')
|
|
109
|
+
#
|
|
110
|
+
# @example using home directory
|
|
111
|
+
#
|
|
112
|
+
# # => <path>/home/<name>/file
|
|
113
|
+
# expand_path('~/file')
|
|
114
|
+
#
|
|
115
|
+
# @example using fixtures directory
|
|
116
|
+
#
|
|
117
|
+
# # => <path>/test/fixtures/file
|
|
118
|
+
# expand_path('%/file')
|
|
119
|
+
#
|
|
120
|
+
# rubocop:disable Metrics/MethodLength
|
|
121
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
|
122
|
+
def expand_path(file_name, dir_string = nil)
|
|
123
|
+
check_for_deprecated_variables if Aruba::VERSION < '1'
|
|
124
|
+
|
|
125
|
+
# rubocop:disable Metrics/LineLength
|
|
126
|
+
message = %(Filename "#{file_name}" needs to be a string. It cannot be nil or empty either. Please use `expand_path('.')` if you want the current directory to be expanded.)
|
|
127
|
+
# rubocop:enable Metrics/LineLength
|
|
128
|
+
|
|
129
|
+
fail ArgumentError, message unless file_name.is_a?(String) && !file_name.empty?
|
|
130
|
+
|
|
131
|
+
# rubocop:disable Metrics/LineLength
|
|
132
|
+
aruba.logger.warn %(`aruba`'s working directory does not exist. Maybe you forgot to run `setup_aruba` before using it's API. This warning will be an error from 1.0.0) unless Aruba.platform.directory? File.join(aruba.config.root_directory, aruba.config.working_directory)
|
|
133
|
+
# rubocop:enable Metrics/LineLength
|
|
134
|
+
|
|
135
|
+
if RUBY_VERSION < '1.9'
|
|
136
|
+
prefix = file_name.chars.to_a[0].to_s
|
|
137
|
+
rest = if file_name.chars.to_a[2..-1].nil?
|
|
138
|
+
nil
|
|
139
|
+
else
|
|
140
|
+
file_name.chars.to_a[2..-1].join
|
|
141
|
+
end
|
|
142
|
+
else
|
|
143
|
+
prefix = file_name[0]
|
|
144
|
+
rest = file_name[2..-1]
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if aruba.config.fixtures_path_prefix == prefix
|
|
148
|
+
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
|
149
|
+
|
|
150
|
+
# rubocop:disable Metrics/LineLength
|
|
151
|
+
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
|
|
152
|
+
# rubocop:enable Metrics/LineLength
|
|
153
|
+
|
|
154
|
+
path
|
|
155
|
+
elsif '~' == prefix
|
|
156
|
+
path = with_environment do
|
|
157
|
+
ArubaPath.new(File.expand_path(file_name))
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
fail ArgumentError, 'Expanding "~/" to "/" is not allowed' if path.to_s == '/'
|
|
161
|
+
fail ArgumentError, %(Expanding "~/" to a relative path "#{path}" is not allowed) unless path.absolute?
|
|
162
|
+
|
|
163
|
+
path.to_s
|
|
164
|
+
else
|
|
165
|
+
directory = File.join(aruba.root_directory, aruba.current_directory)
|
|
166
|
+
ArubaPath.new(File.join(*[directory, dir_string, file_name].compact)).expand_path.to_s
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
# rubocop:enable Metrics/MethodLength
|
|
170
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
171
|
+
|
|
172
|
+
# Run block with environment
|
|
173
|
+
#
|
|
174
|
+
# @param [Hash] env (optional)
|
|
175
|
+
# The variables to be used for block.
|
|
176
|
+
#
|
|
177
|
+
# @yield
|
|
178
|
+
# The block of code which should be run with the changed environment variables
|
|
179
|
+
def with_environment(env = {}, &block)
|
|
180
|
+
old_aruba_env = aruba.environment.to_h
|
|
181
|
+
|
|
182
|
+
# make sure the old environment is really restored in "ENV"
|
|
183
|
+
Aruba.platform.with_environment aruba.environment.update(env).to_h, &block
|
|
184
|
+
ensure
|
|
185
|
+
# make sure the old environment is really restored in "aruba.environment"
|
|
186
|
+
aruba.environment.clear
|
|
187
|
+
aruba.environment.update old_aruba_env
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -0,0 +1,897 @@
|
|
|
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(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
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
|
527
|
+
# rubocop:disable Metrics/MethodLength
|
|
528
|
+
def check_for_deprecated_variables
|
|
529
|
+
if defined? @aruba_exit_timeout
|
|
530
|
+
Aruba.platform.deprecated('The use of "@aruba_exit_timeout" is deprecated. Use "#aruba.config.exit_timeout = <numeric>" instead')
|
|
531
|
+
aruba.config.exit_timeout = @aruba_exit_timeout
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
if defined? @aruba_io_wait_seconds
|
|
535
|
+
Aruba.platform.deprecated('The use of "@aruba_io_wait_seconds" is deprecated. Use "#aruba.config.io_wait_timeout = <numeric>" instead')
|
|
536
|
+
aruba.config.io_wait_timeout = @aruba_io_wait_seconds
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
if defined? @keep_ansi
|
|
540
|
+
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')
|
|
541
|
+
|
|
542
|
+
aruba.config.remove_ansi_escape_sequences = false
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
if defined? @aruba_root_directory
|
|
546
|
+
Aruba.platform.deprecated('The use of "@aruba_root_directory" is deprecated. Use "#aruba.config.root_directory = <string>" instead')
|
|
547
|
+
|
|
548
|
+
aruba.config.root_directory = @aruba_root_directory.to_s
|
|
549
|
+
end
|
|
550
|
+
end
|
|
551
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
552
|
+
# rubocop:enable Metrics/MethodLength
|
|
553
|
+
|
|
554
|
+
# Last command started
|
|
555
|
+
def last_command
|
|
556
|
+
Aruba.platform.deprecated('The use of "#last_command" is deprecated. Use "#last_command_started"')
|
|
557
|
+
|
|
558
|
+
process_monitor.last_command_started
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
# @deprecated
|
|
562
|
+
#
|
|
563
|
+
# Full compare arg1 and arg2
|
|
564
|
+
#
|
|
565
|
+
# @return [TrueClass, FalseClass]
|
|
566
|
+
# If arg1 is exactly the same as arg2 return true, otherwise false
|
|
567
|
+
def assert_exact_output(expected, actual)
|
|
568
|
+
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"')
|
|
569
|
+
|
|
570
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
|
571
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to eq Aruba.platform.unescape(expected, aruba.config.keep_ansi)
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
# @deprecated
|
|
575
|
+
#
|
|
576
|
+
# Partial compare arg1 and arg2
|
|
577
|
+
#
|
|
578
|
+
# @return [TrueClass, FalseClass]
|
|
579
|
+
# If arg2 contains arg1 return true, otherwise false
|
|
580
|
+
def assert_partial_output(expected, actual)
|
|
581
|
+
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"')
|
|
582
|
+
|
|
583
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
|
584
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to include(Aruba.platform.unescape(expected, aruba.config.keep_ansi))
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
# @deprecated
|
|
588
|
+
#
|
|
589
|
+
# Regex Compare arg1 and arg2
|
|
590
|
+
#
|
|
591
|
+
# @return [TrueClass, FalseClass]
|
|
592
|
+
# If arg2 matches arg1 return true, otherwise false
|
|
593
|
+
def assert_matching_output(expected, actual)
|
|
594
|
+
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"')
|
|
595
|
+
|
|
596
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
|
597
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
# @deprecated
|
|
601
|
+
#
|
|
602
|
+
# Negative regex compare arg1 and arg2
|
|
603
|
+
#
|
|
604
|
+
# @return [TrueClass, FalseClass]
|
|
605
|
+
# If arg2 does not match arg1 return true, otherwise false
|
|
606
|
+
def assert_not_matching_output(expected, actual)
|
|
607
|
+
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"')
|
|
608
|
+
|
|
609
|
+
actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
|
|
610
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
# @deprecated
|
|
614
|
+
#
|
|
615
|
+
# Negative partial compare arg1 and arg2
|
|
616
|
+
#
|
|
617
|
+
# @return [TrueClass, FalseClass]
|
|
618
|
+
# If arg2 does not match/include arg1 return true, otherwise false
|
|
619
|
+
def assert_no_partial_output(unexpected, actual)
|
|
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
|
+
|
|
622
|
+
actual.force_encoding(unexpected.encoding) if RUBY_VERSION >= "1.9"
|
|
623
|
+
if Regexp === unexpected
|
|
624
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to match unexpected
|
|
625
|
+
else
|
|
626
|
+
expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).not_to include(unexpected)
|
|
627
|
+
end
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
# @deprecated
|
|
631
|
+
#
|
|
632
|
+
# Partial compare output of interactive command and arg1
|
|
633
|
+
#
|
|
634
|
+
# @return [TrueClass, FalseClass]
|
|
635
|
+
# If output of interactive command includes arg1 return true, otherwise false
|
|
636
|
+
def assert_partial_output_interactive(expected)
|
|
637
|
+
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"')
|
|
638
|
+
|
|
639
|
+
Aruba.platform.unescape(last_command_started.stdout, aruba.config.keep_ansi).include?(Aruba.platform.unescape(expected, aruba.config.keep_ansi)) ? true : false
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
# @deprecated
|
|
643
|
+
#
|
|
644
|
+
# Check if command succeeded and if arg1 is included in output
|
|
645
|
+
#
|
|
646
|
+
# @return [TrueClass, FalseClass]
|
|
647
|
+
# If exit status is 0 and arg1 is included in output return true, otherwise false
|
|
648
|
+
def assert_passing_with(expected)
|
|
649
|
+
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"')
|
|
650
|
+
|
|
651
|
+
assert_success(true)
|
|
652
|
+
assert_partial_output(expected, all_output)
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
# @deprecated
|
|
656
|
+
#
|
|
657
|
+
# Check if command failed and if arg1 is included in output
|
|
658
|
+
#
|
|
659
|
+
# @return [TrueClass, FalseClass]
|
|
660
|
+
# If exit status is not equal 0 and arg1 is included in output return true, otherwise false
|
|
661
|
+
def assert_failing_with(expected)
|
|
662
|
+
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"')
|
|
663
|
+
|
|
664
|
+
assert_success(false)
|
|
665
|
+
assert_partial_output(expected, all_output)
|
|
666
|
+
end
|
|
667
|
+
|
|
668
|
+
# @deprecated
|
|
669
|
+
#
|
|
670
|
+
# Check exit status of process
|
|
671
|
+
#
|
|
672
|
+
# @return [TrueClass, FalseClass]
|
|
673
|
+
# If arg1 is true, return true if command was successful
|
|
674
|
+
# If arg1 is false, return true if command failed
|
|
675
|
+
def assert_success(success)
|
|
676
|
+
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)')
|
|
677
|
+
|
|
678
|
+
if success
|
|
679
|
+
expect(last_command_started).to be_successfully_executed
|
|
680
|
+
else
|
|
681
|
+
expect(last_command_started).not_to be_successfully_executed
|
|
682
|
+
end
|
|
683
|
+
end
|
|
684
|
+
|
|
685
|
+
# @deprecated
|
|
686
|
+
def assert_exit_status(status)
|
|
687
|
+
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).to have_exit_status(status)"')
|
|
688
|
+
|
|
689
|
+
expect(last_command_started).to have_exit_status(status)
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
# @deprecated
|
|
693
|
+
def assert_not_exit_status(status)
|
|
694
|
+
Aruba.platform.deprecated('The use of "#assert_success" is deprecated. Use "expect(last_command_started).not_to have_exit_status(status)"')
|
|
695
|
+
|
|
696
|
+
expect(last_exit_status).not_to eq(status),
|
|
697
|
+
append_output_to("Exit status was #{last_exit_status} which was not expected.")
|
|
698
|
+
end
|
|
699
|
+
|
|
700
|
+
# @deprecated
|
|
701
|
+
def append_output_to(message)
|
|
702
|
+
Aruba.platform.deprecated('The use of "#append_output_to" is deprecated')
|
|
703
|
+
|
|
704
|
+
"#{message} Output:\n\n#{all_output}\n"
|
|
705
|
+
end
|
|
706
|
+
|
|
707
|
+
# @deprecated
|
|
708
|
+
def register_process(*args)
|
|
709
|
+
# Aruba.platform.deprecated('The use of "#register_process" is deprecated')
|
|
710
|
+
|
|
711
|
+
process_monitor.register_process(*args)
|
|
712
|
+
end
|
|
713
|
+
|
|
714
|
+
# @deprecated
|
|
715
|
+
def get_process(wanted)
|
|
716
|
+
# Aruba.platform.deprecated('The use of "#get_process" is deprecated')
|
|
717
|
+
|
|
718
|
+
process_monitor.get_process(wanted)
|
|
719
|
+
end
|
|
720
|
+
|
|
721
|
+
# @deprecated
|
|
722
|
+
#
|
|
723
|
+
# Fetch output (stdout, stderr) from command
|
|
724
|
+
#
|
|
725
|
+
# @param [String] cmd
|
|
726
|
+
# The command
|
|
727
|
+
def output_from(cmd)
|
|
728
|
+
# Aruba.platform.deprecated('The use of "#output_from" is deprecated')
|
|
729
|
+
|
|
730
|
+
process_monitor.output_from(cmd)
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# @deprecated
|
|
734
|
+
#
|
|
735
|
+
# Fetch stdout from command
|
|
736
|
+
#
|
|
737
|
+
# @param [String] cmd
|
|
738
|
+
# The command
|
|
739
|
+
def stdout_from(cmd)
|
|
740
|
+
# Aruba.platform.deprecated('The use of "#stdout_from" is deprecated')
|
|
741
|
+
|
|
742
|
+
process_monitor.stdout_from(cmd)
|
|
743
|
+
end
|
|
744
|
+
|
|
745
|
+
# @deprecated
|
|
746
|
+
#
|
|
747
|
+
# Fetch stderr from command
|
|
748
|
+
#
|
|
749
|
+
# @param [String] cmd
|
|
750
|
+
# The command
|
|
751
|
+
def stderr_from(cmd)
|
|
752
|
+
# Aruba.platform.deprecated('The use of "#stderr_from" is deprecated')
|
|
753
|
+
|
|
754
|
+
process_monitor.stderr_from(cmd)
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
# @deprecated
|
|
758
|
+
#
|
|
759
|
+
# Get stdout of all processes
|
|
760
|
+
#
|
|
761
|
+
# @return [String]
|
|
762
|
+
# The stdout of all process which have run before
|
|
763
|
+
def all_stdout
|
|
764
|
+
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')
|
|
765
|
+
|
|
766
|
+
process_monitor.all_stdout
|
|
767
|
+
end
|
|
768
|
+
|
|
769
|
+
# @deprecated
|
|
770
|
+
#
|
|
771
|
+
# Get stderr of all processes
|
|
772
|
+
#
|
|
773
|
+
# @return [String]
|
|
774
|
+
# The stderr of all process which have run before
|
|
775
|
+
def all_stderr
|
|
776
|
+
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')
|
|
777
|
+
|
|
778
|
+
process_monitor.all_stderr
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
# @deprecated
|
|
782
|
+
#
|
|
783
|
+
# Get stderr and stdout of all processes
|
|
784
|
+
#
|
|
785
|
+
# @return [String]
|
|
786
|
+
# The stderr and stdout of all process which have run before
|
|
787
|
+
def all_output
|
|
788
|
+
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')
|
|
789
|
+
|
|
790
|
+
process_monitor.all_output
|
|
791
|
+
end
|
|
792
|
+
|
|
793
|
+
# @deprecated
|
|
794
|
+
#
|
|
795
|
+
# Default exit timeout for running commands with aruba
|
|
796
|
+
#
|
|
797
|
+
# Overwrite this method if you want a different timeout or set
|
|
798
|
+
# `@aruba_timeout_seconds`.
|
|
799
|
+
def exit_timeout
|
|
800
|
+
Aruba.platform.deprecated('The use of "#exit_timeout" is deprecated. Use "aruba.config.exit_timeout" instead.')
|
|
801
|
+
|
|
802
|
+
aruba.config.exit_timeout
|
|
803
|
+
end
|
|
804
|
+
|
|
805
|
+
# @deprecated
|
|
806
|
+
#
|
|
807
|
+
# Default io wait timeout
|
|
808
|
+
#
|
|
809
|
+
# Overwrite this method if you want a different timeout or set
|
|
810
|
+
# `@aruba_io_wait_seconds
|
|
811
|
+
def io_wait
|
|
812
|
+
Aruba.platform.deprecated('The use of "#io_wait" is deprecated. Use "aruba.config.io_wait_timeout" instead')
|
|
813
|
+
|
|
814
|
+
aruba.config.io_wait_timeout
|
|
815
|
+
end
|
|
816
|
+
|
|
817
|
+
# @deprecated
|
|
818
|
+
# Only processes
|
|
819
|
+
def only_processes
|
|
820
|
+
Aruba.platform.deprecated('The use of "#only_processes" is deprecated. Use "#all_commands" instead')
|
|
821
|
+
|
|
822
|
+
process_monitor.only_processes
|
|
823
|
+
end
|
|
824
|
+
|
|
825
|
+
# @deprecated
|
|
826
|
+
def last_exit_status
|
|
827
|
+
Aruba.platform.deprecated('The use of "#last_exit_status" is deprecated. Use "#last_command_(started|stopped).exit_status" instead')
|
|
828
|
+
|
|
829
|
+
process_monitor.last_exit_status
|
|
830
|
+
end
|
|
831
|
+
|
|
832
|
+
# @deprecated
|
|
833
|
+
def stop_process(process)
|
|
834
|
+
# Aruba.platform.deprecated('The use of "#stop_process" is deprecated. Use "#last_command_(started|stopped).stop" instead')
|
|
835
|
+
|
|
836
|
+
@last_exit_status = process_monitor.stop_process(process)
|
|
837
|
+
end
|
|
838
|
+
|
|
839
|
+
# @deprecated
|
|
840
|
+
def terminate_process(process)
|
|
841
|
+
# Aruba.platform.deprecated('The use of "#terminate_process" is deprecated. Use "#last_command_(started|stopped).terminate" instead')
|
|
842
|
+
|
|
843
|
+
process_monitor.terminate_process(process)
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
# @deprecated
|
|
847
|
+
def stop_processes!
|
|
848
|
+
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "#stop_all_commands" instead')
|
|
849
|
+
|
|
850
|
+
stop_all_commands
|
|
851
|
+
end
|
|
852
|
+
|
|
853
|
+
# @deprecated
|
|
854
|
+
#
|
|
855
|
+
# Terminate all running processes
|
|
856
|
+
def terminate_processes!
|
|
857
|
+
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "all_commands.each(&:terminate)" instead')
|
|
858
|
+
|
|
859
|
+
all_commands.each(&:terminate)
|
|
860
|
+
end
|
|
861
|
+
|
|
862
|
+
# @deprecated
|
|
863
|
+
#
|
|
864
|
+
# Access to announcer
|
|
865
|
+
def announcer
|
|
866
|
+
Aruba.platform.deprecated('The use of "#announcer" is deprecated. Use "aruba.announcer" instead')
|
|
867
|
+
|
|
868
|
+
@announcer ||= Platforms::Announcer.new(
|
|
869
|
+
self,
|
|
870
|
+
:stdout => defined?(@announce_stdout),
|
|
871
|
+
:stderr => defined?(@announce_stderr),
|
|
872
|
+
:dir => defined?(@announce_dir),
|
|
873
|
+
:cmd => defined?(@announce_cmd),
|
|
874
|
+
:env => defined?(@announce_env)
|
|
875
|
+
)
|
|
876
|
+
|
|
877
|
+
@announcer
|
|
878
|
+
end
|
|
879
|
+
|
|
880
|
+
# @private
|
|
881
|
+
# @deprecated
|
|
882
|
+
def process_monitor
|
|
883
|
+
Aruba.platform.deprecated('The use of "#process_monitor" is deprecated.')
|
|
884
|
+
|
|
885
|
+
aruba.command_monitor
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
# @private
|
|
889
|
+
# @deprecated
|
|
890
|
+
def processes
|
|
891
|
+
Aruba.platform.deprecated('The use of "#process_monitor" is deprecated. Please use "#all_commands" instead.')
|
|
892
|
+
|
|
893
|
+
aruba.command_monitor.send(:processes)
|
|
894
|
+
end
|
|
895
|
+
end
|
|
896
|
+
end
|
|
897
|
+
end
|