aruba 0.14.9 → 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.
Files changed (309) hide show
  1. checksums.yaml +4 -4
  2. data/.cucumberproignore +3 -0
  3. data/.github/ISSUE_TEMPLATE.md +48 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +41 -0
  5. data/.gitignore +1 -0
  6. data/.rspec +1 -1
  7. data/.rubocop.yml +20 -179
  8. data/.rubocop_todo.yml +262 -0
  9. data/.simplecov +7 -5
  10. data/.travis.yml +54 -46
  11. data/.yardopts +3 -0
  12. data/CHANGELOG.md +613 -246
  13. data/CONTRIBUTING.md +247 -45
  14. data/Dockerfile +67 -0
  15. data/Gemfile +5 -96
  16. data/LICENSE +1 -1
  17. data/README.md +57 -180
  18. data/Rakefile +63 -32
  19. data/appveyor.yml +8 -11
  20. data/aruba.gemspec +47 -41
  21. data/bin/console +7 -0
  22. data/bin/test +9 -0
  23. data/cucumber.yml +4 -24
  24. data/doc/dependency_decisions.yml +42 -2
  25. data/docker-compose.yml +26 -0
  26. data/{bin → exe}/aruba +1 -1
  27. data/fixtures/cli-app/Rakefile +1 -1
  28. data/fixtures/cli-app/bin/aruba-test-cli +6 -0
  29. data/fixtures/cli-app/cli-app.gemspec +1 -2
  30. data/fixtures/cli-app/features/support/aruba.rb +1 -0
  31. data/fixtures/cli-app/features/support/env.rb +1 -1
  32. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
  33. data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
  34. data/fixtures/cli-app/lib/cli/app.rb +1 -5
  35. data/fixtures/cli-app/spec/spec_helper.rb +4 -6
  36. data/fixtures/empty-app/Rakefile +1 -1
  37. data/fixtures/empty-app/cli-app.gemspec +1 -2
  38. data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
  39. data/fixtures/empty-app/lib/cli/app.rb +0 -6
  40. data/fixtures/getting-started-app/Gemfile +1 -1
  41. data/lib/aruba/api/commands.rb +109 -143
  42. data/lib/aruba/api/core.rb +57 -43
  43. data/lib/aruba/api/environment.rb +16 -7
  44. data/lib/aruba/api/filesystem.rb +42 -29
  45. data/lib/aruba/api/text.rb +3 -9
  46. data/lib/aruba/api.rb +6 -11
  47. data/lib/aruba/aruba_path.rb +27 -89
  48. data/lib/aruba/basic_configuration.rb +4 -24
  49. data/lib/aruba/cli.rb +1 -1
  50. data/lib/aruba/colorizer.rb +10 -99
  51. data/lib/aruba/command.rb +2 -0
  52. data/lib/aruba/config/jruby.rb +15 -5
  53. data/lib/aruba/config_wrapper.rb +1 -1
  54. data/lib/aruba/configuration.rb +92 -0
  55. data/lib/aruba/console/help.rb +1 -7
  56. data/lib/aruba/console.rb +5 -5
  57. data/lib/aruba/contracts/absolute_path.rb +2 -2
  58. data/lib/aruba/contracts/relative_path.rb +2 -2
  59. data/lib/aruba/cucumber/command.rb +171 -160
  60. data/lib/aruba/cucumber/environment.rb +1 -1
  61. data/lib/aruba/cucumber/file.rb +21 -35
  62. data/lib/aruba/cucumber/hooks.rb +17 -56
  63. data/lib/aruba/cucumber/testing_frameworks.rb +74 -50
  64. data/lib/aruba/cucumber.rb +0 -5
  65. data/lib/aruba/event_bus/name_resolver.rb +5 -16
  66. data/lib/aruba/hooks.rb +1 -1
  67. data/lib/aruba/in_config_wrapper.rb +5 -1
  68. data/lib/aruba/initializer.rb +36 -42
  69. data/lib/aruba/matchers/base/base_matcher.rb +2 -2
  70. data/lib/aruba/matchers/base/message_indenter.rb +19 -0
  71. data/lib/aruba/matchers/base/object_formatter.rb +2 -9
  72. data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
  73. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
  74. data/lib/aruba/matchers/command/have_exit_status.rb +14 -4
  75. data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -5
  76. data/lib/aruba/matchers/command/have_output.rb +10 -5
  77. data/lib/aruba/matchers/command/have_output_on_stderr.rb +2 -2
  78. data/lib/aruba/matchers/command/have_output_on_stdout.rb +2 -2
  79. data/lib/aruba/matchers/command/have_output_size.rb +2 -2
  80. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +5 -7
  81. data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
  82. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
  83. data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
  84. data/lib/aruba/matchers/file/be_an_existing_file.rb +5 -7
  85. data/lib/aruba/matchers/file/have_file_content.rb +4 -4
  86. data/lib/aruba/matchers/file/have_file_size.rb +6 -8
  87. data/lib/aruba/matchers/file/have_same_file_content.rb +5 -8
  88. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
  89. data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
  90. data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
  91. data/lib/aruba/matchers/path/have_permissions.rb +6 -8
  92. data/lib/aruba/matchers/string/include_output_string.rb +8 -10
  93. data/lib/aruba/matchers/string/match_output_string.rb +9 -11
  94. data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
  95. data/lib/aruba/platform.rb +0 -8
  96. data/lib/aruba/platforms/announcer.rb +42 -79
  97. data/lib/aruba/platforms/aruba_file_creator.rb +2 -6
  98. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
  99. data/lib/aruba/platforms/aruba_logger.rb +23 -7
  100. data/lib/aruba/platforms/command_monitor.rb +12 -107
  101. data/lib/aruba/platforms/determine_disk_usage.rb +56 -14
  102. data/lib/aruba/platforms/filesystem_status.rb +10 -14
  103. data/lib/aruba/platforms/local_environment.rb +2 -2
  104. data/lib/aruba/platforms/simple_table.rb +3 -11
  105. data/lib/aruba/platforms/unix_command_string.rb +7 -11
  106. data/lib/aruba/platforms/unix_environment_variables.rb +18 -27
  107. data/lib/aruba/platforms/unix_platform.rb +20 -51
  108. data/lib/aruba/platforms/unix_which.rb +2 -1
  109. data/lib/aruba/platforms/windows_command_string.rb +15 -10
  110. data/lib/aruba/platforms/windows_environment_variables.rb +43 -44
  111. data/lib/aruba/platforms/windows_platform.rb +4 -0
  112. data/lib/aruba/platforms/windows_which.rb +4 -3
  113. data/lib/aruba/processes/basic_process.rb +28 -30
  114. data/lib/aruba/processes/debug_process.rb +12 -3
  115. data/lib/aruba/processes/in_process.rb +17 -8
  116. data/lib/aruba/processes/spawn_process.rb +57 -46
  117. data/lib/aruba/rspec.rb +14 -36
  118. data/lib/aruba/runtime.rb +3 -6
  119. data/lib/aruba/setup.rb +6 -6
  120. data/lib/aruba/tasks/docker_helpers.rb +154 -0
  121. data/lib/aruba/version.rb +1 -1
  122. metadata +191 -244
  123. data/features/.nav +0 -72
  124. data/features/api/command/find_command.feature +0 -83
  125. data/features/api/command/last_command_started.feature +0 -50
  126. data/features/api/command/last_command_stopped.feature +0 -89
  127. data/features/api/command/run.feature +0 -414
  128. data/features/api/command/run_simple.feature +0 -242
  129. data/features/api/command/send_signal.feature +0 -53
  130. data/features/api/command/stderr.feature +0 -46
  131. data/features/api/command/stdout.feature +0 -46
  132. data/features/api/command/stop.feature +0 -131
  133. data/features/api/command/stop_all_commands.feature +0 -53
  134. data/features/api/command/terminate_all_commands.feature +0 -53
  135. data/features/api/command/which.feature +0 -37
  136. data/features/api/core/expand_path.feature +0 -88
  137. data/features/api/environment/append_environment_variable.feature +0 -128
  138. data/features/api/environment/delete_environment_variable.feature +0 -63
  139. data/features/api/environment/prepend_environment_variable.feature +0 -128
  140. data/features/api/environment/set_environment_variable.feature +0 -376
  141. data/features/api/filesystem/cd.feature +0 -184
  142. data/features/api/filesystem/create_directory.feature +0 -57
  143. data/features/api/filesystem/disk_usage.feature +0 -152
  144. data/features/api/filesystem/does_exist.feature +0 -62
  145. data/features/api/filesystem/fixtures.feature +0 -104
  146. data/features/api/filesystem/is_absolute.feature +0 -48
  147. data/features/api/filesystem/is_directory.feature +0 -53
  148. data/features/api/filesystem/is_file.feature +0 -54
  149. data/features/api/filesystem/is_relative.feature +0 -48
  150. data/features/api/filesystem/move.feature +0 -119
  151. data/features/api/text/extract_text.feature +0 -87
  152. data/features/api/text/replace_variables.feature +0 -45
  153. data/features/api/text/sanitize_text.feature +0 -228
  154. data/features/api/text/unescape_text.feature +0 -127
  155. data/features/cli/console.feature +0 -52
  156. data/features/cli/init.feature +0 -79
  157. data/features/configuration/activate_announcer_on_command_failure.feature +0 -38
  158. data/features/configuration/command_runtime_environment.feature +0 -129
  159. data/features/configuration/console_history_file.feature +0 -38
  160. data/features/configuration/exit_timeout.feature +0 -52
  161. data/features/configuration/fixtures_directories.feature +0 -38
  162. data/features/configuration/fixtures_path_prefix.feature +0 -23
  163. data/features/configuration/home_directory.feature +0 -80
  164. data/features/configuration/io_timeout.feature +0 -30
  165. data/features/configuration/keep_ansi.feature +0 -30
  166. data/features/configuration/log_level.feature +0 -38
  167. data/features/configuration/physical_block_size.feature +0 -53
  168. data/features/configuration/remove_ansi_escape_sequences.feature +0 -38
  169. data/features/configuration/root_directory.feature +0 -30
  170. data/features/configuration/startup_wait_time.feature +0 -48
  171. data/features/configuration/usage.feature +0 -159
  172. data/features/configuration/working_directory.feature +0 -33
  173. data/features/development/build.feature +0 -15
  174. data/features/getting_started/cleanup.feature +0 -58
  175. data/features/getting_started/run_commands.feature +0 -187
  176. data/features/getting_started/supported_testing_frameworks.feature +0 -104
  177. data/features/getting_started/writing_good_feature_tests.feature +0 -38
  178. data/features/hooks/after/command.feature +0 -46
  179. data/features/hooks/before/command.feature +0 -75
  180. data/features/matchers/collection/include_an_object.feature +0 -72
  181. data/features/matchers/directory/have_sub_directory.feature +0 -110
  182. data/features/matchers/file/be_a_command_found_in_path.feature +0 -115
  183. data/features/matchers/file/be_existing_executable.feature +0 -88
  184. data/features/matchers/file/be_existing_file.feature +0 -82
  185. data/features/matchers/file/have_file_content.feature +0 -123
  186. data/features/matchers/file/have_file_size.feature +0 -107
  187. data/features/matchers/path/be_an_absolute_path.feature +0 -74
  188. data/features/matchers/path/be_an_existing_path.feature +0 -97
  189. data/features/matchers/path/have_permissions.feature +0 -118
  190. data/features/matchers/timeouts.feature +0 -48
  191. data/features/platforms/jruby.feature +0 -14
  192. data/features/rspec/integration.feature +0 -179
  193. data/features/step_definitions/aruba_dev_steps.rb +0 -56
  194. data/features/step_definitions/hooks.rb +0 -156
  195. data/features/steps/command/debug.feature +0 -92
  196. data/features/steps/command/exit_statuses.feature +0 -136
  197. data/features/steps/command/in_process.feature +0 -485
  198. data/features/steps/command/interactive.feature +0 -90
  199. data/features/steps/command/output.feature +0 -567
  200. data/features/steps/command/run.feature +0 -66
  201. data/features/steps/command/send_signal.feature +0 -104
  202. data/features/steps/command/shell.feature +0 -155
  203. data/features/steps/command/stderr.feature +0 -68
  204. data/features/steps/command/stdout.feature +0 -109
  205. data/features/steps/command/stop.feature +0 -313
  206. data/features/steps/core/announce.feature +0 -283
  207. data/features/steps/environment/append_environment_variable.feature +0 -52
  208. data/features/steps/environment/disable_bunder.feature +0 -18
  209. data/features/steps/environment/home_variable.feature +0 -62
  210. data/features/steps/environment/prepend_environment_variable.feature +0 -52
  211. data/features/steps/environment/set_environment_variable.feature +0 -49
  212. data/features/steps/filesystem/append_to_file.feature +0 -45
  213. data/features/steps/filesystem/cd_to_directory.feature +0 -33
  214. data/features/steps/filesystem/check_file_content.feature +0 -61
  215. data/features/steps/filesystem/check_permissions_of_file.feature +0 -39
  216. data/features/steps/filesystem/compare_files.feature +0 -42
  217. data/features/steps/filesystem/copy.feature +0 -45
  218. data/features/steps/filesystem/create_directory.feature +0 -57
  219. data/features/steps/filesystem/create_file.feature +0 -76
  220. data/features/steps/filesystem/existence_of_directory.feature +0 -57
  221. data/features/steps/filesystem/existence_of_file.feature +0 -43
  222. data/features/steps/filesystem/file_content.feature +0 -86
  223. data/features/steps/filesystem/fixtures.feature +0 -64
  224. data/features/steps/filesystem/move.feature +0 -45
  225. data/features/steps/filesystem/non_existence_of_directory.feature +0 -69
  226. data/features/steps/filesystem/non_existence_of_file.feature +0 -80
  227. data/features/steps/filesystem/overwrite_file.feature +0 -72
  228. data/features/steps/filesystem/remove_directory.feature +0 -38
  229. data/features/steps/filesystem/remove_file.feature +0 -38
  230. data/features/steps/filesystem/use_fixture.feature +0 -77
  231. data/features/steps/overview.feature +0 -25
  232. data/features/support/aruba.rb +0 -7
  233. data/features/support/env.rb +0 -33
  234. data/features/support/jruby.rb +0 -5
  235. data/features/support/simplecov_setup.rb +0 -8
  236. data/fixtures/cli-app/bin/cli +0 -6
  237. data/fixtures/spawn_process/stderr.sh +0 -3
  238. data/lib/aruba/api/deprecated.rb +0 -1234
  239. data/lib/aruba/config.rb +0 -107
  240. data/lib/aruba/cucumber/core.rb +0 -5
  241. data/lib/aruba/cucumber/rvm.rb +0 -3
  242. data/lib/aruba/in_process.rb +0 -14
  243. data/lib/aruba/jruby.rb +0 -4
  244. data/lib/aruba/matchers/deprecated/file.rb +0 -17
  245. data/lib/aruba/matchers/deprecated.rb +0 -1
  246. data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
  247. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
  248. data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
  249. data/lib/aruba/reporting.rb +0 -126
  250. data/lib/aruba/spawn_process.rb +0 -11
  251. data/script/bootstrap +0 -28
  252. data/script/console +0 -16
  253. data/script/test +0 -3
  254. data/spec/aruba/api/bundler_spec.rb +0 -15
  255. data/spec/aruba/api/deprecated_spec.rb +0 -308
  256. data/spec/aruba/api/environment/restore_env_spec.rb +0 -86
  257. data/spec/aruba/api/environment/set_env_spec.rb +0 -46
  258. data/spec/aruba/api/filesystem/file_size_spec.rb +0 -28
  259. data/spec/aruba/api/runtime_spec.rb +0 -28
  260. data/spec/aruba/api_spec.rb +0 -981
  261. data/spec/aruba/aruba_path_spec.rb +0 -103
  262. data/spec/aruba/basic_configuration_spec.rb +0 -5
  263. data/spec/aruba/configuration_spec.rb +0 -5
  264. data/spec/aruba/hooks_spec.rb +0 -17
  265. data/spec/aruba/in_config_wrapper_spec.rb +0 -25
  266. data/spec/aruba/jruby_spec.rb +0 -55
  267. data/spec/aruba/matchers/command/have_output_size_spec.rb +0 -25
  268. data/spec/aruba/matchers/command_spec.rb +0 -174
  269. data/spec/aruba/matchers/deprecated_spec.rb +0 -120
  270. data/spec/aruba/matchers/directory_spec.rb +0 -57
  271. data/spec/aruba/matchers/file_spec.rb +0 -208
  272. data/spec/aruba/matchers/path_spec.rb +0 -58
  273. data/spec/aruba/platform/simple_table_spec.rb +0 -23
  274. data/spec/aruba/platform/windows_environment_variables_spec.rb +0 -500
  275. data/spec/aruba/platforms/unix_command_string_spec.rb +0 -17
  276. data/spec/aruba/platforms/windows_command_string_spec.rb +0 -22
  277. data/spec/aruba/rspec_spec.rb +0 -15
  278. data/spec/aruba/runtime_spec.rb +0 -29
  279. data/spec/aruba/spawn_process_spec.rb +0 -96
  280. data/spec/event_bus/name_resolver_spec.rb +0 -68
  281. data/spec/event_bus_spec.rb +0 -158
  282. data/spec/spec_helper.rb +0 -20
  283. data/spec/support/configs/.keep +0 -0
  284. data/spec/support/configs/aruba.rb +0 -5
  285. data/spec/support/configs/pry.rb +0 -3
  286. data/spec/support/configs/rspec.rb +0 -15
  287. data/spec/support/helpers/.keep +0 -0
  288. data/spec/support/helpers/reporting.rb +0 -44
  289. data/spec/support/matchers/.keep +0 -0
  290. data/spec/support/matchers/option.rb +0 -35
  291. data/spec/support/shared_contexts/.keep +0 -0
  292. data/spec/support/shared_contexts/aruba.rb +0 -49
  293. data/spec/support/shared_examples/.keep +0 -0
  294. data/spec/support/shared_examples/configuration.rb +0 -116
  295. data/spec/support/shared_examples/directory.rb +0 -7
  296. data/spec/support/shared_examples/file.rb +0 -7
  297. data/templates/css/console.css +0 -24
  298. data/templates/css/filesystem.css +0 -42
  299. data/templates/css/pygments-autumn.css +0 -59
  300. data/templates/files.erb +0 -14
  301. data/templates/images/LICENSE +0 -22
  302. data/templates/images/folder.png +0 -0
  303. data/templates/images/page_white.png +0 -0
  304. data/templates/images/page_white_gherkin.png +0 -0
  305. data/templates/images/page_white_ruby.png +0 -0
  306. data/templates/index.erb +0 -20
  307. data/templates/js/filesystem.js +0 -5
  308. data/templates/js/jquery-1.11.3.min.js +0 -5
  309. data/templates/main.erb +0 -34
