aruba 0.14.9 → 0.14.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +17 -37
  4. data/CHANGELOG.md +30 -0
  5. data/Gemfile +11 -1
  6. data/features/{getting_started/cleanup.feature → 01_getting_started_with_aruba/cleanup_working_directory.feature} +4 -5
  7. data/features/{getting_started → 01_getting_started_with_aruba}/run_commands.feature +45 -15
  8. data/features/{getting_started → 01_getting_started_with_aruba}/supported_testing_frameworks.feature +5 -21
  9. data/features/{configuration → 02_configure_aruba}/activate_announcer_on_command_failure.feature +2 -2
  10. data/features/{configuration/usage.feature → 02_configure_aruba/basics.feature} +21 -29
  11. data/features/{configuration → 02_configure_aruba}/command_runtime_environment.feature +0 -0
  12. data/features/{configuration → 02_configure_aruba}/console_history_file.feature +2 -2
  13. data/features/{configuration → 02_configure_aruba}/exit_timeout.feature +25 -17
  14. data/features/{configuration → 02_configure_aruba}/fixtures_directories.feature +2 -2
  15. data/features/{configuration → 02_configure_aruba}/fixtures_path_prefix.feature +1 -1
  16. data/features/{configuration → 02_configure_aruba}/home_directory.feature +6 -6
  17. data/features/{configuration → 02_configure_aruba}/io_timeout.feature +2 -2
  18. data/features/{configuration → 02_configure_aruba}/keep_ansi.feature +0 -0
  19. data/features/{configuration → 02_configure_aruba}/log_level.feature +2 -2
  20. data/features/{configuration → 02_configure_aruba}/physical_block_size.feature +3 -3
  21. data/features/{configuration → 02_configure_aruba}/remove_ansi_escape_sequences.feature +2 -2
  22. data/features/{configuration → 02_configure_aruba}/root_directory.feature +1 -1
  23. data/features/{configuration → 02_configure_aruba}/startup_wait_time.feature +2 -2
  24. data/features/{configuration → 02_configure_aruba}/working_directory.feature +9 -4
  25. data/features/{steps/core/announce.feature → 03_testing_frameworks/cucumber/announce_information_for_troubleshooting.feature} +20 -40
  26. data/features/{steps/environment → 03_testing_frameworks/cucumber}/disable_bunder.feature +0 -0
  27. data/features/{steps/command/exit_statuses.feature → 03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature} +20 -20
  28. data/features/{steps/command/output.feature → 03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature} +58 -111
  29. data/features/{steps/command/stderr.feature → 03_testing_frameworks/cucumber/steps/command/check_stderr_of_command.feature} +1 -1
  30. data/features/{steps/command/stdout.feature → 03_testing_frameworks/cucumber/steps/command/check_stdout_of_command.feature} +6 -6
  31. data/features/{steps/command/debug.feature → 03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature} +6 -6
  32. data/features/{steps/command/run.feature → 03_testing_frameworks/cucumber/steps/command/run_a_command.feature} +4 -4
  33. data/features/{steps/command/in_process.feature → 03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature} +2 -2
  34. data/features/{steps/command/interactive.feature → 03_testing_frameworks/cucumber/steps/command/run_command_interactively.feature} +2 -2
  35. data/features/03_testing_frameworks/cucumber/steps/command/run_commands_which_require_a_shell.feature +79 -0
  36. data/features/{steps/command/send_signal.feature → 03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature} +19 -40
  37. data/features/{steps/command/stop.feature → 03_testing_frameworks/cucumber/steps/command/stop_command.feature} +47 -75
  38. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/append_environment_variable.feature +3 -3
  39. data/features/{steps/environment/home_variable.feature → 03_testing_frameworks/cucumber/steps/environment/modify_home_variable_for_testing.feature} +4 -4
  40. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/prepend_environment_variable.feature +3 -3
  41. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/set_environment_variable.feature +3 -3
  42. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/append_to_file.feature +0 -0
  43. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/cd_to_directory.feature +0 -0
  44. data/features/{steps/filesystem/existence_of_directory.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_directory.feature} +0 -0
  45. data/features/{steps/filesystem/existence_of_file.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_file.feature} +0 -0
  46. data/features/{steps/filesystem/file_content.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_file_content.feature} +57 -0
  47. data/features/{steps/filesystem/non_existence_of_directory.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_directory.feature} +0 -0
  48. data/features/{steps/filesystem/non_existence_of_file.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_file.feature} +0 -0
  49. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/check_permissions_of_file.feature +0 -0
  50. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/compare_files.feature +0 -0
  51. data/features/{steps/filesystem/copy.feature → 03_testing_frameworks/cucumber/steps/filesystem/copy_file_or_directory.feature} +0 -0
  52. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/create_directory.feature +0 -0
  53. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/create_file.feature +0 -0
  54. data/features/{steps/filesystem/move.feature → 03_testing_frameworks/cucumber/steps/filesystem/move_file_or_directory.feature} +0 -1
  55. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/overwrite_file.feature +0 -0
  56. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/remove_directory.feature +0 -0
  57. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/remove_file.feature +0 -0
  58. data/features/{steps/filesystem/use_fixture.feature → 03_testing_frameworks/cucumber/steps/filesystem/use_fixtures_for_setup_test.feature} +0 -0
  59. data/features/{hooks/after/command.feature → 03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature} +1 -4
  60. data/features/{hooks/before/command.feature → 03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature} +1 -5
  61. data/features/{rspec/integration.feature → 03_testing_frameworks/rspec/setup_aruba_for_rspec.feature} +17 -17
  62. data/features/{api/command/find_command.feature → 04_aruba_api/command/find_a_started_command.feature} +0 -0
  63. data/features/{api/command/which.feature → 04_aruba_api/command/find_command_in_PATH.feature} +4 -4
  64. data/features/{api/command/stderr.feature → 04_aruba_api/command/read_stderr_of_command.feature} +8 -8
  65. data/features/{api/command/stdout.feature → 04_aruba_api/command/read_stdout_of_command.feature} +7 -7
  66. data/features/{api/command/run.feature → 04_aruba_api/command/run_command.feature} +53 -44
  67. data/features/{api → 04_aruba_api}/command/run_simple.feature +46 -34
  68. data/features/{api/command/send_signal.feature → 04_aruba_api/command/send_signal_to_command.feature} +8 -8
  69. data/features/{api → 04_aruba_api}/command/stop_all_commands.feature +18 -14
  70. data/features/{api/command/stop.feature → 04_aruba_api/command/stop_single_command.feature} +19 -18
  71. data/features/{api → 04_aruba_api}/command/terminate_all_commands.feature +16 -12
  72. data/features/{api/command/last_command_started.feature → 04_aruba_api/command/use_last_command_started.feature} +0 -0
  73. data/features/{api/command/last_command_stopped.feature → 04_aruba_api/command/use_last_command_stopped.feature} +2 -2
  74. data/features/{api → 04_aruba_api}/core/expand_path.feature +0 -0
  75. data/features/{api → 04_aruba_api}/environment/append_environment_variable.feature +0 -0
  76. data/features/{api → 04_aruba_api}/environment/delete_environment_variable.feature +0 -0
  77. data/features/{api → 04_aruba_api}/environment/prepend_environment_variable.feature +0 -0
  78. data/features/{api → 04_aruba_api}/environment/set_environment_variable.feature +0 -0
  79. data/features/{api/filesystem/cd.feature → 04_aruba_api/filesystem/cd_to_directory.feature} +0 -0
  80. data/features/{api/filesystem/does_exist.feature → 04_aruba_api/filesystem/check_existence_file_or_directory.feature} +0 -0
  81. data/features/{api/filesystem/is_absolute.feature → 04_aruba_api/filesystem/check_if_path_is_absolute.feature} +0 -0
  82. data/features/{api/filesystem/is_directory.feature → 04_aruba_api/filesystem/check_if_path_is_directory.feature} +0 -0
  83. data/features/{api/filesystem/is_file.feature → 04_aruba_api/filesystem/check_if_path_is_file.feature} +0 -0
  84. data/features/{api/filesystem/is_relative.feature → 04_aruba_api/filesystem/check_if_path_is_relative.feature} +0 -0
  85. data/features/{api → 04_aruba_api}/filesystem/create_directory.feature +0 -0
  86. data/features/{api/filesystem/move.feature → 04_aruba_api/filesystem/move_file_or_directory.feature} +0 -0
  87. data/features/{api/filesystem/disk_usage.feature → 04_aruba_api/filesystem/report_disk_usage.feature} +0 -0
  88. data/features/{api/filesystem/fixtures.feature → 04_aruba_api/filesystem/use_fixtures.feature} +0 -0
  89. data/features/{api → 04_aruba_api}/text/extract_text.feature +8 -8
  90. data/features/{api → 04_aruba_api}/text/replace_variables.feature +2 -2
  91. data/features/{api → 04_aruba_api}/text/sanitize_text.feature +22 -22
  92. data/features/{api → 04_aruba_api}/text/unescape_text.feature +12 -12
  93. data/features/{matchers/timeouts.feature → 05_use_rspec_matchers/command/check_timeouts.feature} +4 -4
  94. data/features/{matchers → 05_use_rspec_matchers}/directory/have_sub_directory.feature +0 -0
  95. data/features/{matchers → 05_use_rspec_matchers}/file/be_a_command_found_in_path.feature +0 -0
  96. data/features/{matchers → 05_use_rspec_matchers}/file/be_existing_executable.feature +0 -0
  97. data/features/{matchers → 05_use_rspec_matchers}/file/be_existing_file.feature +0 -0
  98. data/features/{matchers → 05_use_rspec_matchers}/file/have_file_content.feature +0 -0
  99. data/features/{matchers → 05_use_rspec_matchers}/file/have_file_size.feature +0 -0
  100. data/features/{matchers → 05_use_rspec_matchers}/path/be_an_absolute_path.feature +0 -0
  101. data/features/{matchers → 05_use_rspec_matchers}/path/be_an_existing_path.feature +0 -0
  102. data/features/{matchers → 05_use_rspec_matchers}/path/have_permissions.feature +4 -4
  103. data/features/{cli/init.feature → 06_use_aruba_cli/initialize_project_with_aruba.feature} +0 -0
  104. data/features/{cli/console.feature → 06_use_aruba_cli/open_console.feature} +0 -0
  105. data/features/08_other/improve_performance_if_using_jruby.feature +37 -0
  106. data/features/step_definitions/hooks.rb +0 -10
  107. data/features/support/env.rb +1 -1
  108. data/features/support/simplecov_setup.rb +9 -6
  109. data/fixtures/cli-app/bin/{cli → aruba-test-cli} +0 -0
  110. data/fixtures/cli-app/spec/spec_helper.rb +1 -0
  111. data/fixtures/empty-app/lib/cli/app.rb +0 -6
  112. data/lib/aruba/api/commands.rb +24 -0
  113. data/lib/aruba/api/core.rb +9 -2
  114. data/lib/aruba/api/deprecated.rb +2 -73
  115. data/lib/aruba/api/filesystem.rb +1 -1
  116. data/lib/aruba/colorizer.rb +10 -99
  117. data/lib/aruba/config/jruby.rb +15 -5
  118. data/lib/aruba/cucumber.rb +1 -0
  119. data/lib/aruba/cucumber/command.rb +63 -93
  120. data/lib/aruba/cucumber/deprecated.rb +93 -0
  121. data/lib/aruba/cucumber/file.rb +0 -12
  122. data/lib/aruba/cucumber/hooks.rb +0 -44
  123. data/lib/aruba/in_process.rb +2 -0
  124. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  125. data/lib/aruba/platforms/announcer.rb +1 -1
  126. data/lib/aruba/platforms/command_monitor.rb +0 -3
  127. data/lib/aruba/processes/spawn_process.rb +17 -5
  128. data/lib/aruba/spawn_process.rb +4 -1
  129. data/lib/aruba/version.rb +1 -1
  130. data/script/bootstrap +0 -4
  131. data/spec/aruba/api/core_spec.rb +142 -0
  132. data/spec/aruba/api/deprecated_spec.rb +113 -0
  133. data/spec/aruba/api/filesystem_spec.rb +746 -0
  134. data/spec/aruba/api_spec.rb +1 -885
  135. data/spec/aruba/jruby_spec.rb +46 -28
  136. data/spec/aruba/{spawn_process_spec.rb → processes/spawn_process_spec.rb} +18 -2
  137. data/spec/spec_helper.rb +5 -3
  138. metadata +108 -115
  139. data/features/development/build.feature +0 -15
  140. data/features/getting_started/writing_good_feature_tests.feature +0 -38
  141. data/features/matchers/collection/include_an_object.feature +0 -72
  142. data/features/platforms/jruby.feature +0 -14
  143. data/features/step_definitions/aruba_dev_steps.rb +0 -56
  144. data/features/steps/command/shell.feature +0 -155
  145. data/features/steps/filesystem/check_file_content.feature +0 -61
  146. data/features/steps/filesystem/fixtures.feature +0 -64
  147. data/features/steps/overview.feature +0 -25
  148. data/spec/aruba/api/environment/restore_env_spec.rb +0 -86
  149. data/spec/aruba/api/environment/set_env_spec.rb +0 -46
  150. data/spec/aruba/api/filesystem/file_size_spec.rb +0 -28
