aruba 0.14.14 → 1.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.cucumberproignore +3 -0
- data/.github/ISSUE_TEMPLATE.md +48 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +39 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1 -5
- data/.travis.yml +35 -27
- data/CONTRIBUTING.md +131 -29
- data/Dockerfile +67 -0
- data/Gemfile +33 -80
- data/History.md +602 -0
- data/README.md +24 -196
- data/Rakefile +87 -27
- data/appveyor.yml +0 -1
- data/aruba.gemspec +30 -40
- data/bin/bootstrap +34 -0
- data/bin/build +3 -0
- data/{script → bin}/console +0 -0
- data/bin/release +3 -0
- data/bin/test +9 -0
- data/cucumber.yml +1 -3
- data/docker-compose.yml +26 -0
- data/{bin → exec}/aruba +0 -0
- data/fixtures/cli-app/README.md +1 -1
- 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.rb +1 -5
- data/fixtures/cli-app/spec/spec_helper.rb +1 -6
- data/fixtures/empty-app/lib/cli/app.rb +2 -0
- data/lib/aruba/api.rb +3 -3
- data/lib/aruba/api/{commands.rb → command.rb} +4 -30
- data/lib/aruba/api/core.rb +8 -25
- data/lib/aruba/api/deprecated.rb +150 -408
- data/lib/aruba/api/filesystem.rb +17 -2
- data/lib/aruba/api/rvm.rb +44 -0
- data/lib/aruba/aruba_path.rb +56 -32
- data/lib/aruba/basic_configuration.rb +3 -5
- data/lib/aruba/colorizer.rb +99 -10
- data/lib/aruba/command.rb +0 -2
- data/lib/aruba/config.rb +5 -5
- data/lib/aruba/config/jruby.rb +5 -15
- data/lib/aruba/console.rb +2 -0
- data/lib/aruba/console/help.rb +1 -7
- data/lib/aruba/cucumber.rb +0 -2
- data/lib/aruba/cucumber/command.rb +98 -72
- data/lib/aruba/cucumber/file.rb +15 -3
- data/lib/aruba/cucumber/hooks.rb +71 -10
- data/lib/aruba/event_bus/name_resolver.rb +2 -10
- data/lib/aruba/generators/script_file.rb +1 -1
- data/lib/aruba/in_process.rb +0 -2
- data/lib/aruba/initializer.rb +4 -14
- data/lib/aruba/matchers/base/object_formatter.rb +0 -5
- data/lib/aruba/matchers/file/have_same_file_content.rb +5 -5
- data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
- data/lib/aruba/platforms/announcer.rb +11 -16
- data/lib/aruba/platforms/aruba_file_creator.rb +1 -5
- data/lib/aruba/platforms/aruba_logger.rb +1 -5
- data/lib/aruba/platforms/command_monitor.rb +10 -14
- data/lib/aruba/platforms/determine_disk_usage.rb +8 -3
- data/lib/aruba/platforms/filesystem_status.rb +1 -5
- data/lib/aruba/platforms/unix_command_string.rb +1 -8
- data/lib/aruba/platforms/unix_environment_variables.rb +6 -8
- data/lib/aruba/platforms/unix_platform.rb +9 -22
- data/lib/aruba/platforms/unix_which.rb +4 -0
- data/lib/aruba/platforms/windows_command_string.rb +6 -14
- data/lib/aruba/platforms/windows_environment_variables.rb +4 -16
- data/lib/aruba/platforms/windows_which.rb +4 -0
- data/lib/aruba/processes/basic_process.rb +22 -18
- data/lib/aruba/processes/spawn_process.rb +12 -35
- data/lib/aruba/rspec.rb +1 -0
- data/lib/aruba/runtime.rb +3 -4
- data/lib/aruba/setup.rb +9 -11
- data/lib/aruba/spawn_process.rb +1 -4
- data/lib/aruba/tasks/docker_helpers.rb +158 -0
- data/lib/aruba/version.rb +1 -1
- metadata +62 -230
- data/CHANGELOG.md +0 -991
- 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/lib/aruba/api/bundler.rb +0 -16
- data/lib/aruba/cucumber/deprecated.rb +0 -93
- data/lib/aruba/matchers/deprecated.rb +0 -1
- data/lib/aruba/matchers/deprecated/file.rb +0 -17
- data/lib/aruba/reporting.rb +0 -126
- data/script/bootstrap +0 -24
- 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
@@ -36,23 +36,11 @@ module Aruba
|
|
36
36
|
def initialize(env = ENV.to_hash)
|
37
37
|
@actions = []
|
38
38
|
|
39
|
-
@env =
|
40
|
-
# rubocop:disable Style/EachWithObject
|
41
|
-
env.inject({}) { |a, (k,v)| a[k.to_s.upcase] = v; a }
|
42
|
-
# rubocop:enable Style/EachWithObject
|
43
|
-
else
|
44
|
-
env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
|
45
|
-
end
|
39
|
+
@env = env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
|
46
40
|
end
|
47
41
|
|
48
42
|
def update(other_env, &block)
|
49
|
-
other_env =
|
50
|
-
# rubocop:disable Style/EachWithObject
|
51
|
-
other_env.inject({}) { |a, (k,v)| a[k.to_s.upcase] = v; a }
|
52
|
-
# rubocop:enable Style/EachWithObject
|
53
|
-
else
|
54
|
-
other_env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
|
55
|
-
end
|
43
|
+
other_env = other_env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
|
56
44
|
|
57
45
|
super(other_env, &block)
|
58
46
|
end
|
@@ -81,8 +69,8 @@ module Aruba
|
|
81
69
|
super(name.upcase, value)
|
82
70
|
end
|
83
71
|
|
84
|
-
def delete(name
|
85
|
-
super(name.upcase
|
72
|
+
def delete(name)
|
73
|
+
super(name.upcase)
|
86
74
|
end
|
87
75
|
end
|
88
76
|
end
|
@@ -38,6 +38,8 @@ module Aruba
|
|
38
38
|
Aruba.platform.command?(program)
|
39
39
|
end
|
40
40
|
|
41
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
42
|
+
# rubocop:disable Metrics/MethodLength
|
41
43
|
def call(program, path)
|
42
44
|
# Iterate over each path glob the dir + program.
|
43
45
|
path.split(File::PATH_SEPARATOR).each do |dir|
|
@@ -61,6 +63,8 @@ module Aruba
|
|
61
63
|
|
62
64
|
nil
|
63
65
|
end
|
66
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
67
|
+
# rubocop:enable Metrics/MethodLength
|
64
68
|
end
|
65
69
|
|
66
70
|
private
|
@@ -36,7 +36,7 @@ module Aruba
|
|
36
36
|
|
37
37
|
# Output pid of process
|
38
38
|
def pid
|
39
|
-
|
39
|
+
'No implemented'
|
40
40
|
end
|
41
41
|
|
42
42
|
# Output stderr and stdout
|
@@ -45,39 +45,39 @@ module Aruba
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def write(*)
|
48
|
-
|
48
|
+
NotImplementedError
|
49
49
|
end
|
50
50
|
|
51
51
|
def stdin(*)
|
52
|
-
|
52
|
+
NotImplementedError
|
53
53
|
end
|
54
54
|
|
55
55
|
def stdout(*)
|
56
|
-
|
56
|
+
NotImplementedError
|
57
57
|
end
|
58
58
|
|
59
59
|
def stderr(*)
|
60
|
-
|
60
|
+
NotImplementedError
|
61
61
|
end
|
62
62
|
|
63
63
|
def close_io(*)
|
64
|
-
|
64
|
+
NotImplementedError
|
65
65
|
end
|
66
66
|
|
67
67
|
def send_signal(*)
|
68
|
-
|
68
|
+
NotImplementedError
|
69
69
|
end
|
70
70
|
|
71
71
|
def filesystem_status
|
72
|
-
|
72
|
+
NotImplementedError
|
73
73
|
end
|
74
74
|
|
75
75
|
def content
|
76
|
-
|
76
|
+
NotImplementedError
|
77
77
|
end
|
78
78
|
|
79
79
|
def wait
|
80
|
-
|
80
|
+
NotImplementedError
|
81
81
|
end
|
82
82
|
|
83
83
|
# Restart a command
|
@@ -116,16 +116,15 @@ module Aruba
|
|
116
116
|
def after_run; end
|
117
117
|
|
118
118
|
def inspect
|
119
|
-
|
119
|
+
# rubocop:disable Style/UnneededInterpolation
|
120
|
+
out = truncate("#{stdout(:wait_for_io => 0).inspect}", 35)
|
121
|
+
err = truncate("#{stderr(:wait_for_io => 0).inspect}", 35)
|
122
|
+
# rubocop:enable Style/UnneededInterpolation
|
120
123
|
|
121
|
-
|
122
|
-
|
123
|
-
else
|
124
|
-
out
|
125
|
-
end
|
126
|
-
|
127
|
-
format '#<%s:%s commandline="%s": output="%s">', self.class, self.object_id, commandline, out
|
124
|
+
fmt = '#<%s:%s commandline="%s": stdout=%s stderr=%s>'
|
125
|
+
format fmt, self.class, self.object_id, commandline, out, err
|
128
126
|
end
|
127
|
+
|
129
128
|
alias to_s inspect
|
130
129
|
|
131
130
|
private
|
@@ -139,6 +138,11 @@ module Aruba
|
|
139
138
|
|
140
139
|
[]
|
141
140
|
end
|
141
|
+
|
142
|
+
def truncate(string, max_length)
|
143
|
+
return string if string.length <= max_length
|
144
|
+
string[0, max_length - 1] + ' ...'
|
145
|
+
end
|
142
146
|
end
|
143
147
|
end
|
144
148
|
end
|
@@ -25,29 +25,17 @@ module Aruba
|
|
25
25
|
|
26
26
|
# Create process
|
27
27
|
#
|
28
|
-
# @
|
28
|
+
# @params [String] cmd
|
29
29
|
# Command string
|
30
30
|
#
|
31
|
-
# @
|
31
|
+
# @params [Integer] exit_timeout
|
32
32
|
# The timeout until we expect the command to be finished
|
33
33
|
#
|
34
|
-
# @
|
34
|
+
# @params [Integer] io_wait_timeout
|
35
35
|
# The timeout until we expect the io to be finished
|
36
36
|
#
|
37
|
-
# @
|
37
|
+
# @params [String] working_directory
|
38
38
|
# The directory where the command will be executed
|
39
|
-
#
|
40
|
-
# @param [Hash] environment
|
41
|
-
# Environment variables
|
42
|
-
#
|
43
|
-
# @param [Class] main_class
|
44
|
-
# E.g. Cli::App::Runner
|
45
|
-
#
|
46
|
-
# @param [String] stop_signal
|
47
|
-
# Name of signal to send to stop process. E.g. 'HUP'.
|
48
|
-
#
|
49
|
-
# @param [Numeric] startup_wait_time
|
50
|
-
# The amount of seconds to wait after Aruba has started a command.
|
51
39
|
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, environment = ENV.to_hash.dup, main_class = nil, stop_signal = nil, startup_wait_time = 0)
|
52
40
|
super
|
53
41
|
|
@@ -76,11 +64,6 @@ module Aruba
|
|
76
64
|
@stdout_file.sync = true
|
77
65
|
@stderr_file.sync = true
|
78
66
|
|
79
|
-
if RUBY_VERSION >= '1.9'
|
80
|
-
@stdout_file.set_encoding('ASCII-8BIT')
|
81
|
-
@stderr_file.set_encoding('ASCII-8BIT')
|
82
|
-
end
|
83
|
-
|
84
67
|
@exit_status = nil
|
85
68
|
@duplex = true
|
86
69
|
|
@@ -100,16 +83,16 @@ module Aruba
|
|
100
83
|
sleep startup_wait_time
|
101
84
|
end
|
102
85
|
rescue ChildProcess::LaunchError => e
|
103
|
-
raise LaunchError, "It tried to start #{
|
86
|
+
raise LaunchError, "It tried to start #{commandline}. " + e.message
|
104
87
|
end
|
105
88
|
|
106
89
|
after_run
|
107
90
|
|
108
91
|
yield self if block_given?
|
109
92
|
end
|
110
|
-
# rubocop:
|
93
|
+
# rubocop:disable Metrics/MethodLength
|
111
94
|
|
112
|
-
# Access to
|
95
|
+
# Access to stdout of process
|
113
96
|
def stdin
|
114
97
|
return if @process.exited?
|
115
98
|
|
@@ -175,11 +158,7 @@ module Aruba
|
|
175
158
|
def close_io(name)
|
176
159
|
return if stopped?
|
177
160
|
|
178
|
-
|
179
|
-
@process.io.send(name.to_sym).close
|
180
|
-
else
|
181
|
-
@process.io.public_send(name.to_sym).close
|
182
|
-
end
|
161
|
+
@process.io.public_send(name.to_sym).close
|
183
162
|
end
|
184
163
|
|
185
164
|
# Stop command
|
@@ -270,13 +249,15 @@ module Aruba
|
|
270
249
|
# gather fully qualified path
|
271
250
|
cmd = Aruba.platform.which(command, environment['PATH'])
|
272
251
|
|
252
|
+
# rubocop:disable Metrics/LineLength
|
273
253
|
fail LaunchError, %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".) if cmd.nil?
|
254
|
+
# rubocop:enable Metrics/LineLength
|
274
255
|
|
275
256
|
Aruba.platform.command_string.new(cmd)
|
276
257
|
end
|
277
258
|
|
278
259
|
def wait_for_io(time_to_wait, &block)
|
279
|
-
sleep time_to_wait
|
260
|
+
sleep time_to_wait.to_i
|
280
261
|
yield
|
281
262
|
end
|
282
263
|
|
@@ -286,11 +267,7 @@ module Aruba
|
|
286
267
|
data = file.read
|
287
268
|
file.close
|
288
269
|
|
289
|
-
|
290
|
-
data.force_encoding('UTF-8')
|
291
|
-
else
|
292
|
-
data
|
293
|
-
end
|
270
|
+
data
|
294
271
|
end
|
295
272
|
end
|
296
273
|
end
|
data/lib/aruba/rspec.rb
CHANGED
data/lib/aruba/runtime.rb
CHANGED
@@ -81,12 +81,11 @@ module Aruba
|
|
81
81
|
# @return [ArubaPath]
|
82
82
|
# The directory to where your fixtures are stored
|
83
83
|
def fixtures_directory
|
84
|
-
@fixtures_directory
|
84
|
+
unless @fixtures_directory
|
85
85
|
candidates = config.fixtures_directories.map { |dir| File.join(root_directory, dir) }
|
86
|
-
|
86
|
+
@fixtures_directory = candidates.find { |d| Aruba.platform.directory? d }
|
87
87
|
|
88
|
-
fail "No existing fixtures directory found in #{candidates.map { |d| format('"%s"', d) }.join(', ')}." unless
|
89
|
-
directory
|
88
|
+
fail "No existing fixtures directory found in #{candidates.map { |d| format('"%s"', d) }.join(', ')}. " unless @fixtures_directory
|
90
89
|
end
|
91
90
|
|
92
91
|
fail %(Fixtures directory "#{@fixtures_directory}" is not a directory) unless Aruba.platform.directory?(@fixtures_directory)
|
data/lib/aruba/setup.rb
CHANGED
@@ -10,10 +10,10 @@ module Aruba
|
|
10
10
|
@runtime = runtime
|
11
11
|
end
|
12
12
|
|
13
|
-
def call
|
13
|
+
def call
|
14
14
|
return if runtime.setup_already_done?
|
15
15
|
|
16
|
-
working_directory
|
16
|
+
working_directory
|
17
17
|
events
|
18
18
|
|
19
19
|
runtime.setup_done
|
@@ -23,10 +23,8 @@ module Aruba
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def working_directory
|
27
|
-
|
28
|
-
Aruba.platform.rm File.join(runtime.config.root_directory, runtime.config.working_directory), :force => true
|
29
|
-
end
|
26
|
+
def working_directory
|
27
|
+
Aruba.platform.rm File.join(runtime.config.root_directory, runtime.config.working_directory), :force => true
|
30
28
|
Aruba.platform.mkdir File.join(runtime.config.root_directory, runtime.config.working_directory)
|
31
29
|
Aruba.platform.chdir runtime.config.root_directory
|
32
30
|
end
|
@@ -36,11 +34,11 @@ module Aruba
|
|
36
34
|
runtime.event_bus.register(
|
37
35
|
:command_started,
|
38
36
|
proc do |event|
|
39
|
-
runtime.announcer.announce
|
40
|
-
runtime.announcer.announce
|
41
|
-
runtime.announcer.announce
|
42
|
-
runtime.announcer.announce
|
43
|
-
runtime.announcer.announce
|
37
|
+
runtime.announcer.announce :command, event.entity.commandline
|
38
|
+
runtime.announcer.announce :timeout, 'exit', event.entity.exit_timeout
|
39
|
+
runtime.announcer.announce :timeout, 'io wait', event.entity.io_wait_timeout
|
40
|
+
runtime.announcer.announce :wait_time, 'startup wait time', event.entity.startup_wait_time
|
41
|
+
runtime.announcer.announce :full_environment, event.entity.environment
|
44
42
|
end
|
45
43
|
)
|
46
44
|
|
data/lib/aruba/spawn_process.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
require 'aruba/processes/spawn_process'
|
2
|
-
require 'aruba/platform'
|
3
|
-
|
4
|
-
Aruba.platform.deprecated('The use of "Aruba::SpawnProcess" is deprecated. Use "Aruba::Processes::SpawnProcess" instead.')
|
5
2
|
|
6
3
|
module Aruba
|
7
4
|
class SpawnProcess < Aruba::Processes::SpawnProcess
|
8
5
|
def initialize(*args)
|
9
|
-
|
6
|
+
warn('The use of "Aruba::SpawnProcess" is deprecated. Use "Aruba::Processes::SpawnProcess" instead.')
|
10
7
|
|
11
8
|
super
|
12
9
|
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'psych'
|
2
|
+
|
3
|
+
module Aruba
|
4
|
+
class DockerRunInstance
|
5
|
+
protected
|
6
|
+
|
7
|
+
attr_reader :file, :instance
|
8
|
+
|
9
|
+
public
|
10
|
+
|
11
|
+
def initialize(file, instance)
|
12
|
+
@file = file
|
13
|
+
@instance = instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def method_missing(m, *args, &block)
|
17
|
+
@file.public_send m, instance
|
18
|
+
end
|
19
|
+
|
20
|
+
def respond_to_missing?(m)
|
21
|
+
@file.respond_to? m
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class DockerBuildCommandLineBuilder
|
26
|
+
protected
|
27
|
+
|
28
|
+
attr_reader :run_instance, :opts
|
29
|
+
|
30
|
+
public
|
31
|
+
|
32
|
+
def initialize(run_instance, opts = {})
|
33
|
+
@run_instance = run_instance
|
34
|
+
@opts = opts
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_cli
|
38
|
+
cache = opts[:cache]
|
39
|
+
application_version = opts[:version]
|
40
|
+
docker_file = run_instance.docker_file
|
41
|
+
docker_image = run_instance.image
|
42
|
+
|
43
|
+
cmdline = []
|
44
|
+
cmdline << 'docker'
|
45
|
+
cmdline << 'build'
|
46
|
+
cmdline << '--no-cache=true' if cache == 'false'
|
47
|
+
|
48
|
+
%w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).each do |var|
|
49
|
+
next unless ENV.key? var
|
50
|
+
|
51
|
+
proxy_uri = URI(ENV[var])
|
52
|
+
proxy_uri.host = '172.17.0.1'
|
53
|
+
cmdline << "--build-arg #{var}=#{proxy_uri}"
|
54
|
+
end
|
55
|
+
|
56
|
+
cmdline << "-t #{docker_image}:#{application_version}"
|
57
|
+
cmdline << "-f #{docker_file}"
|
58
|
+
cmdline << File.dirname(docker_file)
|
59
|
+
|
60
|
+
cmdline.join(' ')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class DockerRunCommandLineBuilder
|
65
|
+
protected
|
66
|
+
|
67
|
+
attr_reader :run_instance, :opts
|
68
|
+
|
69
|
+
public
|
70
|
+
|
71
|
+
def initialize(run_instance, opts = {})
|
72
|
+
@run_instance = run_instance
|
73
|
+
@opts = opts
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_cli
|
77
|
+
volumes = run_instance.volumes
|
78
|
+
image = run_instance.image
|
79
|
+
command = opts[:command]
|
80
|
+
|
81
|
+
cmdline = []
|
82
|
+
cmdline << 'docker'
|
83
|
+
cmdline << 'run'
|
84
|
+
cmdline << '-it'
|
85
|
+
cmdline << '--rm'
|
86
|
+
cmdline << "--name #{run_instance.container_name}"
|
87
|
+
|
88
|
+
volumes.each do |v|
|
89
|
+
cmdline << "-v #{expand_volume_paths(v)}"
|
90
|
+
end
|
91
|
+
|
92
|
+
cmdline << image
|
93
|
+
cmdline << command if command
|
94
|
+
|
95
|
+
cmdline.join(' ')
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def expand_volume_paths(volume_paths)
|
101
|
+
volume_paths.split(':').map { |path| File.expand_path(path) }.join(':')
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class DockerComposeFile
|
106
|
+
protected
|
107
|
+
|
108
|
+
attr_reader :data
|
109
|
+
|
110
|
+
public
|
111
|
+
|
112
|
+
def initialize(path)
|
113
|
+
@data = Psych.load_file(path)['services']
|
114
|
+
end
|
115
|
+
|
116
|
+
def volumes(instance)
|
117
|
+
fetch(instance)['volumes']
|
118
|
+
end
|
119
|
+
|
120
|
+
def build_context(instance)
|
121
|
+
fetch(instance).fetch('build', {})['context']
|
122
|
+
end
|
123
|
+
|
124
|
+
def build_arguments(instance)
|
125
|
+
fetch(instance).fetch('build', {})['args']
|
126
|
+
end
|
127
|
+
|
128
|
+
def docker_file(instance)
|
129
|
+
fetch(instance).fetch('build', {})['dockerfile']
|
130
|
+
end
|
131
|
+
|
132
|
+
def image(instance)
|
133
|
+
fetch(instance)['image']
|
134
|
+
end
|
135
|
+
|
136
|
+
def container_name(instance)
|
137
|
+
fetch(instance)['container_name']
|
138
|
+
end
|
139
|
+
|
140
|
+
def command(instance)
|
141
|
+
fetch(instance)['command']
|
142
|
+
end
|
143
|
+
|
144
|
+
def working_directory(instance)
|
145
|
+
fetch(instance)['working_dir']
|
146
|
+
end
|
147
|
+
|
148
|
+
def command(instance)
|
149
|
+
fetch(instance)['command']
|
150
|
+
end
|
151
|
+
|
152
|
+
private
|
153
|
+
|
154
|
+
def fetch(instance)
|
155
|
+
Hash(data).fetch(instance.to_s)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|