@@ -1,1234 +0,0 @@
1
- require 'aruba/platforms/announcer'
2
-
3
- # Aruba
4
- module Aruba
5
- # Api
6
- module Api
7
- # Deprecated
8
- module Deprecated
9
- # @deprecated
10
- # The path to the directory which should contain all your test data
11
- # You might want to overwrite this method to place your data else where.
12
- #
13
- # @return [Array]
14
- # The directory path: Each subdirectory is a member of an array
15
- def dirs
16
- Aruba.platform.deprecated(
17
- 'The use of "dirs" is deprecated.' \
18
- ' Use "Aruba.configure { |c| c.current_directory = \'path/to/dir\' }"' \
19
- ' instead to set the current directory and "expand_path(".")" to get' \
20
- ' the current directory or use "#cd(\'.\') { # your code }" to run' \
21
- ' code in the current directory'
22
- )
23
-
24
- @dirs ||= aruba.current_directory
25
- end
26
-
27
- # @deprecated
28
- # Get access to current dir
29
- #
30
- # @return
31
- # Current directory
32
- def current_directory
33
- Aruba.platform.deprecated(
34
- 'The use of "current_directory" is deprecated.' \
35
- ' Use "expand_path(".")" to get the current directory or "#cd" to run' \
36
- ' code in the current directory.'
37
- )
38
-
39
- aruba.current_directory.to_s
40
- end
41
-
42
- # @deprecated
43
- # Clean the current directory
44
- def clean_current_directory
45
- Aruba.platform.deprecated(
46
- 'The use of "clean_current_directory" is deprecated.' \
47
- ' Either use "#setup_aruba" or "#remove(\'.\')" to clean up Aruba\'s' \
48
- ' working directory before your tests are run'
49
- )
50
-
51
- setup_aruba
52
- end
53
-
54
- # @deprecated
55
- # Execute block in current directory
56
- #
57
- # @yield
58
- # The block which should be run in current directory
59
- def in_current_directory(&block)
60
- Aruba.platform.deprecated(
61
- 'The use of "in_current_directory" is deprecated.' \
62
- ' Use "#cd(\'.\') { # your code }" instead. But be aware,' \
63
- ' "cd" requires a previously created directory'
64
- )
65
-
66
- create_directory '.' unless directory?('.')
67
- cd('.', &block)
68
- end
69
-
70
- # @deprecated
71
- def detect_ruby(cmd)
72
- Aruba.platform.deprecated('The use of "#detect_ruby" is deprecated')
73
-
74
- Aruba.platform.detect_ruby cmd
75
- end
76
-
77
- # @deprecated
78
- def current_ruby
79
- Aruba.platform.deprecated('The use of "#current_ruby" is deprecated')
80
-
81
- Aruba.platform.current_ruby cmd
82
- end
83
-
84
- # @deprecated
85
- def _ensure_newline(str)
86
- Aruba.platform.deprecated('The use of "#_ensure_newline" is deprecated')
87
-
88
- Aruba.platform.ensure_newline cmd
89
- end
90
-
91
- # @deprecated
92
- def absolute_path(*args)
93
- Aruba.platform.deprecated(
94
- 'The use of "absolute_path" is deprecated.' \
95
- ' Use "expand_path" instead.' \
96
- ' But be aware that "expand_path" uses a different implementation'
97
- )
98
-
99
- File.expand_path File.join(*args), aruba.current_directory
100
- end
101
-
102
- # @deprecated
103
- def _read_interactive
104
- Aruba.platform.deprecated(
105
- 'The use of "#_read_interactive" is deprecated.' \
106
- ' Use "last_command_started.stdout" instead'
107
- )
108
-
109
- last_command_started.stdout
110
- end
111
-
112
- # @deprecated
113
- def announce_or_puts(msg)
114
- Aruba.platform.deprecated(
115
- 'The use of "#announce_or_puts" is deprecated.' \
116
- ' Use "#announcer.mode = :kernel" or "#announcer.mode = :puts" instead'
117
- )
118
-
119
- if(@puts)
120
- Kernel.puts(msg)
121
- else
122
- puts(msg)
123
- end
124
- end
125
-
126
- # @deprecated
127
- def _write_interactive(input)
128
- Aruba.platform.deprecated(
129
- 'The use of "#_write_interactive" is deprecated.' \
130
- ' Use "#last_command_started.write()" instead'
131
- )
132
-
133
- last_command_started.write(input)
134
- end
135
-
136
- # @deprecated
137
- def eot
138
- Aruba.platform.deprecated(
139
- 'The use of "#eot" is deprecated.' \
140
- ' Use "#close_input" instead.'
141
- )
142
-
143
- close_input
144
- end
145
-
146
- # Run a command interactively
147
- #
148
- # @param [String] cmd
149
- # The command to by run
150
- #
151
- # @see #cmd
152
- # @deprecated
153
- def run_interactive(cmd)
154
- Aruba.platform.deprecated(
155
- 'The use of "#run_interactive" is deprecated.' \
156
- ' Use "run_command" instead'
157
- )
158
-
159
- run_command(cmd)
160
- end
161
-
162
- # Run given command and stop it if timeout is reached
163
- #
164
- # @param [String] cmd
165
- # The command which should be executed
166
- #
167
- # @param [Hash] opts
168
- # Options
169
- #
170
- # @option [Integer] exit_timeout
171
- # If the timeout is reached the command will be killed
172
- #
173
- # @option [Integer] io_wait_timeout
174
- # Wait for IO to finish
175
- #
176
- # @option [Integer] startup_wait_time
177
- # Wait for a command to start
178
- #
179
- # @option [String] stop_signal
180
- # Use signal to stop command
181
- #
182
- # @yield [SpawnProcess]
183
- # Run block with process
184
- #
185
- # @see #run_command
186
- # @deprecated
187
- def run(*args)
188
- Aruba.platform.deprecated(
189
- 'The use of "#run" is deprecated.' \
190
- ' Use "run_command" instead'
191
- )
192
-
193
- run_command(*args)
194
- end
195
-
196
- # Run a command with aruba
197
- #
198
- # Checks for error during command execution and checks the output to detect
199
- # an timeout error.
200
- #
201
- # @param [String] cmd
202
- # The command to be executed
203
- #
204
- # @param [Hash] options
205
- # Options for aruba
206
- #
207
- # @option [TrueClass,FalseClass] fail_on_error
208
- # Should aruba fail on error?
209
- #
210
- # @option [Integer] exit_timeout
211
- # Timeout for execution
212
- #
213
- # @option [Integer] io_wait_timeout
214
- # Timeout for IO - STDERR, STDOUT
215
- #
216
- def run_simple(*args)
217
- Aruba.platform.deprecated(
218
- 'The use of "#run_simple" is deprecated.' \
219
- ' Use "run_command_and_stop" instead'
220
- )
221
-
222
- run_command_and_stop(*args)
223
- end
224
-
225
- # @deprecated
226
- # Create an empty file
227
- #
228
- # @param [String] file_name
229
- # The name of the file
230
- def touch_file(*args)
231
- Aruba.platform.deprecated(
232
- 'The use of "#touch_file" is deprecated.' \
233
- ' Use "#touch" instead'
234
- )
235
-
236
- touch(*args)
237
- end
238
-
239
- # @deprecated
240
- def mod?(file, perms, &block)
241
- Aruba.platform.deprecated(
242
- 'The use of "#mod?" is deprecated.' \
243
- ' Use "expect(file).to have_permissions(perms)" instead'
244
- )
245
-
246
- expect(Array(file)).to Aruba::Matchers.all have_permissions(perms)
247
- end
248
-
249
- # @deprecated
250
- # Remove file
251
- #
252
- # @param [String] file_name
253
- # The file which should be deleted in current directory
254
- def remove_file(*args)
255
- Aruba.platform.deprecated(
256
- 'The use of "#remove_file" is deprecated.' \
257
- ' Use "#remove" instead'
258
- )
259
-
260
- remove(*args)
261
- end
262
-
263
- # @deprecated
264
- def create_dir(*args)
265
- Aruba.platform.deprecated(
266
- 'The use of "#create_dir" is deprecated.' \
267
- ' Use "#create_directory" instead'
268
- )
269
- create_directory(*args)
270
- end
271
-
272
- # @deprecated
273
- # Remove directory
274
- #
275
- # @param [String] directory_name
276
- # The name of the directory which should be removed
277
- def remove_directory(*args)
278
- Aruba.platform.deprecated(
279
- 'The use of "remove_directory" is deprecated.' \
280
- ' Use "remove" instead'
281
- )
282
- remove(*args)
283
- end
284
-
285
- # @deprecated
286
- def remove_dir(*args)
287
- Aruba.platform.deprecated(
288
- 'The use of "remove_dir" is deprecated.' \
289
- ' Use "remove" instead'
290
- )
291
- remove(*args)
292
- end
293
-
294
- # @deprecated
295
- #
296
- # Check if paths are present
297
- #
298
- # @param [#each] paths
299
- # The paths which should be checked
300
- #
301
- # @param [true,false] expect_presence
302
- # Should the given paths be present (true) or absent (false)
303
- def check_file_presence(paths, expect_presence = true)
304
- Aruba.platform.deprecated(
305
- 'The use of "check_file_presence" is deprecated.' \
306
- ' Use "expect(path).to be_an_existing_file" or' \
307
- ' "expect(all_paths).to all match /pattern/" instead'
308
- )
309
-
310
- stop_all_commands
311
-
312
- Array(paths).each do |path|
313
- if path.kind_of? Regexp
314
- if expect_presence
315
- expect(all_paths).to match_path_pattern(path)
316
- else
317
- expect(all_paths).not_to match_path_pattern(path)
318
- end
319
- else
320
- if expect_presence
321
- expect(path).to be_an_existing_file
322
- else
323
- expect(path).not_to be_an_existing_file
324
- end
325
- end
326
- end
327
- end
328
-
329
- # @deprecated
330
- # Check the file size of paths
331
- #
332
- # @params [Hash] paths_and_sizes
333
- # A hash containing the path (key) and the expected size (value)
334
- #
335
- # @example
336
- #
337
- # paths_and_sizes = {
338
- # 'file' => 10
339
- # }
340
- #
341
- # check_file_size(paths_and_sizes)
342
- #
343
- def check_file_size(paths_and_sizes)
344
- Aruba.platform.deprecated(
345
- 'The use of "#check_file_size" is deprecated.' \
346
- ' Use "expect(file).to have_file_size(size)" instead'
347
- )
348
-
349
- stop_all_commands
350
-
351
- paths_and_sizes.each do |path, size|
352
- expect(path).to have_file_size size
353
- end
354
- end
355
-
356
- # @deprecated
357
- def check_exact_file_content(file, exact_content, expect_match = true)
358
- Aruba.platform.deprecated(
359
- 'The use of "#check_exact_file_content" is deprecated.' \
360
- ' Use "expect(file).to have_file_content(content)" with a string'
361
- )
362
-
363
- check_file_content(file, exact_content, expect_match)
364
- end
365
-
366
- # @deprecated
367
- # Check if the content of file against the content of a reference file
368
- #
369
- # @param [String] file
370
- # The file to be checked
371
- #
372
- # @param [String] reference_file
373
- # The reference file
374
- #
375
- # @param [true, false] expect_match
376
- # Must the content be in the file or not
377
- def check_binary_file_content(file, reference_file, expect_match = true)
378
- Aruba.platform.deprecated(
379
- 'The use of "#check_binary_file_content" is deprecated.' \
380
- ' Use "expect(file).to have_same_file_content_as(file)"'
381
- )
382
-
383
- stop_all_commands
384
-
385
- if expect_match
386
- expect(file).to have_same_file_content_as reference_file
387
- else
388
- expect(file).not_to have_same_file_content_as reference_file
389
- end
390
- end
391
-
392
- # @deprecated
393
- # Check presence of a directory
394
- #
395
- # @param [Array] paths
396
- # The paths to be checked
397
- #
398
- # @param [true, false] expect_presence
399
- # Should the directory be there or should the directory not be there
400
- def check_directory_presence(paths, expect_presence)
401
- Aruba.platform.deprecated(
402
- 'The use of "#check_directory_presence" is deprecated.' \
403
- ' Use "expect(directory).to be_an_existing_directory"'
404
- )
405
-
406
- stop_all_commands
407
-
408
- paths.each do |path|
409
- path = expand_path(path)
410
-
411
- if expect_presence
412
- expect(path).to be_an_existing_directory
413
- else
414
- expect(path).not_to be_an_existing_directory
415
- end
416
- end
417
- end
418
-
419
- # @deprecated
420
- def prep_for_fs_check(&block)
421
- Aruba.platform.deprecated(
422
- 'The use of "prep_for_fs_check" is deprecated.' \
423
- ' Use apropriate methods and the new rspec matchers instead'
424
- )
425
-
426
- stop_all_commands
427
-
428
- cd('') { yield }
429
- end
430
-
431
- # @deprecated
432
- def assert_exit_status_and_partial_output(expect_to_pass, expected)
433
- Aruba.platform.deprecated(
434
- 'The use of "assert_exit_status_and_partial_output" is deprecated.' \
435
- ' Use "expect(last_command_started).to be_successfully_executed"' \
436
- ' and "expect(command).to have_output /partial/" instead.'
437
- )
438
-
439
- assert_success(expect_to_pass)
440
- assert_partial_output(expected, all_output)
441
- end
442
-
443
- # @deprecated
444
- def assert_exit_status_and_output(expect_to_pass, expected_output,
445
- expect_exact_output)
446
- assert_success(expect_to_pass)
447
- if expect_exact_output
448
- assert_exact_output(expected_output, all_output)
449
- else
450
- assert_partial_output(expected_output, all_output)
451
- end
452
- end
453
-
454
- # Check the content of file
455
- #
456
- # It supports partial content as well. And it is up to you to decided if
457
- # the content must be there or not.
458
- #
459
- # @param [String] file
460
- # The file to be checked
461
- #
462
- # @param [String, Regexp] content
463
- # The content which must/must not be in the file. If content is
464
- # a String exact match is done, if content is a Regexp then file
465
- # is matched using regular expression
466
- #
467
- # @param [true, false] expect_match
468
- # Must the content be in the file or not
469
- def check_file_content(file, content, expect_match = true)
470
- Aruba.platform.deprecated(
471
- 'The use of "#check_file_content" is deprecated.' \
472
- ' Use "expect(file).to have_file_content(content)" instead.' \
473
- ' For eq match use string, for partial match use /regex/'
474
- )
475
-
476
- stop_all_commands
477
-
478
- if expect_match
479
- expect(file).to have_file_content content
480
- else
481
- expect(file).not_to have_file_content content
482
- end
483
- end
484
-
485
- # @deprecated
486
- def _mkdir(dir_name)
487
- Aruba.platform.deprecated(
488
- 'The use of "#_mkdir" is deprecated'
489
- )
490
-
491
- Aruba.platform.mkdir(dir_name)
492
- end
493
-
494
- # @deprecated
495
- def _rm(dir_name)
496
- Aruba.platform.deprecated(
497
- 'The use of "#_rm_rf" is deprecated'
498
- )
499
-
500
- Aruba.platform.rm(dir_name)
501
- end
502
-
503
- # @deprecated
504
- def current_dir(*args, &block)
505
- Aruba.platform.deprecated(
506
- 'The use of "#current_dir" is deprecated.' \
507
- ' Use "#current_directory" instead'
508
- )
509
-
510
- current_directory(*args, &block)
511
- end
512
-
513
- # @deprecated
514
- def clean_current_dir(*args, &block)
515
- Aruba.platform.deprecated(
516
- 'The use of "clean_current_dir" is deprecated.' \
517
- ' Use "#setup_aruba" or `#remove(\'.\') to clean up Aruba\'s working' \
518
- ' directory before your tests are run'
519
- )
520
-
521
- setup_aruba
522
- end
523
-
524
- # @deprecated
525
- def in_current_dir(&block)
526
- Aruba.platform.deprecated(
527
- 'The use of "in_current_dir" is deprecated.' \
528
- ' Use "#cd(\'.\') { }" instead'
529
- )
530
-
531
- create_directory '.' unless directory?('.')
532
- cd('.', &block)
533
- end
534
-
535
- # @deprecated
536
- # Run block with environment
537
- #
538
- # @param [Hash] env
539
- # The variables to be used for block.
540
- #
541
- # @yield
542
- # The block of code which should be run with the changed environment variables
543
- def with_env(env = {}, &block)
544
- Aruba.platform.deprecated(
545
- 'The use of "#with_env" is deprecated.' \
546
- ' Use "#with_environment {}" instead. But be careful this uses a' \
547
- ' different implementation'
548
- )
549
-
550
- env.each do |k,v|
551
- set_env k, v
552
- end
553
- yield
554
- restore_env
555
- end
556
-
557
- # @deprecated
558
- # Restore original process environment
559
- def restore_env
560
- Aruba.platform.deprecated(
561
- 'The use of "#restore_env" is deprecated.' \
562
- ' If you use "set_environment_variable" there\'s no need to restore' \
563
- ' the environment'
564
- )
565
-
566
- original_env.each do |key, value|
567
- if value
568
- ENV[key] = value
569
- aruba.environment[key] = value
570
- else
571
- aruba.environment.delete key
572
- ENV.delete key
573
- end
574
- end
575
- end
576
-
577
- # @deprecated
578
- # Set environment variable
579
- #
580
- # @param [String] key
581
- # The name of the environment variable as string, e.g. 'HOME'
582
- #
583
- # @param [String] value
584
- # The value of the environment variable. Needs to be a string.
585
- def set_env(key, value)
586
- Aruba.platform.deprecated(
587
- 'The use of "#set_env" is deprecated.' \
588
- ' Use "set_environment_variable" instead. ' \
589
- ' But be careful, this method uses a different kind of implementation'
590
- )
591
-
592
- aruba.announcer.announce(:environment, key, value)
593
- set_environment_variable key, value
594
-
595
- original_env[key] = ENV.delete(key) unless original_env.key? key
596
- ENV[key] = value
597
- end
598
-
599
- # @deprecated
600
- def original_env
601
- Aruba.platform.deprecated(
602
- 'The use of "#original_env" is deprecated'
603
- )
604
-
605
- @original_env ||= {}
606
- end
607
-
608
- # @deprecated
609
- def filesystem_permissions(*args)
610
- Aruba.platform.deprecated(
611
- 'The use of "#filesystem_permissions" is deprecated.' \
612
- ' Use "#chmod" instead'
613
- )
614
-
615
- chmod(*args)
616
- end
617
-
618
- # Check file system permissions of file
619
- #
620
- # @param [Octal] expected_permissions
621
- # Expected file system permissions, e.g. 0755
622
- # @param [String] file_names
623
- # The file name(s)
624
- # @param [Boolean] expected_result
625
- # Are the permissions expected to be mode or are they expected not to be mode?
626
- def check_filesystem_permissions(*args)
627
- Aruba.platform.deprecated(
628
- 'The use of "#check_filesystem_permissions" is deprecated.' \
629
- ' Use "expect(path).to have_permissions perms" instead'
630
- )
631
-
632
- args = args.flatten
633
-
634
- expected_permissions = args.shift
635
- expected_result = args.pop
636
-
637
- args.each do |p|
638
- raise "Expected #{p} to be present" unless exist? p
639
-
640
- if expected_result
641
- expect(p).to have_permissions expected_permissions
642
- else
643
- expect(p).not_to have_permissions expected_permissions
644
- end
645
- end
646
- end
647
-
648
- # @deprecated
649
- def _create_file(name, content, check_presence)
650
- Aruba.platform.deprecated(
651
- 'The use of "#_create_file" is deprecated.'
652
- )
653
-
654
- ArubaFileCreator.new.write(expand_path(name), content, check_presence)
655
-
656
- self
657
- end
658
-
659
- # @deprecated
660
- def _create_fixed_size_file(file_name, file_size, check_presence)
661
- Aruba.platform.deprecated(
662
- 'The use of "#_create_fixed_size_file" is deprecated.'
663
- )
664
-
665
- ArubaFixedSizeFileCreator.new.write(expand_path(name), size, check_presence)
666
-
667
- self
668
- end
669
-
670
- # @deprecated
671
- # Unescape string
672
- #
673
- # @param [String] string
674
- # The string which should be unescaped, e.g. the output of a command
675
- #
676
- # @return
677
- # The string stripped from escape sequences
678
- def unescape(string, keep_ansi = false)
679
- Aruba.platform.deprecated(
680
- 'The use of "#unescape" is deprecated.' \
681
- ' Use "#sanitize_text" intead'
682
- )
683
-
684
- string = unescape_text(string)
685
- if !keep_ansi ||
686
- !aruba.config.keep_ansi ||
687
- aruba.config.remove_ansi_escape_sequences
688
- string = extract_text(string)
689
- end
690
-
691
- string
692
- end
693
-
694
- # @deprecated
695
- # The root directory of aruba
696
- def root_directory
697
- Aruba.platform.deprecated(
698
- 'The use of "#root_directory" is deprecated.' \
699
- ' Use "aruba.root_directory" instead'
700
- )
701
-
702
- aruba.root_directory
703
- end
704
-
705
- # The path to the directory which contains fixtures
706
- # You might want to overwrite this method to place your data else where.
707
- #
708
- # @return [String]
709
- # The directory to where your fixtures are stored
710
- def fixtures_directory
711
- Aruba.platform.deprecated(
712
- 'The use of "#fixtures_directory" is deprecated.' \
713
- ' Use "aruba.fixtures_directory" instead'
714
- )
715
-
716
- aruba.fixtures_directory
717
- end
718
-
719
- # @deprecated
720
- def check_for_deprecated_variables
721
- if defined? @aruba_exit_timeout
722
- Aruba.platform.deprecated(
723
- 'The use of "@aruba_exit_timeout" is deprecated.' \
724
- ' Use "#aruba.config.exit_timeout = <numeric>" instead'
725
- )
726
- aruba.config.exit_timeout = @aruba_exit_timeout
727
- end
728
-
729
- if defined? @aruba_io_wait_seconds
730
- Aruba.platform.deprecated(
731
- 'The use of "@aruba_io_wait_seconds" is deprecated.' \
732
- ' Use "#aruba.config.io_wait_timeout = <numeric>" instead'
733
- )
734
- aruba.config.io_wait_timeout = @aruba_io_wait_seconds
735
- end
736
-
737
- if defined? @keep_ansi
738
- Aruba.platform.deprecated(
739
- 'The use of "@aruba_keep_ansi" is deprecated.' \
740
- ' Use "#aruba.config.remove_ansi_escape_sequences = <true|false>" instead.' \
741
- ' Be aware that it uses an inverted logic'
742
- )
743
-
744
- aruba.config.remove_ansi_escape_sequences = false
745
- end
746
-
747
- if defined? @aruba_root_directory
748
- Aruba.platform.deprecated(
749
- 'The use of "@aruba_root_directory" is deprecated.' \
750
- ' Use "#aruba.config.root_directory = <string>" instead'
751
- )
752
-
753
- aruba.config.root_directory = @aruba_root_directory.to_s
754
- end
755
- end
756
-
757
- # Last command started
758
- def last_command
759
- Aruba.platform.deprecated(
760
- 'The use of "#last_command" is deprecated.' \
761
- ' Use "#last_command_started"'
762
- )
763
-
764
- process_monitor.last_command_started
765
- end
766
-
767
- # @deprecated
768
- #
769
- # Full compare arg1 and arg2
770
- #
771
- # @return [TrueClass, FalseClass]
772
- # If arg1 is exactly the same as arg2 return true, otherwise false
773
- def assert_exact_output(expected, actual)
774
- Aruba.platform.deprecated(
775
- 'The use of "#assert_exact_output" is deprecated.' \
776
- ' Use "expect(command).to have_output \'exact\'" instead.' \
777
- ' There are also special matchers for "stdout" and "stderr"'
778
- )
779
-
780
- actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
781
- expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).
782
- to eq Aruba.platform.unescape(expected, aruba.config.keep_ansi)
783
- end
784
-
785
- # @deprecated
786
- #
787
- # Partial compare arg1 and arg2
788
- #
789
- # @return [TrueClass, FalseClass]
790
- # If arg2 contains arg1 return true, otherwise false
791
- def assert_partial_output(expected, actual)
792
- Aruba.platform.deprecated(
793
- 'The use of "#assert_partial_output" is deprecated.' \
794
- ' Use "expect(command).to have_output /partial/" instead.' \
795
- ' There are also special matchers for "stdout" and "stderr"'
796
- )
797
-
798
- actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
799
- expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).
800
- to include(Aruba.platform.unescape(expected, aruba.config.keep_ansi))
801
- end
802
-
803
- # @deprecated
804
- #
805
- # Regex Compare arg1 and arg2
806
- #
807
- # @return [TrueClass, FalseClass]
808
- # If arg2 matches arg1 return true, otherwise false
809
- def assert_matching_output(expected, actual)
810
- Aruba.platform.deprecated(
811
- 'The use of "#assert_matching_output" is deprecated.' \
812
- ' Use "expect(command).to have_output /partial/" instead.' \
813
- ' There are also special matchers for "stdout" and "stderr"'
814
- )
815
-
816
- actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
817
- expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).
818
- to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
819
- end
820
-
821
- # @deprecated
822
- #
823
- # Negative regex compare arg1 and arg2
824
- #
825
- # @return [TrueClass, FalseClass]
826
- # If arg2 does not match arg1 return true, otherwise false
827
- def assert_not_matching_output(expected, actual)
828
- Aruba.platform.deprecated(
829
- 'The use of "#assert_not_matching_output" is deprecated.' \
830
- ' Use "expect(command).not_to have_output /partial/" instead.' \
831
- ' There are also special matchers for "stdout" and "stderr"'
832
- )
833
-
834
- actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9"
835
- expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).
836
- not_to match(/#{Aruba.platform.unescape(expected, aruba.config.keep_ansi)}/m)
837
- end
838
-
839
- # @deprecated
840
- #
841
- # Negative partial compare arg1 and arg2
842
- #
843
- # @return [TrueClass, FalseClass]
844
- # If arg2 does not match/include arg1 return true, otherwise false
845
- def assert_no_partial_output(unexpected, actual)
846
- Aruba.platform.deprecated(
847
- 'The use of "#assert_no_partial_output" is deprecated.' \
848
- ' Use "expect(command).not_to have_output /partial/" instead.' \
849
- ' There are also special matchers for "stdout" and "stderr"'
850
- )
851
-
852
- actual.force_encoding(unexpected.encoding) if RUBY_VERSION >= "1.9"
853
- if Regexp === unexpected
854
- expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).
855
- not_to match unexpected
856
- else
857
- expect(Aruba.platform.unescape(actual, aruba.config.keep_ansi)).
858
- not_to include(unexpected)
859
- end
860
- end
861
-
862
- # @deprecated
863
- #
864
- # Partial compare output of interactive command and arg1
865
- #
866
- # @return [TrueClass, FalseClass]
867
- # If output of interactive command includes arg1 return true, otherwise false
868
- def assert_partial_output_interactive(expected)
869
- Aruba.platform.deprecated(
870
- 'The use of "#assert_partial_output_interactive" is deprecated.' \
871
- ' Use "expect(last_command_started).to have_output /partial/" instead.' \
872
- ' There are also special matchers for "stdout" and "stderr"'
873
- )
874
-
875
- Aruba.platform.unescape(last_command_started.stdout, aruba.config.keep_ansi).
876
- include?(Aruba.platform.unescape(expected, aruba.config.keep_ansi))
877
- end
878
-
879
- # @deprecated
880
- #
881
- # Check if command succeeded and if arg1 is included in output
882
- #
883
- # @return [TrueClass, FalseClass]
884
- # If exit status is 0 and arg1 is included in output return true, otherwise false
885
- def assert_passing_with(expected)
886
- Aruba.platform.deprecated(
887
- 'The use of "#assert_passing_with" is deprecated.' \
888
- ' Use "expect(last_command_started).to be_successfully_executed"' \
889
- ' and expect(last_command_started).to have_output(/partial/)"' \
890
- ' or something similar instead.' \
891
- ' There are also special matchers for "stdout" and "stderr"'
892
- )
893
-
894
- assert_success(true)
895
- assert_partial_output(expected, all_output)
896
- end
897
-
898
- # @deprecated
899
- #
900
- # Check if command failed and if arg1 is included in output
901
- #
902
- # @return [TrueClass, FalseClass]
903
- # If exit status is not equal 0 and arg1 is included in output return
904
- # true, otherwise false
905
- def assert_failing_with(expected)
906
- Aruba.platform.deprecated(
907
- 'The use of "#assert_passing_with" is deprecated.' \
908
- ' Use "expect(last_command_started).not_to be_successfully_executed"' \
909
- ' and "expect(last_command_started).to have_output(/partial/)"' \
910
- ' or something similar instead.' \
911
- ' There are also special matchers for "stdout" and "stderr"'
912
- )
913
-
914
- assert_success(false)
915
- assert_partial_output(expected, all_output)
916
- end
917
-
918
- # @deprecated
919
- #
920
- # Check exit status of process
921
- #
922
- # @return [TrueClass, FalseClass]
923
- # If arg1 is true, return true if command was successful
924
- # If arg1 is false, return true if command failed
925
- def assert_success(success)
926
- Aruba.platform.deprecated(
927
- 'The use of "#assert_success" is deprecated.' \
928
- ' Use "expect(last_command_started).to be_successfully_executed" or' \
929
- ' with "not_to" or the negative form "have_failed_running"' \
930
- ' (requires rspec >= 3.1)'
931
- )
932
-
933
- if success
934
- expect(last_command_started).to be_successfully_executed
935
- else
936
- expect(last_command_started).not_to be_successfully_executed
937
- end
938
- end
939
-
940
- # @deprecated
941
- def assert_exit_status(status)
942
- Aruba.platform.deprecated(
943
- 'The use of "#assert_exit_status" is deprecated.' \
944
- ' Use "expect(last_command_started).to have_exit_status(status)"'
945
- )
946
-
947
- expect(last_command_started).to have_exit_status(status)
948
- end
949
-
950
- # @deprecated
951
- def assert_not_exit_status(status)
952
- Aruba.platform.deprecated(
953
- 'The use of "#assert_not_exit_status" is deprecated.' \
954
- ' Use "expect(last_command_started).not_to have_exit_status(status)"'
955
- )
956
-
957
- expect(last_exit_status).not_to eq(status),
958
- append_output_to("Exit status was #{last_exit_status} which was not expected.")
959
- end
960
-
961
- # @deprecated
962
- def append_output_to(message)
963
- Aruba.platform.deprecated(
964
- 'The use of "#append_output_to" is deprecated'
965
- )
966
-
967
- "#{message} Output:\n\n#{all_output}\n"
968
- end
969
-
970
- # @deprecated
971
- def register_process(*args)
972
- Aruba.platform.deprecated('The use of "#register_process" is deprecated')
973
-
974
- process_monitor.register_process(*args)
975
- end
976
-
977
- # @deprecated
978
- def get_process(wanted)
979
- Aruba.platform.deprecated('The use of "#get_process" is deprecated')
980
-
981
- process_monitor.get_process(wanted)
982
- end
983
-
984
- # @deprecated
985
- #
986
- # Fetch output (stdout, stderr) from command
987
- #
988
- # @param [String] cmd
989
- # The command
990
- def output_from(cmd)
991
- Aruba.platform.deprecated('The use of "#output_from" is deprecated')
992
-
993
- process_monitor.output_from(cmd)
994
- end
995
-
996
- # @deprecated
997
- #
998
- # Fetch stdout from command
999
- #
1000
- # @param [String] cmd
1001
- # The command
1002
- def stdout_from(cmd)
1003
- Aruba.platform.deprecated('The use of "#stdout_from" is deprecated')
1004
-
1005
- process_monitor.stdout_from(cmd)
1006
- end
1007
-
1008
- # @deprecated
1009
- #
1010
- # Fetch stderr from command
1011
- #
1012
- # @param [String] cmd
1013
- # The command
1014
- def stderr_from(cmd)
1015
- Aruba.platform.deprecated('The use of "#stderr_from" is deprecated')
1016
-
1017
- process_monitor.stderr_from(cmd)
1018
- end
1019
-
1020
- # @deprecated
1021
- #
1022
- # Get stdout of all processes
1023
- #
1024
- # @return [String]
1025
- # The stdout of all process which have run before
1026
- def all_stdout
1027
- Aruba.platform.deprecated(
1028
- 'The use of "#all_stdout" is deprecated.' \
1029
- ' Use `all_commands.map { |c| c.stdout }.join("\n") instead.' \
1030
- ' If you need to check for some output, use' \
1031
- ' "expect(all_commands).to included_an_object have_output_on_stdout(/output/)"' \
1032
- ' instead'
1033
- )
1034
-
1035
- process_monitor.all_stdout
1036
- end
1037
-
1038
- # @deprecated
1039
- #
1040
- # Get stderr of all processes
1041
- #
1042
- # @return [String]
1043
- # The stderr of all process which have run before
1044
- def all_stderr
1045
- Aruba.platform.deprecated(
1046
- 'The use of "#all_stderr" is deprecated.' \
1047
- ' Use `all_commands.map { |c| c.stderr }.join("\n") instead.' \
1048
- ' If you need to check for some output use' \
1049
- ' "expect(all_commands).to included_an_object have_output_on_stderr /output/"' \
1050
- ' instead'
1051
- )
1052
-
1053
- process_monitor.all_stderr
1054
- end
1055
-
1056
- # @deprecated
1057
- #
1058
- # Get stderr and stdout of all processes
1059
- #
1060
- # @return [String]
1061
- # The stderr and stdout of all process which have run before
1062
- def all_output
1063
- Aruba.platform.deprecated(
1064
- 'The use of "#all_output" is deprecated.' \
1065
- ' Use `all_commands.map { |c| c.output }.join("\n") instead.' \
1066
- ' If you need to check for some output use' \
1067
- ' "expect(all_commands).to included_an_object have_output /output/"' \
1068
- ' instead'
1069
- )
1070
-
1071
- process_monitor.all_output
1072
- end
1073
-
1074
- # @deprecated
1075
- #
1076
- # Default exit timeout for running commands with aruba
1077
- #
1078
- # Overwrite this method if you want a different timeout or set
1079
- # `@aruba_timeout_seconds`.
1080
- def exit_timeout
1081
- Aruba.platform.deprecated(
1082
- 'The use of "#exit_timeout" is deprecated.' \
1083
- ' Use "aruba.config.exit_timeout" instead.'
1084
- )
1085
-
1086
- aruba.config.exit_timeout
1087
- end
1088
-
1089
- # @deprecated
1090
- #
1091
- # Default io wait timeout
1092
- #
1093
- # Overwrite this method if you want a different timeout or set
1094
- # `@aruba_io_wait_seconds
1095
- def io_wait
1096
- Aruba.platform.deprecated(
1097
- 'The use of "#io_wait" is deprecated.' \
1098
- ' Use "aruba.config.io_wait_timeout" instead'
1099
- )
1100
-
1101
- aruba.config.io_wait_timeout
1102
- end
1103
-
1104
- # @deprecated
1105
- # Only processes
1106
- def only_processes
1107
- Aruba.platform.deprecated(
1108
- 'The use of "#only_processes" is deprecated.' \
1109
- ' Use "#all_commands" instead'
1110
- )
1111
-
1112
- process_monitor.only_processes
1113
- end
1114
-
1115
- # @deprecated
1116
- def last_exit_status
1117
- Aruba.platform.deprecated(
1118
- 'The use of "#last_exit_status" is deprecated.' \
1119
- ' Use "#last_command_(started|stopped).exit_status" instead'
1120
- )
1121
-
1122
- process_monitor.last_exit_status
1123
- end
1124
-
1125
- # @deprecated
1126
- def stop_process(process)
1127
- Aruba.platform.deprecated(
1128
- 'The use of "#stop_process" is deprecated.' \
1129
- ' Use "#last_command_(started|stopped).stop" instead'
1130
- )
1131
-
1132
- @last_exit_status = process_monitor.stop_process(process)
1133
- end
1134
-
1135
- # @deprecated
1136
- def terminate_process(process)
1137
- Aruba.platform.deprecated(
1138
- 'The use of "#terminate_process" is deprecated.' \
1139
- ' Use "#last_command_(started|stopped).terminate" instead'
1140
- )
1141
-
1142
- process_monitor.terminate_process(process)
1143
- end
1144
-
1145
- # @deprecated
1146
- def stop_processes!
1147
- Aruba.platform.deprecated(
1148
- 'The use of "#stop_processes!" is deprecated.' \
1149
- ' Use "#stop_all_commands" instead'
1150
- )
1151
-
1152
- stop_all_commands
1153
- end
1154
-
1155
- # @deprecated
1156
- #
1157
- # Terminate all running processes
1158
- def terminate_processes!
1159
- Aruba.platform.deprecated(
1160
- 'The use of "#stop_processes!" is deprecated.' \
1161
- ' Use "all_commands.each(&:terminate)" instead'
1162
- )
1163
-
1164
- all_commands.each(&:terminate)
1165
- end
1166
-
1167
- # @deprecated
1168
- #
1169
- # Access to announcer
1170
- def announcer
1171
- Aruba.platform.deprecated(
1172
- 'The use of "#announcer" is deprecated.' \
1173
- ' Use "aruba.announcer" instead'
1174
- )
1175
-
1176
- @announcer ||= Platforms::Announcer.new(
1177
- self,
1178
- :stdout => defined?(@announce_stdout),
1179
- :stderr => defined?(@announce_stderr),
1180
- :dir => defined?(@announce_dir),
1181
- :cmd => defined?(@announce_cmd),
1182
- :env => defined?(@announce_env)
1183
- )
1184
-
1185
- @announcer
1186
- end
1187
-
1188
- # @deprecated
1189
- # Use a clean rvm gemset
1190
- #
1191
- # Please make sure that you've got [rvm](http://rvm.io/) installed.
1192
- #
1193
- # @param [String] gemset
1194
- # The name of the gemset to be used
1195
- def use_clean_gemset(gemset)
1196
- Aruba.platform.deprecated('The use of "#use_clean_gemset" is deprecated.')
1197
- run_simple(%{rvm gemset create "#{gemset}"}, true)
1198
- if all_stdout =~ /'#{gemset}' gemset created \((.*)\)\./
1199
- gem_home = Regexp.last_match[1]
1200
- set_environment_variable('GEM_HOME', gem_home)
1201
- set_environment_variable('GEM_PATH', gem_home)
1202
- set_environment_variable('BUNDLE_PATH', gem_home)
1203
-
1204
- paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
1205
- paths.unshift(File.join(gem_home, 'bin'))
1206
- set_environment_variable('PATH', paths.uniq.join(File::PATH_SEPARATOR))
1207
-
1208
- run_simple("gem install bundler", true)
1209
- else
1210
- raise "I didn't understand rvm's output: #{all_stdout}"
1211
- end
1212
- end
1213
-
1214
- # @private
1215
- # @deprecated
1216
- def process_monitor
1217
- Aruba.platform.deprecated('The use of "#process_monitor" is deprecated.')
1218
-
1219
- aruba.command_monitor
1220
- end
1221
-
1222
- # @private
1223
- # @deprecated
1224
- def processes
1225
- Aruba.platform.deprecated(
1226
- 'The use of "#process_monitor" is deprecated.' \
1227
- ' Use "#all_commands" instead.'
1228
- )
1229
-
1230
- aruba.command_monitor.send(:processes)
1231
- end
1232
- end
1233
- end
1234
- end