@@ -2,16 +2,26 @@ require 'rbconfig'
2
2
 
3
3
  # ideas taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html
4
4
  Aruba.configure do |config|
5
- config.before :command do
5
+ config.before :command do |command|
6
6
  next unless RUBY_PLATFORM == 'java'
7
7
 
8
+ env = command.environment
9
+
10
+ jruby_opts = env['JRUBY_OPTS'] || ''
11
+
8
12
  # disable JIT since these processes are so short lived
9
- ENV['JRUBY_OPTS'] = "-X-C #{ENV['JRUBY_OPTS']}" unless (ENV['JRUBY_OPTS'] || '') .include? '-X-C'
13
+ jruby_opts = "-X-C #{jruby_opts}" unless jruby_opts.include? '-X-C'
10
14
 
11
15
  # Faster startup for jruby
12
- ENV['JRUBY_OPTS'] = "--dev #{ENV['JRUBY_OPTS']}" unless (ENV['JRUBY_OPTS'] || '').include? '--dev'
16
+ jruby_opts = "--dev #{jruby_opts}" unless jruby_opts.include? '--dev'
17
+
18
+ env['JRUBY_OPTS'] = jruby_opts
19
+
20
+ if RbConfig::CONFIG['host_os'] =~ /solaris|sunos/i
21
+ java_opts = env['JAVA_OPTS'] || ''
13
22
 
