aruba 0.14.14 → 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 -28
- data/.yardopts +3 -0
- data/CHANGELOG.md +301 -2
- data/CONTRIBUTING.md +247 -45
- data/Dockerfile +67 -0
- data/Gemfile +5 -114
- 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 +35 -13
- 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 +133 -92
- 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 +30 -72
- 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 +11 -103
- 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 +16 -50
- 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 +18 -20
- 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 +36 -39
- data/lib/aruba/rspec.rb +14 -36
- data/lib/aruba/runtime.rb +3 -6
- data/lib/aruba/setup.rb +1 -1
- data/lib/aruba/tasks/docker_helpers.rb +154 -0
- data/lib/aruba/version.rb +1 -1
- metadata +190 -242
- 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 -306
- 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 -118
- 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 -55
- 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/simplecov_setup.rb +0 -11
- data/fixtures/spawn_process/stderr.sh +0 -3
- data/lib/aruba/api/deprecated.rb +0 -1155
- 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/commands_spec.rb +0 -30
- data/spec/aruba/api/core_spec.rb +0 -184
- 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 -73
- 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
|
@@ -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
|
data/lib/aruba/api/filesystem.rb
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'pathname'
|
|
2
2
|
|
|
3
|
+
require 'aruba/platform'
|
|
3
4
|
require 'aruba/extensions/string/strip'
|
|
4
5
|
|
|
5
|
-
require 'aruba/aruba_path'
|
|
6
|
-
|
|
7
6
|
Aruba.platform.require_matching_files('../matchers/file/*.rb', __FILE__)
|
|
8
7
|
Aruba.platform.require_matching_files('../matchers/directory/*.rb', __FILE__)
|
|
9
8
|
Aruba.platform.require_matching_files('../matchers/path/*.rb', __FILE__)
|
|
@@ -40,8 +39,10 @@ module Aruba
|
|
|
40
39
|
|
|
41
40
|
# Check if file exist and is executable
|
|
42
41
|
#
|
|
43
|
-
# @param [String]
|
|
44
|
-
# The
|
|
42
|
+
# @param [String] path
|
|
43
|
+
# The path which should exist and be executable
|
|
44
|
+
#
|
|
45
|
+
# @return [Boolean]
|
|
45
46
|
def executable?(path)
|
|
46
47
|
path = expand_path(path)
|
|
47
48
|
|
|
@@ -50,18 +51,16 @@ module Aruba
|
|
|
50
51
|
|
|
51
52
|
# Check if path is absolute
|
|
52
53
|
#
|
|
53
|
-
# @return [
|
|
54
|
-
# Result of check
|
|
54
|
+
# @return [Boolean]
|
|
55
55
|
def absolute?(path)
|
|
56
|
-
|
|
56
|
+
Aruba.platform.absolute_path?(path)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
# Check if path is relative
|
|
60
60
|
#
|
|
61
|
-
# @return [
|
|
62
|
-
# Result of check
|
|
61
|
+
# @return [Boolean]
|
|
63
62
|
def relative?(path)
|
|
64
|
-
|
|
63
|
+
Aruba.platform.relative_path?(path)
|
|
65
64
|
end
|
|
66
65
|
|
|
67
66
|
# Return all existing paths (directories, files) in current dir
|
|
@@ -69,7 +68,7 @@ module Aruba
|
|
|
69
68
|
# @return [Array]
|
|
70
69
|
# List of files and directories
|
|
71
70
|
def all_paths
|
|
72
|
-
list('.').map { |
|
|
71
|
+
list('.').map { |path| expand_path(path) }
|
|
73
72
|
end
|
|
74
73
|
|
|
75
74
|
# Return all existing files in current directory
|
|
@@ -107,9 +106,9 @@ module Aruba
|
|
|
107
106
|
fail ArgumentError, %(Only directories are supported. Path "#{name}" is not a directory.) unless directory? name
|
|
108
107
|
|
|
109
108
|
existing_files = Dir.glob(expand_path(File.join(name, '**', '*')))
|
|
110
|
-
current_working_directory =
|
|
109
|
+
current_working_directory = Pathname.new(expand_path('.'))
|
|
111
110
|
|
|
112
|
-
existing_files.map { |d|
|
|
111
|
+
existing_files.map { |d| Pathname.new(d).relative_path_from(current_working_directory).to_s }
|
|
113
112
|
end
|
|
114
113
|
|
|
115
114
|
# Return content of file
|
|
@@ -128,10 +127,10 @@ module Aruba
|
|
|
128
127
|
# The method does not check if file already exists. If the file name is a
|
|
129
128
|
# path the method will create all neccessary directories.
|
|
130
129
|
#
|
|
131
|
-
# @param [String]
|
|
130
|
+
# @param [String] name
|
|
132
131
|
# The name of the file
|
|
133
132
|
#
|
|
134
|
-
# @param [String]
|
|
133
|
+
# @param [String] content
|
|
135
134
|
# The content which should be written to the file
|
|
136
135
|
def write_file(name, content)
|
|
137
136
|
Aruba.platform.create_file(expand_path(name), content, false)
|
|
@@ -181,8 +180,13 @@ module Aruba
|
|
|
181
180
|
raise ArgumentError, %(The following source "#{s}" does not exist.) unless exist? s
|
|
182
181
|
end
|
|
183
182
|
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
if destination.start_with? aruba.config.fixtures_path_prefix
|
|
184
|
+
raise ArgumentError, "Using a fixture as destination (#{destination}) is not supported"
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if source.count > 1 && exist?(destination) && !directory?(destination)
|
|
188
|
+
raise ArgumentError, 'Multiples sources can only be copied to a directory'
|
|
189
|
+
end
|
|
186
190
|
|
|
187
191
|
source_paths = source.map { |f| expand_path(f) }
|
|
188
192
|
destination_path = expand_path(destination)
|
|
@@ -222,13 +226,17 @@ module Aruba
|
|
|
222
226
|
raise ArgumentError, "Using a fixture as source (#{source}) is not supported" if s.start_with? aruba.config.fixtures_path_prefix
|
|
223
227
|
end
|
|
224
228
|
|
|
225
|
-
|
|
229
|
+
if destination.start_with? aruba.config.fixtures_path_prefix
|
|
230
|
+
raise ArgumentError, "Using a fixture as destination (#{destination}) is not supported"
|
|
231
|
+
end
|
|
226
232
|
|
|
227
233
|
source.each do |s|
|
|
228
234
|
raise ArgumentError, %(The following source "#{s}" does not exist.) unless exist? s
|
|
229
235
|
end
|
|
230
236
|
|
|
231
|
-
|
|
237
|
+
if source.count > 1 && exist?(destination) && !directory?(destination)
|
|
238
|
+
raise ArgumentError, 'Multiple sources can only be copied to a directory'
|
|
239
|
+
end
|
|
232
240
|
|
|
233
241
|
source_paths = source.map { |f| expand_path(f) }
|
|
234
242
|
destination_path = expand_path(destination)
|
|
@@ -252,10 +260,10 @@ module Aruba
|
|
|
252
260
|
# The method does not check if file already exists. If the file name is a
|
|
253
261
|
# path the method will create all neccessary directories.
|
|
254
262
|
#
|
|
255
|
-
# @param [String]
|
|
263
|
+
# @param [String] name
|
|
256
264
|
# The name of the file
|
|
257
265
|
#
|
|
258
|
-
# @param [Integer]
|
|
266
|
+
# @param [Integer] size
|
|
259
267
|
# The size of the file
|
|
260
268
|
def write_fixed_size_file(name, size)
|
|
261
269
|
Aruba.platform.create_fixed_size_file(expand_path(name), size, false)
|
|
@@ -297,8 +305,8 @@ module Aruba
|
|
|
297
305
|
mode
|
|
298
306
|
end
|
|
299
307
|
|
|
300
|
-
args.each { |
|
|
301
|
-
paths = args.map { |
|
|
308
|
+
args.each { |path| raise "Expected #{path} to be present" unless exist?(path) }
|
|
309
|
+
paths = args.map { |path| expand_path(path) }
|
|
302
310
|
|
|
303
311
|
Aruba.platform.chmod(mode, paths, options)
|
|
304
312
|
|
|
@@ -342,7 +350,7 @@ module Aruba
|
|
|
342
350
|
{}
|
|
343
351
|
end
|
|
344
352
|
|
|
345
|
-
args = args.map { |
|
|
353
|
+
args = args.map { |path| expand_path(path) }
|
|
346
354
|
|
|
347
355
|
Aruba.platform.rm(args, options)
|
|
348
356
|
end
|
|
@@ -354,7 +362,7 @@ module Aruba
|
|
|
354
362
|
#
|
|
355
363
|
# @yield
|
|
356
364
|
# Pass the content of the given file to this block
|
|
357
|
-
def with_file_content(file
|
|
365
|
+
def with_file_content(file)
|
|
358
366
|
expect(file).to be_an_existing_path
|
|
359
367
|
|
|
360
368
|
content = read(file).join("\n")
|
|
@@ -370,20 +378,25 @@ module Aruba
|
|
|
370
378
|
# @param [Array, Path] paths
|
|
371
379
|
# The paths
|
|
372
380
|
#
|
|
373
|
-
# @
|
|
381
|
+
# @return [FileSize]
|
|
374
382
|
# Bytes on disk
|
|
375
383
|
def disk_usage(*paths)
|
|
376
|
-
|
|
384
|
+
paths = paths.flatten
|
|
385
|
+
expect(paths).to Aruba::Matchers.all be_an_existing_path
|
|
386
|
+
expanded = paths.map { |path| expand_path(path) }
|
|
377
387
|
|
|
378
|
-
Aruba.platform.determine_disk_usage
|
|
388
|
+
Aruba.platform.determine_disk_usage(expanded)
|
|
379
389
|
end
|
|
380
390
|
|
|
381
391
|
# Get size of file
|
|
382
392
|
#
|
|
393
|
+
# @param [String] name
|
|
394
|
+
# File name
|
|
395
|
+
#
|
|
383
396
|
# @return [Numeric]
|
|
384
397
|
# The size of the file
|
|
385
398
|
def file_size(name)
|
|
386
|
-
|
|
399
|
+
expect(name).to be_an_existing_file
|
|
387
400
|
|
|
388
401
|
Aruba.platform.determine_file_size expand_path(name)
|
|
389
402
|
end
|
data/lib/aruba/api/text.rb
CHANGED
|
@@ -22,11 +22,7 @@ module Aruba
|
|
|
22
22
|
# @param [#to_s] text
|
|
23
23
|
# Input
|
|
24
24
|
def extract_text(text)
|
|
25
|
-
|
|
26
|
-
text.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '')
|
|
27
|
-
else
|
|
28
|
-
text.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '').gsub(/\\\[|\\\]/, '').gsub(/\007|\016|\017/, '')
|
|
29
|
-
end
|
|
25
|
+
text.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '').gsub(/\\\[|\\\]/, '').gsub(/\007|\016|\017/, '')
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
# Unescape special characters and remove ANSI characters
|
|
@@ -35,14 +31,12 @@ module Aruba
|
|
|
35
31
|
# The text to sanitize
|
|
36
32
|
def sanitize_text(text)
|
|
37
33
|
text = unescape_text(text)
|
|
38
|
-
text = extract_text(text) if
|
|
34
|
+
text = extract_text(text) if aruba.config.remove_ansi_escape_sequences
|
|
39
35
|
|
|
40
36
|
text.chomp
|
|
41
37
|
end
|
|
42
38
|
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
# Replace variables in command string
|
|
39
|
+
# Replace variables in command string (experimental)
|
|
46
40
|
#
|
|
47
41
|
# @param [#to_s] text
|
|
48
42
|
# The text to parse
|
data/lib/aruba/api.rb
CHANGED
|
@@ -8,10 +8,6 @@ require 'aruba/platform'
|
|
|
8
8
|
require 'aruba/api/core'
|
|
9
9
|
require 'aruba/api/commands'
|
|
10
10
|
|
|
11
|
-
if Aruba::VERSION <= '1.0.0'
|
|
12
|
-
require 'aruba/api/deprecated'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
11
|
require 'aruba/api/environment'
|
|
16
12
|
require 'aruba/api/filesystem'
|
|
17
13
|
require 'aruba/api/text'
|
|
@@ -23,12 +19,11 @@ Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
|
|
|
23
19
|
module Aruba
|
|
24
20
|
# Api
|
|
25
21
|
module Api
|
|
26
|
-
include
|
|
27
|
-
include
|
|
28
|
-
include
|
|
29
|
-
include
|
|
30
|
-
include
|
|
31
|
-
include
|
|
32
|
-
include Aruba::Api::Text
|
|
22
|
+
include Core
|
|
23
|
+
include Commands
|
|
24
|
+
include Environment
|
|
25
|
+
include Filesystem
|
|
26
|
+
include Text
|
|
27
|
+
include Bundler
|
|
33
28
|
end
|
|
34
29
|
end
|
data/lib/aruba/aruba_path.rb
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
require 'pathname'
|
|
2
|
-
require 'delegate'
|
|
3
|
-
|
|
4
|
-
require 'aruba/file_size'
|
|
5
2
|
|
|
6
3
|
# Aruba
|
|
7
4
|
module Aruba
|
|
8
5
|
# Pathname for aruba files and directories
|
|
9
6
|
#
|
|
10
7
|
# @private
|
|
11
|
-
class ArubaPath
|
|
8
|
+
class ArubaPath
|
|
12
9
|
def initialize(path)
|
|
13
|
-
obj = [path.to_s].flatten
|
|
14
|
-
|
|
15
|
-
super obj
|
|
16
|
-
|
|
17
|
-
@delegate_sd_obj = obj
|
|
10
|
+
@obj = [path.to_s].flatten
|
|
18
11
|
end
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
::Pathname.new(::File.join(*@delegate_sd_obj))
|
|
13
|
+
def to_str
|
|
14
|
+
to_pathname.to_s
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@delegate_sd_obj = [obj.to_s].flatten
|
|
17
|
+
def to_s
|
|
18
|
+
to_str
|
|
28
19
|
end
|
|
29
20
|
|
|
30
21
|
# Add directory/file to path
|
|
@@ -39,95 +30,42 @@ module Aruba
|
|
|
39
30
|
# puts path
|
|
40
31
|
# # => path/to/dir.d/subdir.d
|
|
41
32
|
def push(p)
|
|
42
|
-
@
|
|
33
|
+
@obj << p
|
|
43
34
|
end
|
|
44
35
|
alias << push
|
|
45
36
|
|
|
46
|
-
# Remove last component of path
|
|
37
|
+
# Remove last pushed component of path
|
|
47
38
|
#
|
|
48
39
|
# @example
|
|
49
|
-
# path = ArubaPath.new 'path/to
|
|
40
|
+
# path = ArubaPath.new 'path/to'
|
|
41
|
+
# path.push 'dir'
|
|
50
42
|
# path.pop
|
|
51
|
-
# puts path
|
|
52
|
-
# # => path/to
|
|
43
|
+
# puts path # => path/to
|
|
53
44
|
def pop
|
|
54
|
-
@
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
if RUBY_VERSION < '1.9'
|
|
58
|
-
def to_s
|
|
59
|
-
__getobj__.to_s
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def relative?
|
|
63
|
-
!(%r{\A/} === to_s)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def absolute?
|
|
67
|
-
(%r{\A/} === to_s)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def to_ary
|
|
71
|
-
to_a
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# How many parts has the file name
|
|
76
|
-
#
|
|
77
|
-
# @return [Integer]
|
|
78
|
-
# The count of file name parts
|
|
79
|
-
#
|
|
80
|
-
# @example
|
|
81
|
-
#
|
|
82
|
-
# path = ArubaPath.new('path/to/file.txt')
|
|
83
|
-
# path.depth # => 3
|
|
84
|
-
#
|
|
85
|
-
def depth
|
|
86
|
-
if RUBY_VERSION < '1.9'
|
|
87
|
-
items = []
|
|
88
|
-
__getobj__.each_filename { |f| items << f }
|
|
89
|
-
|
|
90
|
-
items.size
|
|
91
|
-
else
|
|
92
|
-
__getobj__.each_filename.to_a.size
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# Path ends with string
|
|
97
|
-
#
|
|
98
|
-
# @param [String] string
|
|
99
|
-
# The string to check
|
|
100
|
-
def end_with?(string)
|
|
101
|
-
to_s.end_with? string
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
# Path starts with string
|
|
105
|
-
#
|
|
106
|
-
# @param [String] string
|
|
107
|
-
# The string to check
|
|
108
|
-
def start_with?(string)
|
|
109
|
-
to_s.start_with? string
|
|
45
|
+
@obj.pop
|
|
110
46
|
end
|
|
111
47
|
|
|
112
48
|
# Return string at index
|
|
113
49
|
#
|
|
114
50
|
# @param [Integer, Range] index
|
|
115
51
|
def [](index)
|
|
116
|
-
|
|
117
|
-
to_s.chars.to_a[index].to_a.join('')
|
|
118
|
-
else
|
|
119
|
-
to_s[index]
|
|
120
|
-
end
|
|
52
|
+
to_s[index]
|
|
121
53
|
end
|
|
122
54
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
#
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
# Get path
|
|
58
|
+
def to_pathname
|
|
59
|
+
current_path = @obj.inject do |path, element|
|
|
60
|
+
if element.start_with? '~'
|
|
61
|
+
element
|
|
62
|
+
elsif Aruba.platform.absolute_path? element
|
|
63
|
+
element
|
|
64
|
+
else
|
|
65
|
+
File.join(path, element)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
::Pathname.new(current_path)
|
|
131
69
|
end
|
|
132
70
|
end
|
|
133
71
|
end
|
|
@@ -72,7 +72,7 @@ module Aruba
|
|
|
72
72
|
define_method("#{name}=") { |v| find_option(name).value = v }
|
|
73
73
|
|
|
74
74
|
# Add reader
|
|
75
|
-
option_reader name, :
|
|
75
|
+
option_reader name, contract: { None => contract.values.first }
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
private
|
|
@@ -80,7 +80,7 @@ module Aruba
|
|
|
80
80
|
def add_option(name, value = nil)
|
|
81
81
|
return if known_options.key?(name)
|
|
82
82
|
|
|
83
|
-
known_options[name] = Option.new(:
|
|
83
|
+
known_options[name] = Option.new(name: name, value: value)
|
|
84
84
|
|
|
85
85
|
self
|
|
86
86
|
end
|
|
@@ -114,29 +114,13 @@ module Aruba
|
|
|
114
114
|
|
|
115
115
|
# Make deep dup copy of configuration
|
|
116
116
|
def make_copy
|
|
117
|
-
obj =
|
|
117
|
+
obj = dup
|
|
118
118
|
obj.local_options = Marshal.load(Marshal.dump(local_options))
|
|
119
119
|
obj.hooks = @hooks
|
|
120
120
|
|
|
121
121
|
obj
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
# Get access to hooks
|
|
125
|
-
def hooks
|
|
126
|
-
# rubocop:disable Metrics/LineLength
|
|
127
|
-
Aruba.platform.deprecated 'The use of the "#aruba.config.hooks" is deprecated. Please use "#aruba.config.before(:name) {}" to define and "#aruba.config.before(:name, *args)" to run a hook. This method will become private in the next major version.'
|
|
128
|
-
# rubocop:enable Metrics/LineLength
|
|
129
|
-
|
|
130
|
-
@hooks
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
# @deprecated
|
|
134
|
-
def before_cmd(&block)
|
|
135
|
-
Aruba.platform.deprecated 'The use of the "#before_cmd"-hook is deprecated. Please define with "#before(:command) {}" instead'
|
|
136
|
-
|
|
137
|
-
before(:command, &block)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
124
|
# Define or run before-hook
|
|
141
125
|
#
|
|
142
126
|
# @param [Symbol, String] name
|
|
@@ -215,11 +199,7 @@ module Aruba
|
|
|
215
199
|
|
|
216
200
|
# Set if name is option
|
|
217
201
|
def set_if_option(name, *args)
|
|
218
|
-
if
|
|
219
|
-
send("#{name}=".to_sym, *args) if option? name
|
|
220
|
-
else
|
|
221
|
-
public_send("#{name}=".to_sym, *args) if option? name
|
|
222
|
-
end
|
|
202
|
+
public_send("#{name}=".to_sym, *args) if option? name
|
|
223
203
|
end
|
|
224
204
|
|
|
225
205
|
private
|
data/lib/aruba/cli.rb
CHANGED
|
@@ -18,7 +18,7 @@ module Aruba
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
desc 'init', 'Initialize aruba'
|
|
21
|
-
option :test_framework, :
|
|
21
|
+
option :test_framework, default: 'cucumber', enum: %w(cucumber rspec minitest), desc: 'Choose which test framework to use'
|
|
22
22
|
def init
|
|
23
23
|
Aruba::Initializer.new.call(options[:test_framework])
|
|
24
24
|
end
|
data/lib/aruba/command.rb
CHANGED
data/lib/aruba/config/jruby.rb
CHANGED
|
@@ -17,7 +17,7 @@ Aruba.configure do |config|
|
|
|
17
17
|
|
|
18
18
|
env['JRUBY_OPTS'] = jruby_opts
|
|
19
19
|
|
|
20
|
-
if RbConfig::CONFIG['host_os']
|
|
20
|
+
if /solaris|sunos/i.match?(RbConfig::CONFIG['host_os'])
|
|
21
21
|
java_opts = env['JAVA_OPTS'] || ''
|
|
22
22
|
|
|
23
23
|
# force jRuby to use client JVM for faster startup times
|
data/lib/aruba/config_wrapper.rb
CHANGED
|
@@ -30,7 +30,7 @@ module Aruba
|
|
|
30
30
|
# If one method ends with "=", e.g. ":option1=", then notify the event
|
|
31
31
|
# queue, that the user changes the value of "option1"
|
|
32
32
|
def method_missing(name, *args, &block)
|
|
33
|
-
event_bus.notify Events::ChangedConfiguration.new(:
|
|
33
|
+
event_bus.notify Events::ChangedConfiguration.new(changed: { name: name.to_s.gsub(/=$/, ''), value: args.first }) if name.to_s.end_with? '='
|
|
34
34
|
|
|
35
35
|
config.send(name, *args, &block)
|
|
36
36
|
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
require 'contracts'
|
|
2
|
+
|
|
3
|
+
require 'aruba/version'
|
|
4
|
+
require 'aruba/basic_configuration'
|
|
5
|
+
require 'aruba/in_config_wrapper'
|
|
6
|
+
require 'aruba/hooks'
|
|
7
|
+
|
|
8
|
+
require 'aruba/contracts/relative_path'
|
|
9
|
+
require 'aruba/contracts/absolute_path'
|
|
10
|
+
require 'aruba/contracts/enum'
|
|
11
|
+
|
|
12
|
+
require 'aruba/contracts/is_power_of_two'
|
|
13
|
+
|
|
14
|
+
# Aruba
|
|
15
|
+
module Aruba
|
|
16
|
+
# Aruba Configuration
|
|
17
|
+
#
|
|
18
|
+
# This defines the configuration options of aruba
|
|
19
|
+
class Configuration < BasicConfiguration
|
|
20
|
+
option_reader :root_directory, contract: { None => String }, default: Dir.getwd
|
|
21
|
+
|
|
22
|
+
option_accessor :working_directory,
|
|
23
|
+
contract: { Aruba::Contracts::RelativePath => Aruba::Contracts::RelativePath },
|
|
24
|
+
default: 'tmp/aruba'
|
|
25
|
+
|
|
26
|
+
option_reader :fixtures_path_prefix, contract: { None => String }, default: '%'
|
|
27
|
+
|
|
28
|
+
option_accessor :exit_timeout, contract: { Num => Num }, default: 15
|
|
29
|
+
option_accessor :stop_signal, contract: { Maybe[String] => Maybe[String] }, default: nil
|
|
30
|
+
option_accessor :io_wait_timeout, contract: { Num => Num }, default: 0.1
|
|
31
|
+
option_accessor :startup_wait_time, contract: { Num => Num }, default: 0
|
|
32
|
+
option_accessor :fixtures_directories,
|
|
33
|
+
contract: { Array => ArrayOf[String] },
|
|
34
|
+
default: %w(features/fixtures spec/fixtures test/fixtures fixtures)
|
|
35
|
+
|
|
36
|
+
option_accessor :command_runtime_environment, contract: { Hash => Hash }, default: {}
|
|
37
|
+
option_accessor :command_search_paths,
|
|
38
|
+
contract: { ArrayOf[String] => ArrayOf[String] } do |config|
|
|
39
|
+
[File.join(config.root_directory.value, 'bin'), File.join(config.root_directory.value, 'exe')]
|
|
40
|
+
end
|
|
41
|
+
option_accessor :remove_ansi_escape_sequences, contract: { Bool => Bool }, default: true
|
|
42
|
+
option_accessor :command_launcher,
|
|
43
|
+
contract: { Aruba::Contracts::Enum[:in_process, :spawn, :debug] => Aruba::Contracts::Enum[:in_process, :spawn, :debug] },
|
|
44
|
+
default: :spawn
|
|
45
|
+
option_accessor :main_class, contract: { Class => Maybe[Class] }, default: nil
|
|
46
|
+
|
|
47
|
+
option_accessor :home_directory,
|
|
48
|
+
contract: { Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] =>
|
|
49
|
+
Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] } do |config|
|
|
50
|
+
File.join(config.root_directory.value, config.working_directory.value)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
option_accessor :log_level,
|
|
54
|
+
contract: { Aruba::Contracts::Enum[:fatal, :warn, :debug, :info, :error, :unknown, :silent] =>
|
|
55
|
+
Aruba::Contracts::Enum[:fatal, :warn, :debug, :info, :error, :unknown, :silent] },
|
|
56
|
+
default: :info
|
|
57
|
+
|
|
58
|
+
# TODO: deprecate this value and replace with "filesystem allocation unit"
|
|
59
|
+
# equal to 4096 by default. "filesystem allocation unit" would represent
|
|
60
|
+
# the actual MINIMUM space taken in bytes by a 1-byte file
|
|
61
|
+
option_accessor :physical_block_size,
|
|
62
|
+
contract: { Aruba::Contracts::IsPowerOfTwo => Aruba::Contracts::IsPowerOfTwo },
|
|
63
|
+
default: 512
|
|
64
|
+
option_accessor :console_history_file, contract: { String => String }, default: '~/.aruba_history'
|
|
65
|
+
|
|
66
|
+
option_accessor :activate_announcer_on_command_failure, contract: { ArrayOf[Symbol] => ArrayOf[Symbol] }, default: []
|
|
67
|
+
option_accessor :allow_absolute_paths, contract: { Bool => Bool }, default: false
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Aruba
|
|
72
|
+
module Aruba
|
|
73
|
+
@config = Configuration.new
|
|
74
|
+
|
|
75
|
+
class << self
|
|
76
|
+
attr_reader :config
|
|
77
|
+
|
|
78
|
+
# Configure aruba
|
|
79
|
+
#
|
|
80
|
+
# @example How to configure aruba
|
|
81
|
+
#
|
|
82
|
+
# Aruba.configure do |config|
|
|
83
|
+
# config.<option> = <value>
|
|
84
|
+
# end
|
|
85
|
+
#
|
|
86
|
+
def configure(&block)
|
|
87
|
+
@config.configure(&block)
|
|
88
|
+
|
|
89
|
+
self
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|