aruba 0.14.10 → 1.0.0
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/.cucumberproignore +3 -0
- data/.github/ISSUE_TEMPLATE.md +48 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +41 -0
- data/.gitignore +1 -0
- data/.rspec +1 -1
- data/.rubocop.yml +20 -181
- data/.rubocop_todo.yml +262 -0
- data/.simplecov +7 -5
- data/.travis.yml +53 -25
- data/.yardopts +3 -0
- data/CHANGELOG.md +585 -248
- data/CONTRIBUTING.md +247 -45
- data/Dockerfile +67 -0
- data/Gemfile +5 -106
- data/LICENSE +1 -1
- data/README.md +57 -180
- data/Rakefile +63 -32
- data/appveyor.yml +8 -11
- data/aruba.gemspec +47 -41
- data/bin/console +7 -0
- data/bin/test +9 -0
- data/cucumber.yml +4 -24
- data/doc/dependency_decisions.yml +42 -2
- data/docker-compose.yml +26 -0
- data/{bin → exe}/aruba +1 -1
- data/fixtures/cli-app/Rakefile +1 -1
- data/fixtures/cli-app/bin/aruba-test-cli +1 -1
- data/fixtures/cli-app/cli-app.gemspec +1 -2
- data/fixtures/cli-app/features/support/aruba.rb +1 -0
- data/fixtures/cli-app/features/support/env.rb +1 -1
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
- data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
- data/fixtures/cli-app/lib/cli/app.rb +1 -5
- data/fixtures/cli-app/spec/spec_helper.rb +4 -7
- data/fixtures/empty-app/Rakefile +1 -1
- data/fixtures/empty-app/cli-app.gemspec +1 -2
- data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
- data/fixtures/getting-started-app/Gemfile +1 -1
- data/lib/aruba/api/commands.rb +85 -143
- data/lib/aruba/api/core.rb +48 -41
- data/lib/aruba/api/environment.rb +16 -7
- data/lib/aruba/api/filesystem.rb +43 -30
- data/lib/aruba/api/text.rb +3 -9
- data/lib/aruba/api.rb +6 -11
- data/lib/aruba/aruba_path.rb +27 -89
- data/lib/aruba/basic_configuration.rb +4 -24
- data/lib/aruba/cli.rb +1 -1
- data/lib/aruba/command.rb +2 -0
- data/lib/aruba/config/jruby.rb +1 -1
- data/lib/aruba/config_wrapper.rb +1 -1
- data/lib/aruba/configuration.rb +92 -0
- data/lib/aruba/console/help.rb +1 -7
- data/lib/aruba/console.rb +5 -5
- data/lib/aruba/contracts/absolute_path.rb +2 -2
- data/lib/aruba/contracts/relative_path.rb +2 -2
- data/lib/aruba/cucumber/command.rb +136 -95
- data/lib/aruba/cucumber/environment.rb +1 -1
- data/lib/aruba/cucumber/file.rb +21 -23
- data/lib/aruba/cucumber/hooks.rb +18 -13
- data/lib/aruba/cucumber/testing_frameworks.rb +74 -50
- data/lib/aruba/cucumber.rb +0 -6
- data/lib/aruba/event_bus/name_resolver.rb +5 -16
- data/lib/aruba/hooks.rb +1 -1
- data/lib/aruba/in_config_wrapper.rb +5 -1
- data/lib/aruba/initializer.rb +36 -42
- data/lib/aruba/matchers/base/base_matcher.rb +2 -2
- data/lib/aruba/matchers/base/message_indenter.rb +19 -0
- data/lib/aruba/matchers/base/object_formatter.rb +2 -9
- data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
- data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
- data/lib/aruba/matchers/command/have_exit_status.rb +14 -4
- data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -5
- data/lib/aruba/matchers/command/have_output.rb +10 -5
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +2 -2
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +2 -2
- data/lib/aruba/matchers/command/have_output_size.rb +2 -2
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +5 -7
- data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
- data/lib/aruba/matchers/file/be_an_existing_file.rb +5 -7
- data/lib/aruba/matchers/file/have_file_content.rb +4 -4
- data/lib/aruba/matchers/file/have_file_size.rb +6 -8
- data/lib/aruba/matchers/file/have_same_file_content.rb +5 -8
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
- data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
- data/lib/aruba/matchers/path/have_permissions.rb +6 -8
- data/lib/aruba/matchers/string/include_output_string.rb +8 -10
- data/lib/aruba/matchers/string/match_output_string.rb +9 -11
- data/lib/aruba/matchers/string/output_string_eq.rb +8 -10
- data/lib/aruba/platform.rb +0 -8
- data/lib/aruba/platforms/announcer.rb +42 -79
- data/lib/aruba/platforms/aruba_file_creator.rb +2 -6
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
- data/lib/aruba/platforms/aruba_logger.rb +23 -7
- data/lib/aruba/platforms/command_monitor.rb +12 -104
- data/lib/aruba/platforms/determine_disk_usage.rb +56 -14
- data/lib/aruba/platforms/filesystem_status.rb +10 -14
- data/lib/aruba/platforms/local_environment.rb +2 -2
- data/lib/aruba/platforms/simple_table.rb +3 -11
- data/lib/aruba/platforms/unix_command_string.rb +7 -11
- data/lib/aruba/platforms/unix_environment_variables.rb +18 -27
- data/lib/aruba/platforms/unix_platform.rb +20 -51
- data/lib/aruba/platforms/unix_which.rb +2 -1
- data/lib/aruba/platforms/windows_command_string.rb +15 -10
- data/lib/aruba/platforms/windows_environment_variables.rb +43 -44
- data/lib/aruba/platforms/windows_platform.rb +4 -0
- data/lib/aruba/platforms/windows_which.rb +4 -3
- data/lib/aruba/processes/basic_process.rb +28 -30
- data/lib/aruba/processes/debug_process.rb +12 -3
- data/lib/aruba/processes/in_process.rb +17 -8
- data/lib/aruba/processes/spawn_process.rb +40 -41
- data/lib/aruba/rspec.rb +14 -36
- data/lib/aruba/runtime.rb +3 -6
- data/lib/aruba/setup.rb +6 -6
- data/lib/aruba/tasks/docker_helpers.rb +154 -0
- data/lib/aruba/version.rb +1 -1
- metadata +190 -236
- data/features/.nav +0 -72
- data/features/01_getting_started_with_aruba/cleanup_working_directory.feature +0 -57
- data/features/01_getting_started_with_aruba/run_commands.feature +0 -217
- data/features/01_getting_started_with_aruba/supported_testing_frameworks.feature +0 -88
- data/features/02_configure_aruba/activate_announcer_on_command_failure.feature +0 -38
- data/features/02_configure_aruba/basics.feature +0 -151
- data/features/02_configure_aruba/command_runtime_environment.feature +0 -129
- data/features/02_configure_aruba/console_history_file.feature +0 -38
- data/features/02_configure_aruba/exit_timeout.feature +0 -60
- data/features/02_configure_aruba/fixtures_directories.feature +0 -38
- data/features/02_configure_aruba/fixtures_path_prefix.feature +0 -23
- data/features/02_configure_aruba/home_directory.feature +0 -80
- data/features/02_configure_aruba/io_timeout.feature +0 -30
- data/features/02_configure_aruba/keep_ansi.feature +0 -30
- data/features/02_configure_aruba/log_level.feature +0 -38
- data/features/02_configure_aruba/physical_block_size.feature +0 -53
- data/features/02_configure_aruba/remove_ansi_escape_sequences.feature +0 -38
- data/features/02_configure_aruba/root_directory.feature +0 -30
- data/features/02_configure_aruba/startup_wait_time.feature +0 -48
- data/features/02_configure_aruba/working_directory.feature +0 -38
- data/features/03_testing_frameworks/cucumber/announce_information_for_troubleshooting.feature +0 -263
- data/features/03_testing_frameworks/cucumber/disable_bunder.feature +0 -18
- data/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature +0 -136
- data/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature +0 -514
- data/features/03_testing_frameworks/cucumber/steps/command/check_stderr_of_command.feature +0 -68
- data/features/03_testing_frameworks/cucumber/steps/command/check_stdout_of_command.feature +0 -109
- data/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature +0 -92
- data/features/03_testing_frameworks/cucumber/steps/command/run_a_command.feature +0 -66
- data/features/03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature +0 -485
- data/features/03_testing_frameworks/cucumber/steps/command/run_command_interactively.feature +0 -90
- data/features/03_testing_frameworks/cucumber/steps/command/run_commands_which_require_a_shell.feature +0 -79
- data/features/03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature +0 -83
- data/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature +0 -285
- data/features/03_testing_frameworks/cucumber/steps/environment/append_environment_variable.feature +0 -52
- data/features/03_testing_frameworks/cucumber/steps/environment/modify_home_variable_for_testing.feature +0 -62
- data/features/03_testing_frameworks/cucumber/steps/environment/prepend_environment_variable.feature +0 -52
- data/features/03_testing_frameworks/cucumber/steps/environment/set_environment_variable.feature +0 -49
- data/features/03_testing_frameworks/cucumber/steps/filesystem/append_to_file.feature +0 -45
- data/features/03_testing_frameworks/cucumber/steps/filesystem/cd_to_directory.feature +0 -33
- data/features/03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_directory.feature +0 -57
- data/features/03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_file.feature +0 -43
- data/features/03_testing_frameworks/cucumber/steps/filesystem/check_file_content.feature +0 -143
- data/features/03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_directory.feature +0 -69
- data/features/03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_file.feature +0 -80
- data/features/03_testing_frameworks/cucumber/steps/filesystem/check_permissions_of_file.feature +0 -39
- data/features/03_testing_frameworks/cucumber/steps/filesystem/compare_files.feature +0 -42
- data/features/03_testing_frameworks/cucumber/steps/filesystem/copy_file_or_directory.feature +0 -45
- data/features/03_testing_frameworks/cucumber/steps/filesystem/create_directory.feature +0 -57
- data/features/03_testing_frameworks/cucumber/steps/filesystem/create_file.feature +0 -76
- data/features/03_testing_frameworks/cucumber/steps/filesystem/move_file_or_directory.feature +0 -44
- data/features/03_testing_frameworks/cucumber/steps/filesystem/overwrite_file.feature +0 -72
- data/features/03_testing_frameworks/cucumber/steps/filesystem/remove_directory.feature +0 -38
- data/features/03_testing_frameworks/cucumber/steps/filesystem/remove_file.feature +0 -38
- data/features/03_testing_frameworks/cucumber/steps/filesystem/use_fixtures_for_setup_test.feature +0 -77
- data/features/03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature +0 -43
- data/features/03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature +0 -71
- data/features/03_testing_frameworks/rspec/setup_aruba_for_rspec.feature +0 -179
- data/features/04_aruba_api/command/find_a_started_command.feature +0 -83
- data/features/04_aruba_api/command/find_command_in_PATH.feature +0 -37
- data/features/04_aruba_api/command/read_stderr_of_command.feature +0 -46
- data/features/04_aruba_api/command/read_stdout_of_command.feature +0 -46
- data/features/04_aruba_api/command/run_command.feature +0 -423
- data/features/04_aruba_api/command/run_simple.feature +0 -254
- data/features/04_aruba_api/command/send_signal_to_command.feature +0 -53
- data/features/04_aruba_api/command/stop_all_commands.feature +0 -57
- data/features/04_aruba_api/command/stop_single_command.feature +0 -132
- data/features/04_aruba_api/command/terminate_all_commands.feature +0 -57
- data/features/04_aruba_api/command/use_last_command_started.feature +0 -50
- data/features/04_aruba_api/command/use_last_command_stopped.feature +0 -89
- data/features/04_aruba_api/core/expand_path.feature +0 -88
- data/features/04_aruba_api/environment/append_environment_variable.feature +0 -128
- data/features/04_aruba_api/environment/delete_environment_variable.feature +0 -63
- data/features/04_aruba_api/environment/prepend_environment_variable.feature +0 -128
- data/features/04_aruba_api/environment/set_environment_variable.feature +0 -376
- data/features/04_aruba_api/filesystem/cd_to_directory.feature +0 -184
- data/features/04_aruba_api/filesystem/check_existence_file_or_directory.feature +0 -62
- data/features/04_aruba_api/filesystem/check_if_path_is_absolute.feature +0 -48
- data/features/04_aruba_api/filesystem/check_if_path_is_directory.feature +0 -53
- data/features/04_aruba_api/filesystem/check_if_path_is_file.feature +0 -54
- data/features/04_aruba_api/filesystem/check_if_path_is_relative.feature +0 -48
- data/features/04_aruba_api/filesystem/create_directory.feature +0 -57
- data/features/04_aruba_api/filesystem/move_file_or_directory.feature +0 -119
- data/features/04_aruba_api/filesystem/report_disk_usage.feature +0 -152
- data/features/04_aruba_api/filesystem/use_fixtures.feature +0 -104
- data/features/04_aruba_api/text/extract_text.feature +0 -87
- data/features/04_aruba_api/text/replace_variables.feature +0 -45
- data/features/04_aruba_api/text/sanitize_text.feature +0 -228
- data/features/04_aruba_api/text/unescape_text.feature +0 -127
- data/features/05_use_rspec_matchers/command/check_timeouts.feature +0 -48
- data/features/05_use_rspec_matchers/directory/have_sub_directory.feature +0 -110
- data/features/05_use_rspec_matchers/file/be_a_command_found_in_path.feature +0 -115
- data/features/05_use_rspec_matchers/file/be_existing_executable.feature +0 -88
- data/features/05_use_rspec_matchers/file/be_existing_file.feature +0 -82
- data/features/05_use_rspec_matchers/file/have_file_content.feature +0 -123
- data/features/05_use_rspec_matchers/file/have_file_size.feature +0 -107
- data/features/05_use_rspec_matchers/path/be_an_absolute_path.feature +0 -74
- data/features/05_use_rspec_matchers/path/be_an_existing_path.feature +0 -97
- data/features/05_use_rspec_matchers/path/have_permissions.feature +0 -118
- data/features/06_use_aruba_cli/initialize_project_with_aruba.feature +0 -79
- data/features/06_use_aruba_cli/open_console.feature +0 -52
- data/features/08_other/improve_performance_if_using_jruby.feature +0 -37
- data/features/step_definitions/hooks.rb +0 -146
- data/features/support/aruba.rb +0 -7
- data/features/support/env.rb +0 -33
- data/features/support/jruby.rb +0 -5
- data/features/support/simplecov_setup.rb +0 -11
- data/fixtures/spawn_process/stderr.sh +0 -3
- data/lib/aruba/api/deprecated.rb +0 -1163
- data/lib/aruba/config.rb +0 -107
- data/lib/aruba/cucumber/core.rb +0 -5
- data/lib/aruba/cucumber/deprecated.rb +0 -93
- data/lib/aruba/cucumber/rvm.rb +0 -3
- data/lib/aruba/in_process.rb +0 -16
- data/lib/aruba/jruby.rb +0 -4
- data/lib/aruba/matchers/deprecated/file.rb +0 -17
- data/lib/aruba/matchers/deprecated.rb +0 -1
- data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
- data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
- data/lib/aruba/reporting.rb +0 -126
- data/lib/aruba/spawn_process.rb +0 -14
- data/script/bootstrap +0 -24
- data/script/console +0 -16
- data/script/test +0 -3
- data/spec/aruba/api/bundler_spec.rb +0 -15
- data/spec/aruba/api/core_spec.rb +0 -142
- data/spec/aruba/api/deprecated_spec.rb +0 -421
- data/spec/aruba/api/filesystem_spec.rb +0 -746
- data/spec/aruba/api/runtime_spec.rb +0 -28
- data/spec/aruba/api_spec.rb +0 -97
- data/spec/aruba/aruba_path_spec.rb +0 -103
- data/spec/aruba/basic_configuration_spec.rb +0 -5
- data/spec/aruba/configuration_spec.rb +0 -5
- data/spec/aruba/hooks_spec.rb +0 -17
- data/spec/aruba/in_config_wrapper_spec.rb +0 -25
- data/spec/aruba/jruby_spec.rb +0 -73
- data/spec/aruba/matchers/command/have_output_size_spec.rb +0 -25
- data/spec/aruba/matchers/command_spec.rb +0 -174
- data/spec/aruba/matchers/deprecated_spec.rb +0 -120
- data/spec/aruba/matchers/directory_spec.rb +0 -57
- data/spec/aruba/matchers/file_spec.rb +0 -208
- data/spec/aruba/matchers/path_spec.rb +0 -58
- data/spec/aruba/platform/simple_table_spec.rb +0 -23
- data/spec/aruba/platform/windows_environment_variables_spec.rb +0 -500
- data/spec/aruba/platforms/unix_command_string_spec.rb +0 -17
- data/spec/aruba/platforms/windows_command_string_spec.rb +0 -22
- data/spec/aruba/processes/spawn_process_spec.rb +0 -112
- data/spec/aruba/rspec_spec.rb +0 -15
- data/spec/aruba/runtime_spec.rb +0 -29
- data/spec/event_bus/name_resolver_spec.rb +0 -68
- data/spec/event_bus_spec.rb +0 -158
- data/spec/spec_helper.rb +0 -22
- data/spec/support/configs/.keep +0 -0
- data/spec/support/configs/aruba.rb +0 -5
- data/spec/support/configs/pry.rb +0 -3
- data/spec/support/configs/rspec.rb +0 -15
- data/spec/support/helpers/.keep +0 -0
- data/spec/support/helpers/reporting.rb +0 -44
- data/spec/support/matchers/.keep +0 -0
- data/spec/support/matchers/option.rb +0 -35
- data/spec/support/shared_contexts/.keep +0 -0
- data/spec/support/shared_contexts/aruba.rb +0 -49
- data/spec/support/shared_examples/.keep +0 -0
- data/spec/support/shared_examples/configuration.rb +0 -116
- data/spec/support/shared_examples/directory.rb +0 -7
- data/spec/support/shared_examples/file.rb +0 -7
- data/templates/css/console.css +0 -24
- data/templates/css/filesystem.css +0 -42
- data/templates/css/pygments-autumn.css +0 -59
- data/templates/files.erb +0 -14
- data/templates/images/LICENSE +0 -22
- 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 +0 -20
- data/templates/js/filesystem.js +0 -5
- data/templates/js/jquery-1.11.3.min.js +0 -5
- data/templates/main.erb +0 -34
data/{bin → exe}/aruba
RENAMED
data/fixtures/cli-app/Rakefile
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'aruba/cucumber'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative 'aruba'
|
|
@@ -2,12 +2,12 @@ module SimpleCov
|
|
|
2
2
|
module Formatter
|
|
3
3
|
class HTMLFormatter
|
|
4
4
|
def format(result)
|
|
5
|
-
Dir[File.join(File.dirname(__FILE__),
|
|
5
|
+
Dir[File.join(File.dirname(__FILE__), '../public/*')].each do |path|
|
|
6
6
|
FileUtils.cp_r(path, asset_output_path)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
File.open(File.join(output_path,
|
|
10
|
-
file.puts template(
|
|
9
|
+
File.open(File.join(output_path, 'index.html'), 'wb') do |file|
|
|
10
|
+
file.puts template('layout').result(binding)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
require 'cli/app/version'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
::Dir.glob(::File.expand_path('../**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
|
5
|
-
else
|
|
6
|
-
::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f }
|
|
7
|
-
end
|
|
3
|
+
::Dir.glob(File.expand_path('**/*.rb', __dir__)).each { |f| require_relative f }
|
|
8
4
|
|
|
9
5
|
module Cli
|
|
10
6
|
module App
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
|
2
2
|
|
|
3
3
|
require 'cli/app'
|
|
4
|
-
require 'support/aruba'
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
|
|
10
|
-
end
|
|
5
|
+
require_relative 'support/aruba'
|
|
6
|
+
|
|
7
|
+
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
|
data/fixtures/empty-app/Rakefile
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/aruba/api/commands.rb
CHANGED
|
@@ -5,17 +5,6 @@ require 'aruba/command'
|
|
|
5
5
|
|
|
6
6
|
# require 'win32/file' if File::ALT_SEPARATOR
|
|
7
7
|
|
|
8
|
-
# Aruba
|
|
9
|
-
module Aruba
|
|
10
|
-
class << self
|
|
11
|
-
# @deprecated
|
|
12
|
-
attr_accessor :process
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# @deprecated
|
|
16
|
-
# self.process = Aruba::Processes::SpawnProcess
|
|
17
|
-
end
|
|
18
|
-
|
|
19
8
|
# Aruba
|
|
20
9
|
module Aruba
|
|
21
10
|
# Api
|
|
@@ -143,108 +132,33 @@ module Aruba
|
|
|
143
132
|
# @param [Hash] opts
|
|
144
133
|
# Options
|
|
145
134
|
#
|
|
146
|
-
# @option [
|
|
135
|
+
# @option opts [Numeric] exit_timeout
|
|
147
136
|
# If the timeout is reached the command will be killed
|
|
148
137
|
#
|
|
149
|
-
# @option [
|
|
138
|
+
# @option opts [Numeric] io_wait_timeout
|
|
150
139
|
# Wait for IO to finish
|
|
151
140
|
#
|
|
152
|
-
# @option [
|
|
141
|
+
# @option opts [Numeric] startup_wait_time
|
|
153
142
|
# Wait for a command to start
|
|
154
143
|
#
|
|
155
|
-
# @option [String] stop_signal
|
|
144
|
+
# @option opts [String] stop_signal
|
|
156
145
|
# Use signal to stop command
|
|
157
146
|
#
|
|
158
147
|
# @yield [SpawnProcess]
|
|
159
148
|
# Run block with process
|
|
160
149
|
#
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def run_command(*args)
|
|
164
|
-
fail ArgumentError, 'Please pass at least a command as first argument.' if args.empty?
|
|
165
|
-
|
|
166
|
-
cmd = args.shift
|
|
167
|
-
|
|
168
|
-
if args.last.is_a? Hash
|
|
169
|
-
opts = args.pop
|
|
170
|
-
|
|
171
|
-
exit_timeout = opts[:exit_timeout].nil? ? aruba.config.exit_timeout : opts[:exit_timeout]
|
|
172
|
-
io_wait_timeout = opts[:io_wait_timeout].nil? ? aruba.config.io_wait_timeout : opts[:io_wait_timeout]
|
|
173
|
-
stop_signal = opts[:stop_signal].nil? ? aruba.config.stop_signal : opts[:stop_signal]
|
|
174
|
-
startup_wait_time = opts[:startup_wait_time].nil? ? aruba.config.startup_wait_time : opts[:startup_wait_time]
|
|
175
|
-
else
|
|
176
|
-
if args.size > 0
|
|
177
|
-
Aruba.platform.deprecated(
|
|
178
|
-
"Please pass options to `#run_command` as named parameters/hash and don\'t use the old style, e.g. `#run_command('cmd', :exit_timeout => 5)`.")
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
exit_timeout = args[0].nil? ? aruba.config.exit_timeout : args[0]
|
|
182
|
-
io_wait_timeout = args[1].nil? ? aruba.config.io_wait_timeout : args[1]
|
|
183
|
-
stop_signal = args[2].nil? ? aruba.config.stop_signal : args[2]
|
|
184
|
-
startup_wait_time = args[3].nil? ? aruba.config.startup_wait_time : args[3]
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
cmd = replace_variables(cmd)
|
|
150
|
+
def run_command(cmd, opts = {})
|
|
151
|
+
command = prepare_command(cmd, opts)
|
|
188
152
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
environment = aruba.environment
|
|
193
|
-
working_directory = expand_path('.')
|
|
194
|
-
event_bus = aruba.event_bus
|
|
195
|
-
|
|
196
|
-
cmd = Aruba.platform.detect_ruby(cmd)
|
|
197
|
-
|
|
198
|
-
mode = if Aruba.process
|
|
199
|
-
# rubocop:disable Metrics/LineLength
|
|
200
|
-
Aruba.platform.deprecated('The use of "Aruba.process = <process>" and "Aruba.process.main_class" is deprecated. Use "Aruba.configure { |config| config.command_launcher = :in_process|:debug|:spawn }" and "Aruba.configure { |config| config.main_class = <klass> }" instead.')
|
|
201
|
-
# rubocop:enable Metrics/LineLength
|
|
202
|
-
Aruba.process
|
|
203
|
-
else
|
|
204
|
-
aruba.config.command_launcher
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
main_class = if Aruba.process.respond_to?(:main_class) && Aruba.process.main_class
|
|
208
|
-
# rubocop:disable Metrics/LineLength
|
|
209
|
-
Aruba.platform.deprecated('The use of "Aruba.process = <process>" and "Aruba.process.main_class" is deprecated. Use "Aruba.configure { |config| config.command_launcher = :in_process|:debug|:spawn }" and "Aruba.configure { |config| config.main_class = <klass> }" instead.')
|
|
210
|
-
# rubocop:enable Metrics/LineLength
|
|
211
|
-
Aruba.process.main_class
|
|
212
|
-
else
|
|
213
|
-
aruba.config.main_class
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
command = Command.new(
|
|
217
|
-
cmd,
|
|
218
|
-
:mode => mode,
|
|
219
|
-
:exit_timeout => exit_timeout,
|
|
220
|
-
:io_wait_timeout => io_wait_timeout,
|
|
221
|
-
:working_directory => working_directory,
|
|
222
|
-
:environment => environment.to_hash,
|
|
223
|
-
:main_class => main_class,
|
|
224
|
-
:stop_signal => stop_signal,
|
|
225
|
-
:startup_wait_time => startup_wait_time,
|
|
226
|
-
:event_bus => event_bus
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
if aruba.config.before? :cmd
|
|
230
|
-
# rubocop:disable Metrics/LineLength
|
|
231
|
-
Aruba.platform.deprecated('The use of "before"-hook" ":cmd" is deprecated. Use ":command" instead. Please be aware that this hook gets the command passed in not the cmdline itself. To get the commandline use "#cmd.commandline"')
|
|
232
|
-
# rubocop:enable Metrics/LineLength
|
|
233
|
-
aruba.config.before(:cmd, self, cmd)
|
|
153
|
+
unless command.interactive?
|
|
154
|
+
raise NotImplementedError,
|
|
155
|
+
'Running interactively is not supported with this process launcher.'
|
|
234
156
|
end
|
|
235
157
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
command.start
|
|
239
|
-
|
|
240
|
-
aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal
|
|
241
|
-
|
|
242
|
-
aruba.config.after(:command, self, command)
|
|
158
|
+
start_command(command)
|
|
243
159
|
|
|
244
160
|
block_given? ? yield(command) : command
|
|
245
161
|
end
|
|
246
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
247
|
-
# rubocop:enable Metrics/MethodLength
|
|
248
162
|
|
|
249
163
|
# Run a command with aruba
|
|
250
164
|
#
|
|
@@ -257,70 +171,45 @@ module Aruba
|
|
|
257
171
|
# @param [Hash] options
|
|
258
172
|
# Options for aruba
|
|
259
173
|
#
|
|
260
|
-
# @option [
|
|
174
|
+
# @option options [Boolean] fail_on_error
|
|
261
175
|
# Should aruba fail on error?
|
|
262
176
|
#
|
|
263
|
-
# @option [
|
|
177
|
+
# @option options [Numeric] exit_timeout
|
|
264
178
|
# Timeout for execution
|
|
265
179
|
#
|
|
266
|
-
# @option [
|
|
180
|
+
# @option options [Numeric] io_wait_timeout
|
|
267
181
|
# Timeout for IO - STDERR, STDOUT
|
|
268
182
|
#
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
fail_on_error = opts.delete(:fail_on_error) == true ? true : false
|
|
279
|
-
else
|
|
280
|
-
if args.size > 0
|
|
281
|
-
# rubocop:disable Metrics/LineLength
|
|
282
|
-
Aruba.platform.deprecated("Please pass options to `#run_command_and_stop` as named parameters/hash and don\'t use the old style with positional parameters, NEW: e.g. `#run_command_and_stop('cmd', :exit_timeout => 5)`.")
|
|
283
|
-
# rubocop:enable Metrics/LineLength
|
|
284
|
-
end
|
|
285
|
-
|
|
286
|
-
fail_on_error = args[0] == false ? false : true
|
|
287
|
-
|
|
288
|
-
opts = {
|
|
289
|
-
:exit_timeout => (args[1] || aruba.config.exit_timeout),
|
|
290
|
-
:io_wait_timeout => (args[2] || aruba.config.io_wait_timeout),
|
|
291
|
-
:stop_signal => (args[3] || aruba.config.stop_signal),
|
|
292
|
-
:startup_wait_time => (args[4] || aruba.config.startup_wait_time)
|
|
293
|
-
}
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
command = run_command(cmd, opts)
|
|
183
|
+
def run_command_and_stop(cmd, opts = {})
|
|
184
|
+
fail_on_error = if opts.key?(:fail_on_error)
|
|
185
|
+
opts.delete(:fail_on_error) == true
|
|
186
|
+
else
|
|
187
|
+
true
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
command = prepare_command(cmd, opts)
|
|
191
|
+
start_command(command)
|
|
297
192
|
command.stop
|
|
298
193
|
|
|
299
|
-
|
|
300
|
-
@last_exit_status = command.exit_status
|
|
301
|
-
@timed_out = command.timed_out?
|
|
302
|
-
end
|
|
194
|
+
return unless fail_on_error
|
|
303
195
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
raise e
|
|
312
|
-
end
|
|
196
|
+
begin
|
|
197
|
+
expect(command).to have_finished_in_time
|
|
198
|
+
expect(command).to be_successfully_executed
|
|
199
|
+
rescue ::RSpec::Expectations::ExpectationNotMetError => e
|
|
200
|
+
aruba.announcer.activate(aruba.config.activate_announcer_on_command_failure)
|
|
201
|
+
aruba.event_bus.notify Events::CommandStopped.new(command)
|
|
202
|
+
raise e
|
|
313
203
|
end
|
|
314
204
|
end
|
|
315
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
316
|
-
# rubocop:enable Metrics/MethodLength
|
|
317
205
|
|
|
318
206
|
# Provide data to command via stdin
|
|
319
207
|
#
|
|
320
208
|
# @param [String] input
|
|
321
209
|
# The input for the command
|
|
322
210
|
def type(input)
|
|
323
|
-
return close_input if
|
|
211
|
+
return close_input if input == "\u0004"
|
|
212
|
+
|
|
324
213
|
last_command_started.write(input << "\n")
|
|
325
214
|
end
|
|
326
215
|
|
|
@@ -328,6 +217,59 @@ module Aruba
|
|
|
328
217
|
def close_input
|
|
329
218
|
last_command_started.close_io(:stdin)
|
|
330
219
|
end
|
|
220
|
+
|
|
221
|
+
private
|
|
222
|
+
|
|
223
|
+
# rubocop:disable Metrics/MethodLength
|
|
224
|
+
def prepare_command(cmd, opts)
|
|
225
|
+
exit_timeout = opts[:exit_timeout].nil? ? aruba.config.exit_timeout : opts[:exit_timeout]
|
|
226
|
+
io_wait_timeout = opts[:io_wait_timeout].nil? ? aruba.config.io_wait_timeout : opts[:io_wait_timeout]
|
|
227
|
+
stop_signal = opts[:stop_signal].nil? ? aruba.config.stop_signal : opts[:stop_signal]
|
|
228
|
+
startup_wait_time = opts[:startup_wait_time].nil? ? aruba.config.startup_wait_time : opts[:startup_wait_time]
|
|
229
|
+
|
|
230
|
+
cmd = replace_variables(cmd)
|
|
231
|
+
|
|
232
|
+
@commands ||= []
|
|
233
|
+
@commands << cmd
|
|
234
|
+
|
|
235
|
+
environment = aruba.environment
|
|
236
|
+
working_directory = expand_path('.')
|
|
237
|
+
event_bus = aruba.event_bus
|
|
238
|
+
|
|
239
|
+
cmd = Aruba.platform.detect_ruby(cmd)
|
|
240
|
+
|
|
241
|
+
mode = aruba.config.command_launcher
|
|
242
|
+
|
|
243
|
+
main_class = aruba.config.main_class
|
|
244
|
+
|
|
245
|
+
Command.new(
|
|
246
|
+
cmd,
|
|
247
|
+
mode: mode,
|
|
248
|
+
exit_timeout: exit_timeout,
|
|
249
|
+
io_wait_timeout: io_wait_timeout,
|
|
250
|
+
working_directory: working_directory,
|
|
251
|
+
environment: environment.to_hash,
|
|
252
|
+
main_class: main_class,
|
|
253
|
+
stop_signal: stop_signal,
|
|
254
|
+
startup_wait_time: startup_wait_time,
|
|
255
|
+
event_bus: event_bus
|
|
256
|
+
)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# rubocop:enable Metrics/MethodLength
|
|
260
|
+
|
|
261
|
+
def start_command(command)
|
|
262
|
+
aruba.config.before(:command, self, command)
|
|
263
|
+
|
|
264
|
+
in_current_directory do
|
|
265
|
+
command.start
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
stop_signal = command.stop_signal
|
|
269
|
+
aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal
|
|
270
|
+
|
|
271
|
+
aruba.config.after(:command, self, command)
|
|
272
|
+
end
|
|
331
273
|
end
|
|
332
274
|
end
|
|
333
275
|
end
|
data/lib/aruba/api/core.rb
CHANGED
|
@@ -15,6 +15,8 @@ module Aruba
|
|
|
15
15
|
|
|
16
16
|
# Aruba Runtime
|
|
17
17
|
def aruba
|
|
18
|
+
# TODO: Check this variable being accessed inconsistently. Should only be using the memo!
|
|
19
|
+
# Renaming this to `aruba` causes 100's of rspec failures. Needs a deeper dive, approach with caution!
|
|
18
20
|
@_aruba_runtime ||= Runtime.new
|
|
19
21
|
end
|
|
20
22
|
|
|
@@ -62,15 +64,16 @@ module Aruba
|
|
|
62
64
|
aruba.current_directory << dir
|
|
63
65
|
new_directory = expand_path('.')
|
|
64
66
|
|
|
65
|
-
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(:
|
|
67
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory, new: new_directory)
|
|
66
68
|
|
|
67
69
|
old_dir = Aruba.platform.getwd
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
real_new_directory = File.expand_path(aruba.current_directory, aruba.root_directory)
|
|
72
|
+
Aruba.platform.chdir real_new_directory
|
|
70
73
|
|
|
71
74
|
result = with_environment(
|
|
72
75
|
'OLDPWD' => old_dir,
|
|
73
|
-
'PWD' =>
|
|
76
|
+
'PWD' => real_new_directory,
|
|
74
77
|
&block
|
|
75
78
|
)
|
|
76
79
|
ensure
|
|
@@ -87,7 +90,7 @@ module Aruba
|
|
|
87
90
|
aruba.current_directory << dir
|
|
88
91
|
new_directory = expand_path('.')
|
|
89
92
|
|
|
90
|
-
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(:
|
|
93
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory, new: new_directory)
|
|
91
94
|
|
|
92
95
|
self
|
|
93
96
|
end
|
|
@@ -124,58 +127,66 @@ module Aruba
|
|
|
124
127
|
# # => <path>/test/fixtures/file
|
|
125
128
|
# expand_path('%/file')
|
|
126
129
|
#
|
|
130
|
+
# @example Absolute directory
|
|
131
|
+
#
|
|
132
|
+
# # => /foo/bar
|
|
133
|
+
# expand_path('/foo/bar')
|
|
134
|
+
#
|
|
127
135
|
# rubocop:disable Metrics/MethodLength
|
|
128
136
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
137
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
|
129
138
|
def expand_path(file_name, dir_string = nil)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
# rubocop:disable Metrics/LineLength
|
|
139
|
+
# rubocop:disable Layout/LineLength
|
|
133
140
|
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.)
|
|
134
|
-
# rubocop:enable
|
|
141
|
+
# rubocop:enable Layout/LineLength
|
|
135
142
|
|
|
136
143
|
fail ArgumentError, message unless file_name.is_a?(String) && !file_name.empty?
|
|
137
144
|
|
|
138
|
-
# rubocop:disable
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
nil
|
|
146
|
-
else
|
|
147
|
-
file_name.chars.to_a[2..-1].join
|
|
148
|
-
end
|
|
149
|
-
else
|
|
150
|
-
prefix = file_name[0]
|
|
151
|
-
rest = file_name[2..-1]
|
|
152
|
-
end
|
|
145
|
+
# rubocop:disable Layout/LineLength
|
|
146
|
+
fail %(Aruba's working directory does not exist. Maybe you forgot to run `setup_aruba` before using its API.) unless Aruba.platform.directory? File.join(aruba.config.root_directory, aruba.config.working_directory)
|
|
147
|
+
|
|
148
|
+
# rubocop:enable Layout/LineLength
|
|
149
|
+
|
|
150
|
+
prefix = file_name[0]
|
|
151
|
+
rest = file_name[2..-1]
|
|
153
152
|
|
|
154
153
|
if aruba.config.fixtures_path_prefix == prefix
|
|
155
154
|
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
|
156
155
|
|
|
157
|
-
# rubocop:disable
|
|
156
|
+
# rubocop:disable Layout/LineLength
|
|
158
157
|
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
|
|
159
|
-
|
|
158
|
+
|
|
159
|
+
# rubocop:enable Layout/LineLength
|
|
160
160
|
|
|
161
161
|
path
|
|
162
|
-
elsif '~'
|
|
162
|
+
elsif prefix == '~'
|
|
163
163
|
path = with_environment do
|
|
164
|
-
|
|
164
|
+
File.expand_path(file_name)
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
-
fail ArgumentError, 'Expanding "~/" to "/" is not allowed' if path
|
|
168
|
-
fail ArgumentError, %(Expanding "~/" to a relative path "#{path}" is not allowed) unless
|
|
167
|
+
fail ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == '/'
|
|
168
|
+
fail ArgumentError, %(Expanding "~/" to a relative path "#{path}" is not allowed) unless Aruba.platform.absolute_path? path
|
|
169
169
|
|
|
170
170
|
path.to_s
|
|
171
|
+
elsif absolute? file_name
|
|
172
|
+
unless aruba.config.allow_absolute_paths
|
|
173
|
+
caller_location = caller_locations(1, 1).first
|
|
174
|
+
caller_file_line = "#{caller_location.path}:#{caller_location.lineno}"
|
|
175
|
+
aruba.logger.warn "Aruba's `expand_path` method was called with an absolute path at #{caller_file_line}, which is not recommended." \
|
|
176
|
+
' Change the call to pass a relative path or set config.allow_absolute_paths = true to silence this warning'
|
|
177
|
+
end
|
|
178
|
+
file_name
|
|
171
179
|
else
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
with_environment do
|
|
181
|
+
directory = File.expand_path(aruba.current_directory, aruba.root_directory)
|
|
182
|
+
directory = File.expand_path(dir_string, directory) if dir_string
|
|
183
|
+
File.expand_path(file_name, directory)
|
|
184
|
+
end
|
|
175
185
|
end
|
|
176
186
|
end
|
|
177
187
|
# rubocop:enable Metrics/MethodLength
|
|
178
|
-
# rubocop:enable
|
|
188
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
189
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
|
179
190
|
|
|
180
191
|
# Run block with environment
|
|
181
192
|
#
|
|
@@ -185,14 +196,10 @@ module Aruba
|
|
|
185
196
|
# @yield
|
|
186
197
|
# The block of code which should be run with the changed environment variables
|
|
187
198
|
def with_environment(env = {}, &block)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
ensure
|
|
193
|
-
# make sure the old environment is really restored in "aruba.environment"
|
|
194
|
-
aruba.environment.clear
|
|
195
|
-
aruba.environment.update old_aruba_env
|
|
199
|
+
aruba.environment.nest do |nested_env|
|
|
200
|
+
nested_env.update(env)
|
|
201
|
+
Aruba.platform.with_environment nested_env.to_h, &block
|
|
202
|
+
end
|
|
196
203
|
end
|
|
197
204
|
end
|
|
198
205
|
end
|
|
@@ -13,6 +13,8 @@ module Aruba
|
|
|
13
13
|
#
|
|
14
14
|
# @param [String] value
|
|
15
15
|
# The value of the environment variable. Needs to be a string.
|
|
16
|
+
#
|
|
17
|
+
# @return [self]
|
|
16
18
|
def set_environment_variable(name, value)
|
|
17
19
|
name = name.to_s
|
|
18
20
|
value = value.to_s
|
|
@@ -21,7 +23,8 @@ module Aruba
|
|
|
21
23
|
aruba.environment[name] = value
|
|
22
24
|
new_environment = aruba.environment.to_h
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: value } }
|
|
27
|
+
aruba.event_bus.notify Events::AddedEnvironmentVariable.new(environment_change)
|
|
25
28
|
|
|
26
29
|
self
|
|
27
30
|
end
|
|
@@ -33,6 +36,8 @@ module Aruba
|
|
|
33
36
|
#
|
|
34
37
|
# @param [String] value
|
|
35
38
|
# The value of the environment variable. Needs to be a string.
|
|
39
|
+
#
|
|
40
|
+
# @return [self]
|
|
36
41
|
def append_environment_variable(name, value)
|
|
37
42
|
name = name.to_s
|
|
38
43
|
value = value.to_s
|
|
@@ -41,7 +46,8 @@ module Aruba
|
|
|
41
46
|
aruba.environment.append name, value
|
|
42
47
|
new_environment = aruba.environment.to_h
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: value } }
|
|
50
|
+
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change)
|
|
45
51
|
|
|
46
52
|
self
|
|
47
53
|
end
|
|
@@ -53,6 +59,8 @@ module Aruba
|
|
|
53
59
|
#
|
|
54
60
|
# @param [String] value
|
|
55
61
|
# The value of the environment variable. Needs to be a string.
|
|
62
|
+
#
|
|
63
|
+
# @return [self]
|
|
56
64
|
def prepend_environment_variable(name, value)
|
|
57
65
|
name = name.to_s
|
|
58
66
|
value = value.to_s
|
|
@@ -61,18 +69,18 @@ module Aruba
|
|
|
61
69
|
aruba.environment.prepend name, value
|
|
62
70
|
new_environment = aruba.environment.to_h
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: value } }
|
|
73
|
+
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change)
|
|
65
74
|
|
|
66
75
|
self
|
|
67
76
|
end
|
|
68
77
|
|
|
69
78
|
# Remove existing environment variable
|
|
70
79
|
#
|
|
71
|
-
# @param [String]
|
|
80
|
+
# @param [String] name
|
|
72
81
|
# The name of the environment variable as string, e.g. 'HOME'
|
|
73
82
|
#
|
|
74
|
-
# @
|
|
75
|
-
# The value of the environment variable. Needs to be a string.
|
|
83
|
+
# @return [self]
|
|
76
84
|
def delete_environment_variable(name)
|
|
77
85
|
name = name.to_s
|
|
78
86
|
|
|
@@ -80,7 +88,8 @@ module Aruba
|
|
|
80
88
|
aruba.environment.delete name
|
|
81
89
|
new_environment = aruba.environment.to_h
|
|
82
90
|
|
|
83
|
-
|
|
91
|
+
environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: '' } }
|
|
92
|
+
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change)
|
|
84
93
|
|
|
85
94
|
self
|
|
86
95
|
end
|