14
- # force jRuby to use client JVM for faster startup times
15
- ENV['JAVA_OPTS'] = "-d32 #{ENV['JAVA_OPTS']}" if RbConfig::CONFIG['host_os'] =~ /solaris|sunos/i && !(ENV['JAVA_OPTS'] || '').include?('-d32')
23
+ # force jRuby to use client JVM for faster startup times
24
+ env['JAVA_OPTS'] = "-d32 #{java_opts}" unless java_opts.include?('-d32')
25
+ end
16
26
  end
17
27
  end
@@ -6,6 +6,7 @@ World(Aruba::Api)
6
6
  require 'aruba/cucumber/hooks'
7
7
  require 'aruba/cucumber/command'
8
8
  require 'aruba/cucumber/core'
9
+ require 'aruba/cucumber/deprecated'
9
10
  require 'aruba/cucumber/environment'
10
11
  require 'aruba/cucumber/file'
11
12
  require 'aruba/cucumber/testing_frameworks'
@@ -3,30 +3,16 @@ if Aruba::VERSION < '1.0.0'
3
3
  end
4
4
  require 'aruba/generators/script_file'
5
5
 
6
- When(/^I run "(.*)"$/)do |cmd|
7
- warn(%{\e[35m The /^I run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m})
8
-
9
- cmd = sanitize_text(cmd)
10
- run_command_and_stop(cmd, false)
11
- end
12
-
13
6
  When(/^I run `([^`]*)`$/)do |cmd|
14
7
  cmd = sanitize_text(cmd)
15
8
  run_command_and_stop(cmd, :fail_on_error => false)
16
9
  end
17
10
 
18
- When(/^I successfully run "(.*)"$/)do |cmd|
19
- warn(%{\e[35m The /^I successfully run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m})
20
-
21
- cmd = sanitize_text(cmd)
22
- run_command_and_stop(cmd)
23
- end
24
-
25
11
  ## I successfully run `echo -n "Hello"`
26
12
  ## I successfully run `sleep 29` for up to 30 seconds
27
- When(/^I successfully run `(.*?)`(?: for up to (\d+) seconds)?$/)do |cmd, secs|
13
+ When(/^I successfully run `(.*?)`(?: for up to ([\d.]+) seconds)?$/) do |cmd, secs|
28
14
  cmd = sanitize_text(cmd)
29
- run_command_and_stop(cmd, :fail_on_error => true, :exit_timeout => secs && secs.to_i)
15
+ run_command_and_stop(cmd, :fail_on_error => true, :exit_timeout => secs && secs.to_f)
30
16
  end
31
17
 
32
18
  When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) do |shell, commands|
@@ -40,12 +26,6 @@ When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) do
40
26
  step 'I run `myscript`'
41
27
  end
42
28
 
43
- When(/^I run "([^"]*)" interactively$/) do |cmd|
44
- Aruba.platform.deprecated(%{\e[35m The /^I run "([^"]*)" interactively$/ step definition is deprecated. Please use the `backticks` version\e[0m})
45
-
46
- step %(I run `#{cmd}` interactively)
47
- end
48
-
49
29
  When(/^I run `([^`]*)` interactively$/)do |cmd|
50
30
  cmd = sanitize_text(cmd)
51
31
  @interactive = run_command(cmd)
@@ -156,7 +136,30 @@ Then(/^the output should be (\d+) bytes long$/) do |size|
156
136
  expect(last_command_started.output).to have_output_size size.to_i
157
137
  end
158
138
 
159
- Then(/^(?:the )?(output|stderr|stdout)(?: from "([^"]*)")? should( not)? contain( exactly)? "([^"]*)"$/) do |channel, cmd, negated, exactly, expected|
139
+ Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)? "([^"]*)"$/) do |channel, negated, exactly, expected|
140
+ combined_output = case channel.to_sym
141
+ when :output
142
+ all_output
143
+ when :stderr
144
+ all_stderr
145
+ when :stdout
146
+ all_stdout
147
+ end
148
+
149
+ output_string_matcher = if exactly
150
+ :an_output_string_being_eq
151
+ else
152
+ :an_output_string_including
153
+ end
154
+
155
+ if negated
156
+ expect(combined_output).not_to send(output_string_matcher, expected)
157
+ else
158
+ expect(combined_output).to send(output_string_matcher, expected)
159
+ end
160
+ end
161
+
162
+ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should( not)? contain( exactly)? "([^"]*)"$/) do |channel, cmd, negated, exactly, expected|
160
163
  matcher = case channel.to_sym
161
164
  when :output
162
165
  :have_output
@@ -166,11 +169,7 @@ Then(/^(?:the )?(output|stderr|stdout)(?: from "([^"]*)")? should( not)? contain
166
169
  :have_output_on_stdout
167
170
  end
168
171
 
169
- commands = if cmd
170
- [aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))]
171
- else
172
- all_commands
173
- end
172
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
174
173
 
175
174
  output_string_matcher = if exactly
176
175
  :an_output_string_being_eq
@@ -178,31 +177,37 @@ Then(/^(?:the )?(output|stderr|stdout)(?: from "([^"]*)")? should( not)? contain
178
177
  :an_output_string_including
179
178
  end
180
179
 
181
- if Aruba::VERSION < '1.0'
182
- combined_output = commands.map do |c|
183
- c.stop
184
- c.send(channel.to_sym).chomp
185
- end.join("\n")
180
+ if negated
181
+ expect(command).not_to send(matcher, send(output_string_matcher, expected))
182
+ else
183
+ expect(command).to send(matcher, send(output_string_matcher, expected))
184
+ end
185
+ end
186
186
 
187
- if negated
188
- expect(combined_output).not_to send(output_string_matcher, expected)
189
- else
190
- expect(combined_output).to send(output_string_matcher, expected)
191
- end
187
+ Then(/^(?:the )?(output|stderr|stdout) should( not)? contain( exactly)?:$/) do |channel, negated, exactly, expected|
188
+ combined_output = case channel.to_sym
189
+ when :output
190
+ all_output
191
+ when :stderr
192
+ all_stderr
193
+ when :stdout
194
+ all_stdout
195
+ end
196
+
197
+ output_string_matcher = if exactly
198
+ :an_output_string_being_eq
199
+ else
200
+ :an_output_string_including
201
+ end
202
+
203
+ if negated
204
+ expect(combined_output).not_to send(output_string_matcher, expected)
192
205
  else
193
- if negated
194
- expect(commands).not_to include_an_object send(matcher, send(output_string_matcher, expected))
195
- else
196
- expect(commands).to include_an_object send(matcher, send(output_string_matcher, expected))
197
- end
206
+ expect(combined_output).to send(output_string_matcher, expected)
198
207
  end
199
208
  end
200
209
 
201
- ## the stderr should contain "hello"
202
- ## the stderr from "echo -n 'Hello'" should contain "hello"
203
- ## the stderr should contain exactly:
204
- ## the stderr from "echo -n 'Hello'" should contain exactly:
205
- Then(/^(?:the )?(output|stderr|stdout)(?: from "([^"]*)")? should( not)? contain( exactly)?:$/) do |channel, cmd, negated, exactly, expected|
210
+ Then(/^(?:the )?(output|stderr|stdout) from "([^"]*)" should( not)? contain( exactly)?:$/) do |channel, cmd, negated, exactly, expected|
206
211
  matcher = case channel.to_sym
207
212
  when :output
208
213
  :have_output
@@ -210,15 +215,9 @@ Then(/^(?:the )?(output|stderr|stdout)(?: from "([^"]*)")? should( not)? contain
210
215
  :have_output_on_stderr
211
216
  when :stdout
212
217
  :have_output_on_stdout
213
- else
214
- fail ArgumentError, %(Invalid channel "#{channel}" chosen. Only "output", "stderr" or "stdout" are allowed.)
215
218
  end
216
219
 
217
- commands = if cmd
218
- [aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))]
219
- else
220
- all_commands
221
- end
220
+ command = aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))
222
221
 
223
222
  output_string_matcher = if exactly
224
223
  :an_output_string_being_eq
@@ -226,23 +225,10 @@ Then(/^(?:the )?(output|stderr|stdout)(?: from "([^"]*)")? should( not)? contain
226
225
  :an_output_string_including
227
226
  end
228
227
 
229
- if Aruba::VERSION < '1.0'
230
- combined_output = commands.map do |c|
231
- c.stop
232
- c.send(channel.to_sym).chomp
233
- end.join("\n")
234
-
235
- if negated
236
- expect(combined_output).not_to send(output_string_matcher, expected)
237
- else
238
- expect(combined_output).to send(output_string_matcher, expected)
239
- end
228
+ if negated
229
+ expect(command).not_to send(matcher, send(output_string_matcher, expected))
240
230
  else
241
- if negated
242
- expect(commands).not_to include_an_object send(matcher, send(output_string_matcher, expected))
243
- else
244
- expect(commands).to include_an_object send(matcher, send(output_string_matcher, expected))
245
- end
231
+ expect(command).to send(matcher, send(output_string_matcher, expected))
246
232
  end
247
233
  end
248
234
 
@@ -374,36 +360,20 @@ Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:
374
360
  end
375
361
  end
376
362
 
377
- Given(/the default aruba timeout is (\d+) seconds/) do |seconds|
378
- # rubocop:disable Metrics/LineLength
379
- Aruba.platform.deprecated(%{The /^the default aruba timeout is (\d+) seconds/ step definition is deprecated. Please use /^the default aruba exit timeout is (\d+) seconds/ step definition is deprecated.})
380
- # rubocop:enable Metrics/LineLength
381
-
382
- aruba.config.exit_timeout = seconds.to_i
383
- end
384
-
385
- Given(/The default aruba timeout is (\d+) seconds/) do |seconds|
386
- # rubocop:disable Metrics/LineLength
387
- Aruba.platform.deprecated(%{The /^The default aruba timeout is (\d+) seconds/ step definition is deprecated. Please use /^the default aruba exit timeout is (\d+) seconds/ step definition is deprecated.})
388
- # rubocop:enable Metrics/LineLength
389
-
390
- aruba.config.exit_timeout = seconds.to_i
391
- end
392
-
393
- Given(/^the (?:default )?aruba io wait timeout is (\d+) seconds?$/) do |seconds|
394
- aruba.config.io_wait_timeout = seconds.to_i
363
+ Given(/^the (?:default )?aruba io wait timeout is ([\d.]+) seconds?$/) do |seconds|
364
+ aruba.config.io_wait_timeout = seconds.to_f
395
365
  end
396
366
 
397
- Given(/^the (?:default )?aruba exit timeout is (\d+) seconds?$/) do |seconds|
398
- aruba.config.exit_timeout = seconds.to_i
367
+ Given(/^the (?:default )?aruba exit timeout is ([\d.]+) seconds?$/) do |seconds|
368
+ aruba.config.exit_timeout = seconds.to_f
399
369
  end
400
370
 
401
371
  Given(/^the (?:default )?aruba stop signal is "([^"]*)"$/) do |signal|
402
372
  aruba.config.stop_signal = signal
403
373
  end
404
374
 
405
- Given(/^I wait (\d+) seconds? for (?:a|the) command to start up$/) do |seconds|
406
- aruba.config.startup_wait_time = seconds.to_i
375
+ Given(/^I wait ([\d.]+) seconds? for (?:a|the) command to start up$/) do |seconds|
376
+ aruba.config.startup_wait_time = seconds.to_f
407
377
  end
408
378
 
409
379
  When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/) do |signal, command|
@@ -0,0 +1,93 @@
1
+ Before('@announce-cmd') do
2
+ Aruba.platform.deprecated 'The use of "@announce-cmd"-hook is deprecated. Please use "@announce-command"'
3
+
4
+ aruba.announcer.activate :command
5
+ end
6
+
7
+ Before('@announce-dir') do
8
+ Aruba.platform.deprecated 'The use of "@announce-dir"-hook is deprecated. Please use "@announce-directory"'
9
+
10
+ aruba.announcer.activate :directory
11
+ end
12
+
13
+ Before('@announce-env') do
14
+ Aruba.platform.deprecated 'The use of "@announce-env"-hook is deprecated. Please use "@announce-changed-environment"'
15
+
16
+ aruba.announcer.activate :environment
17
+ end
18
+
19
+ Before('@announce-environment') do
20
+ Aruba.platform.deprecated '@announce-environment is deprecated. Use @announce-changed-environment instead'
21
+
22
+ aruba.announcer.activate :changed_environment
23
+ end
24
+
25
+ Before('@announce-modified-environment') do
26
+ Aruba.platform.deprecated '@announce-modified-environment is deprecated. Use @announce-changed-environment instead'
27
+
28
+ aruba.announcer.activate :changed_environment
29
+ end
30
+
31
+ Before('@ansi') do
32
+ # rubocop:disable Metrics/LineLength
33
+ Aruba::Platform.deprecated('The use of "@ansi" is deprecated. Use "@keep-ansi-escape-sequences" instead. But be aware, that this hook uses the aruba configuration and not an instance variable')
34
+ # rubocop:enable Metrics/LineLength
35
+
36
+ aruba.config.remove_ansi_escape_sequences = false
37
+ end
38
+
39
+
40
+ Before '@mocked_home_directory' do
41
+ Aruba.platform.deprecated('The use of "@mocked_home_directory" is deprecated. Use "@mocked-home-directory" instead')
42
+
43
+ set_environment_variable 'HOME', expand_path('.')
44
+ end
45
+
46
+ When(/^I run "(.*)"$/)do |cmd|
47
+ warn(%{\e[35m The /^I run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m})
48
+
49
+ cmd = sanitize_text(cmd)
50
+ run_command_and_stop(cmd, false)
51
+ end
52
+
53
+ When(/^I successfully run "(.*)"$/)do |cmd|
54
+ warn(%{\e[35m The /^I successfully run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m})
55
+
56
+ cmd = sanitize_text(cmd)
57
+ run_command_and_stop(cmd)
58
+ end
59
+
60
+ When(/^I run "([^"]*)" interactively$/) do |cmd|
61
+ Aruba.platform.deprecated(%{\e[35m The /^I run "([^"]*)" interactively$/ step definition is deprecated. Please use the `backticks` version\e[0m})
62
+
63
+ step %(I run `#{cmd}` interactively)
64
+ end
65
+
66
+ Given(/the default aruba timeout is (\d+) seconds/) do |seconds|
67
+ # rubocop:disable Metrics/LineLength
68
+ Aruba.platform.deprecated(%{The /^the default aruba timeout is (\d+) seconds/ step definition is deprecated. Please use /^the default aruba exit timeout is (\d+) seconds/ step definition is deprecated.})
69
+ # rubocop:enable Metrics/LineLength
70
+
71
+ aruba.config.exit_timeout = seconds.to_i
72
+ end
73
+
74
+ Given(/The default aruba timeout is (\d+) seconds/) do |seconds|
75
+ # rubocop:disable Metrics/LineLength
76
+ Aruba.platform.deprecated(%{The /^The default aruba timeout is (\d+) seconds/ step definition is deprecated. Please use /^the default aruba exit timeout is (\d+) seconds/ step definition is deprecated.})
77
+ # rubocop:enable Metrics/LineLength
78
+
79
+ aruba.config.exit_timeout = seconds.to_i
80
+ end
81
+
82
+ Then(/^the mode of filesystem object "([^"]*)" should (not )?match "([^"]*)"$/) do |file, negated, permissions|
83
+ # rubocop:disable Metrics/LineLength
84
+ Aruba.platform.deprecated('The use of step "the mode of filesystem object "([^"]*)" should (not )?match "([^"]*)" is deprecated. Use "^the (?:file|directory)(?: named)? "([^"]*)" should have permissions "([^"]*)"$" instead')
85
+ # rubocop:enable Metrics/LineLength
86
+
87
+ if negated
88
+ expect(file).not_to have_permissions(permissions)
89
+ else
90
+ expect(file).to have_permissions(permissions)
91
+ end
92
+ end
93
+
@@ -180,18 +180,6 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?be equal to file "([^"]
180
180
  end
181
181
  end
182
182
 
183
- Then(/^the mode of filesystem object "([^"]*)" should (not )?match "([^"]*)"$/) do |file, negated, permissions|
184
- # rubocop:disable Metrics/LineLength
185
- Aruba.platform.deprecated('The use of step "the mode of filesystem object "([^"]*)" should (not )?match "([^"]*)" is deprecated. Use "^the (?:file|directory)(?: named)? "([^"]*)" should have permissions "([^"]*)"$" instead')
186
- # rubocop:enable Metrics/LineLength
187
-
188
- if negated
189
- expect(file).not_to have_permissions(permissions)
190
- else
191
- expect(file).to have_permissions(permissions)
192
- end
193
- end
194
-
195
183
  Then(/^the (?:file|directory)(?: named)? "([^"]*)" should( not)? have permissions "([^"]*)"$/) do |path, negated, permissions|
196
184
  if negated
197
185
  expect(path).not_to have_permissions(permissions)
@@ -44,12 +44,6 @@ Before('@announce-command-filesystem-status') do
44
44
  aruba.announcer.activate :command_filesystem_status
45
45
  end
46
46
 
47
- Before('@announce-cmd') do
48
- Aruba.platform.deprecated 'The use of "@announce-cmd"-hook is deprecated. Please use "@announce-command"'
49
-
50
- aruba.announcer.activate :command
51
- end
52
-
53
47
  Before('@announce-output') do
54
48
  aruba.announcer.activate :stdout
55
49
  aruba.announcer.activate :stderr
@@ -63,12 +57,6 @@ Before('@announce-stderr') do
63
57
  aruba.announcer.activate :stderr
64
58
  end
65
59
 
66
- Before('@announce-dir') do
67
- Aruba.platform.deprecated 'The use of "@announce-dir"-hook is deprecated. Please use "@announce-directory"'
68
-
69
- aruba.announcer.activate :directory
70
- end
71
-
72
60
  Before('@announce-directory') do
73
61
  aruba.announcer.activate :directory
74
62
  end
@@ -77,28 +65,10 @@ Before('@announce-stop-signal') do
77
65
  aruba.announcer.activate :stop_signal
78
66
  end
79
67
 
80
- Before('@announce-env') do
81
- Aruba.platform.deprecated 'The use of "@announce-env"-hook is deprecated. Please use "@announce-changed-environment"'
82
-
83
- aruba.announcer.activate :environment
84
- end
85
-
86
- Before('@announce-environment') do
87
- Aruba.platform.deprecated '@announce-environment is deprecated. Use @announce-changed-environment instead'
88
-
89
- aruba.announcer.activate :changed_environment
90
- end
91
-
92
68
  Before('@announce-full-environment') do
93
69
  aruba.announcer.activate :full_environment
94
70
  end
95
71
 
96
- Before('@announce-modified-environment') do
97
- Aruba.platform.deprecated '@announce-modified-environment is deprecated. Use @announce-changed-environment instead'
98
-
99
- aruba.announcer.activate :changed_environment
100
- end
101
-
102
72
  Before('@announce-changed-environment') do
103
73
  aruba.announcer.activate :changed_environment
104
74
  end
@@ -135,25 +105,11 @@ end
135
105
  # aruba.config.command_launcher = :spawn
136
106
  # end
137
107
 
138
- Before('@ansi') do
139
- # rubocop:disable Metrics/LineLength
140
- Aruba::Platform.deprecated('The use of "@ansi" is deprecated. Use "@keep-ansi-escape-sequences" instead. But be aware, that this hook uses the aruba configuration and not an instance variable')
141
- # rubocop:enable Metrics/LineLength
142
-
143
- aruba.config.remove_ansi_escape_sequences = false
144
- end
145
-
146
108
  Before('@keep-ansi-escape-sequences') do
147
109
  aruba.config.remove_ansi_escape_sequences = false
148
110
  aruba.config.keep_ansi = true
149
111
  end
150
112
 
151
- Before '@mocked_home_directory' do
152
- Aruba.platform.deprecated('The use of "@mocked_home_directory" is deprecated. Use "@mocked-home-directory" instead')
153
-
154
- set_environment_variable 'HOME', expand_path('.')
155
- end
156
-
157
113
  Before '@mocked-home-directory' do
158
114
  set_environment_variable 'HOME', expand_path('.')
159
115
  end