aruba 0.7.4 → 0.8.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.nav +12 -0
- data/.rspec +1 -0
- data/.rubocop.yml +12 -0
- data/.simplecov +2 -0
- data/.travis.yml +5 -6
- data/Gemfile +53 -26
- data/History.md +17 -0
- data/LICENSE +1 -1
- data/README.md +45 -19
- data/Rakefile +12 -2
- data/TODO.md +3 -0
- data/aruba.gemspec +19 -8
- data/cucumber.yml +1 -1
- data/features/api/cd.feature +119 -0
- data/features/api/command/run.feature +37 -0
- data/features/api/command/which.feature +37 -0
- data/features/api/environment/append_environment_variable.feature +118 -0
- data/features/api/environment/prepend_environment_variable.feature +118 -0
- data/features/api/environment/set_environment_variable.feature +252 -0
- data/features/configuration/exit_timeout.feature +51 -0
- data/features/configuration/fixtures_directories.feature +31 -0
- data/features/configuration/fixtures_path_prefix.feature +24 -0
- data/features/configuration/io_timeout.feature +31 -0
- data/features/configuration/keep_ansi.feature +31 -0
- data/features/configuration/root_directory.feature +31 -0
- data/features/configuration/working_directory.feature +32 -0
- data/features/fixtures/cli-app/.gitignore +9 -0
- data/features/fixtures/cli-app/.rspec +2 -0
- data/features/fixtures/cli-app/README.md +34 -0
- data/features/fixtures/cli-app/Rakefile +1 -0
- data/features/fixtures/cli-app/bin/cli +6 -0
- data/features/fixtures/cli-app/cli-app.gemspec +26 -0
- data/features/fixtures/cli-app/features/support/env.rb +1 -0
- data/features/fixtures/cli-app/lib/cli/app.rb +13 -0
- data/features/fixtures/cli-app/lib/cli/app/version.rb +5 -0
- data/features/fixtures/cli-app/script/console +14 -0
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +7 -0
- data/features/fixtures/cli-app/spec/spec_helper.rb +10 -0
- data/features/fixtures/copy/file.txt +1 -1
- data/features/hooks/after/command.feature +34 -0
- data/features/hooks/before/command.feature +61 -0
- data/features/matchers/directory/have_sub_directory.feature +110 -0
- data/features/matchers/file/be_existing_file.feature +82 -0
- data/features/matchers/file/have_file_content.feature +123 -0
- data/features/matchers/file/have_file_size.feature +107 -0
- data/features/matchers/path/be_an_absolute_path.feature +74 -0
- data/features/matchers/path/be_an_existing_path.feature +97 -0
- data/features/matchers/path/have_permissions.feature +118 -0
- data/features/matchers/timeouts.feature +48 -0
- data/features/step_definitions/aruba_dev_steps.rb +69 -1
- data/features/steps/commands/exit_statuses.feature +136 -0
- data/features/steps/commands/in_process.feature +129 -0
- data/features/steps/commands/run.feature +36 -0
- data/features/steps/environment/home_variable.feature +49 -0
- data/features/steps/environment/set_environment_variable.feature +34 -0
- data/features/support/aruba.rb +5 -0
- data/features/support/env.rb +8 -4
- data/lib/aruba.rb +20 -8
- data/lib/aruba/announcer.rb +1 -0
- data/lib/aruba/api.rb +18 -1179
- data/lib/aruba/api/command.rb +351 -0
- data/lib/aruba/api/core.rb +141 -0
- data/lib/aruba/api/deprecated.rb +549 -0
- data/lib/aruba/api/environment.rb +61 -0
- data/lib/aruba/api/filesystem.rb +305 -0
- data/lib/aruba/api/rvm.rb +39 -0
- data/lib/aruba/aruba_path.rb +75 -0
- data/lib/aruba/basic_configuration.rb +208 -0
- data/lib/aruba/basic_configuration/option.rb +25 -0
- data/lib/aruba/config.rb +43 -30
- data/lib/aruba/config/jruby.rb +14 -0
- data/lib/aruba/config_wrapper.rb +17 -0
- data/lib/aruba/contracts/relative_path.rb +13 -0
- data/lib/aruba/creators/aruba_file_creator.rb +32 -0
- data/lib/aruba/creators/aruba_fixed_size_file_creator.rb +32 -0
- data/lib/aruba/cucumber.rb +87 -53
- data/lib/aruba/cucumber/hooks.rb +65 -10
- data/lib/aruba/environment.rb +121 -0
- data/lib/aruba/errors.rb +3 -0
- data/lib/aruba/extensions/string/strip.rb +24 -0
- data/lib/aruba/hooks.rb +54 -0
- data/lib/aruba/jruby.rb +4 -9
- data/lib/aruba/matchers/command.rb +1 -79
- data/lib/aruba/matchers/command/be_successfully_executed.rb +30 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +47 -0
- data/lib/aruba/matchers/command/have_finished_in_time.rb +42 -0
- data/lib/aruba/matchers/directory.rb +1 -59
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +34 -0
- data/lib/aruba/matchers/directory/have_sub_directory.rb +49 -0
- data/lib/aruba/matchers/file.rb +1 -177
- data/lib/aruba/matchers/file/be_an_existing_file.rb +34 -0
- data/lib/aruba/matchers/file/have_file_content.rb +58 -0
- data/lib/aruba/matchers/file/have_file_size.rb +43 -0
- data/lib/aruba/matchers/file/have_same_file_content.rb +44 -0
- data/lib/aruba/matchers/path.rb +1 -99
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +21 -0
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +32 -0
- data/lib/aruba/matchers/path/be_an_existing_path.rb +33 -0
- data/lib/aruba/matchers/path/have_permissions.rb +60 -0
- data/lib/aruba/matchers/path/match_path_pattern.rb +41 -0
- data/lib/aruba/matchers/rspec.rb +0 -0
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +1 -1
- data/lib/aruba/platform.rb +230 -0
- data/lib/aruba/process_monitor.rb +23 -5
- data/lib/aruba/processes/basic_process.rb +35 -1
- data/lib/aruba/processes/debug_process.rb +26 -15
- data/lib/aruba/processes/in_process.rb +21 -9
- data/lib/aruba/processes/spawn_process.rb +29 -19
- data/lib/aruba/reporting.rb +2 -0
- data/lib/aruba/rspec.rb +61 -13
- data/lib/aruba/runtime.rb +33 -0
- data/script/bootstrap +4 -6
- data/spec/aruba/api/runtime_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +129 -126
- data/spec/aruba/aruba_path_spec.rb +65 -0
- data/spec/aruba/basic_configuration_spec.rb +5 -0
- data/spec/aruba/config_wrapper_spec.rb +25 -0
- data/spec/aruba/configuration_spec.rb +5 -0
- data/spec/aruba/jruby_spec.rb +34 -18
- data/spec/aruba/matchers/directory_spec.rb +6 -7
- data/spec/aruba/matchers/file_spec.rb +16 -20
- data/spec/aruba/matchers/path_spec.rb +14 -11
- data/spec/aruba/rspec_spec.rb +15 -0
- data/spec/aruba/runtime_spec.rb +29 -0
- data/spec/aruba/spawn_process_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -2
- data/spec/support/configs/rspec.rb +1 -1
- data/spec/support/matchers/option.rb +35 -0
- data/spec/support/shared_contexts/aruba.rb +10 -8
- data/spec/support/shared_examples/configuration.rb +116 -0
- metadata +182 -33
- data/.rvmrc +0 -1
- data/features/before_cmd_hooks.feature +0 -61
- data/features/command_environment_variables.feature +0 -31
- data/features/custom_ruby_process.feature +0 -12
- data/features/exit_statuses.feature +0 -30
- data/features/support/custom_main.rb +0 -28
- data/lib/aruba/matchers/mode.rb +0 -52
- data/lib/aruba/utils.rb +0 -21
@@ -0,0 +1,549 @@
|
|
1
|
+
module Aruba
|
2
|
+
module Api
|
3
|
+
module Deprecated
|
4
|
+
# @deprecated
|
5
|
+
# The path to the directory which should contain all your test data
|
6
|
+
# You might want to overwrite this method to place your data else where.
|
7
|
+
#
|
8
|
+
# @return [Array]
|
9
|
+
# The directory path: Each subdirectory is a member of an array
|
10
|
+
def dirs
|
11
|
+
Aruba::Platform.deprecated('The use of "@dirs" is deprecated. Use "Aruba.configure { |c| c.current_directory = \'path/to/dir\' }" instead to set the "current_directory') if defined? @dirs
|
12
|
+
Aruba::Platform.deprecated('The use of "dirs" deprecated. Use "Aruba.configure { |c| c.current_directory = \'path/to/dir\' }" instead to set the "current_directory and "expand_path(".")" to get the current directory or use "#cd(\'.\') { # your code }" to run code in the current directory')
|
13
|
+
|
14
|
+
@dirs ||= aruba.current_directory
|
15
|
+
end
|
16
|
+
|
17
|
+
# @deprecated
|
18
|
+
# Get access to current dir
|
19
|
+
#
|
20
|
+
# @return
|
21
|
+
# Current directory
|
22
|
+
def current_directory
|
23
|
+
Aruba::Platform.deprecated(%(The use of "current_directory" deprecated. Use "expand_path(".")" to get the current directory or "#cd" to run code in the current directory. #{caller.first}))
|
24
|
+
|
25
|
+
File.join(*aruba.current_directory)
|
26
|
+
end
|
27
|
+
|
28
|
+
# @deprecated
|
29
|
+
# Clean the current directory
|
30
|
+
def clean_current_directory
|
31
|
+
Aruba::Platform.deprecated('The use of "clean_current_directory" is deprecated. Either use "#setup_aruba" or `#remove(\'.\') to clean up aruba\'s working directory before your tests are run')
|
32
|
+
|
33
|
+
setup_aruba
|
34
|
+
end
|
35
|
+
|
36
|
+
# @deprecated
|
37
|
+
# Execute block in current directory
|
38
|
+
#
|
39
|
+
# @yield
|
40
|
+
# The block which should be run in current directory
|
41
|
+
def in_current_directory(&block)
|
42
|
+
Aruba::Platform.deprecated('The use of "in_current_directory" deprecated. Use "#cd(\'.\') { # your code }" instead. But be aware, `cd` requires a previously created directory')
|
43
|
+
|
44
|
+
create_directory '' unless directory?('.')
|
45
|
+
cd('', &block)
|
46
|
+
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
# @deprecated
|
51
|
+
def detect_ruby(cmd)
|
52
|
+
Aruba::Platform.deprecated('The use of "#detect_ruby" is deprecated. Use "Aruba::Platform.detect_ruby" instead')
|
53
|
+
|
54
|
+
Aruba::Platform.detect_ruby cmd
|
55
|
+
end
|
56
|
+
|
57
|
+
# @deprecated
|
58
|
+
def current_ruby
|
59
|
+
Aruba::Platform.deprecated('The use of "#current_ruby" is deprecated. Use "Aruba::Platform.current_ruby" instead')
|
60
|
+
|
61
|
+
Aruba::Platform.current_ruby cmd
|
62
|
+
end
|
63
|
+
|
64
|
+
# @deprecated
|
65
|
+
def _ensure_newline(str)
|
66
|
+
Aruba::Platform.deprecated('The use of "#_ensure_newline" is deprecated. Use "Aruba::Platform.ensure_newline" instead')
|
67
|
+
|
68
|
+
Aruba::Platform.ensure_newline cmd
|
69
|
+
end
|
70
|
+
|
71
|
+
# @deprecated
|
72
|
+
def absolute_path(*args)
|
73
|
+
Aruba::Platform.deprecated('The use of "absolute_path" is deprecated. Use "expand_path" instead. But be aware that "expand_path" uses a different implementation')
|
74
|
+
|
75
|
+
File.expand_path File.join(*args), aruba.current_directory
|
76
|
+
end
|
77
|
+
|
78
|
+
# @deprecated
|
79
|
+
def _read_interactive
|
80
|
+
Aruba::Platform.deprecated('The use of "#_read_interactive" is deprecated. Please use "last_command.stdout" instead')
|
81
|
+
|
82
|
+
last_command.stdout
|
83
|
+
end
|
84
|
+
|
85
|
+
# @deprecated
|
86
|
+
def announce_or_puts(msg)
|
87
|
+
Aruba::Platform.deprecated('The use of "#announce_or_puts" is deprecated. Please use "#announcer.mode = :kernel" or "#announcer.mode = :puts" instead')
|
88
|
+
|
89
|
+
if(@puts)
|
90
|
+
Kernel.puts(msg)
|
91
|
+
else
|
92
|
+
puts(msg)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# @deprecated
|
97
|
+
def _write_interactive(input)
|
98
|
+
Aruba::Platform.deprecated('The use of "#_write_interactive" is deprecated. Please use "#last_command.write()" instead')
|
99
|
+
|
100
|
+
last_command.write(input)
|
101
|
+
end
|
102
|
+
|
103
|
+
# @deprecated
|
104
|
+
def eot
|
105
|
+
Aruba::Platform.deprecated(%{\e[35m The \"#eot\"-method is deprecated. It will be deleted with the next major version. Please use \"#close_input\"-method instead.\e[0m})
|
106
|
+
|
107
|
+
close_input
|
108
|
+
end
|
109
|
+
|
110
|
+
# Run a command interactively
|
111
|
+
#
|
112
|
+
# @param [String] cmd
|
113
|
+
# The command to by run
|
114
|
+
#
|
115
|
+
# @see #cmd
|
116
|
+
# @deprectated
|
117
|
+
def run_interactive(cmd)
|
118
|
+
Aruba::Platform.deprecated('The use of "#run_interactive" is deprecated. You can simply use "run" instead')
|
119
|
+
|
120
|
+
run(cmd)
|
121
|
+
end
|
122
|
+
|
123
|
+
# @deprecated
|
124
|
+
# Create an empty file
|
125
|
+
#
|
126
|
+
# @param [String] file_name
|
127
|
+
# The name of the file
|
128
|
+
def touch_file(*args)
|
129
|
+
Aruba::Platform.deprecated('The use of "#touch_file" is deprecated. Use "#touch" instead')
|
130
|
+
|
131
|
+
touch(*args)
|
132
|
+
end
|
133
|
+
|
134
|
+
# @deprecated
|
135
|
+
def mod?(file, perms, &block)
|
136
|
+
Aruba::Platform.deprecated('The use of "#mod?" is deprecated. Use "expect().to have_permissions()" instead')
|
137
|
+
|
138
|
+
expect(Array(file)).to all have_permissions(perms)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @deprecated
|
142
|
+
# Remove file
|
143
|
+
#
|
144
|
+
# @param [String] file_name
|
145
|
+
# The file which should be deleted in current directory
|
146
|
+
def remove_file(*args)
|
147
|
+
Aruba::Platform.deprecated('The use of "#remove_file" is deprecated. Use "#remove" instead')
|
148
|
+
|
149
|
+
remove(*args)
|
150
|
+
end
|
151
|
+
|
152
|
+
# @deprecated
|
153
|
+
def create_dir(*args)
|
154
|
+
Aruba::Platform.deprecated('The use of "#create_dir" is deprecated. Use "#create_directory" instead')
|
155
|
+
create_directory(*args)
|
156
|
+
end
|
157
|
+
|
158
|
+
# @deprecated
|
159
|
+
# Remove directory
|
160
|
+
#
|
161
|
+
# @param [String] directory_name
|
162
|
+
# The name of the directory which should be removed
|
163
|
+
def remove_directory(*args)
|
164
|
+
Aruba::Platform.deprecated('The use of "remove_directory" is deprecated. Use "remove" instead')
|
165
|
+
remove(*args)
|
166
|
+
end
|
167
|
+
|
168
|
+
# @deprecated
|
169
|
+
def remove_dir(*args)
|
170
|
+
Aruba::Platform.deprecated('The use of "remove_dir" is deprecated. Use "remove" instead')
|
171
|
+
remove(*args)
|
172
|
+
end
|
173
|
+
|
174
|
+
# @deprecated
|
175
|
+
#
|
176
|
+
# Check if paths are present
|
177
|
+
#
|
178
|
+
# @param [#each] paths
|
179
|
+
# The paths which should be checked
|
180
|
+
#
|
181
|
+
# @param [true,false] expect_presence
|
182
|
+
# Should the given paths be present (true) or absent (false)
|
183
|
+
def check_file_presence(paths, expect_presence = true)
|
184
|
+
Aruba::Platform.deprecated('The use of "check_file_presence" is deprecated. Use "expect().to be_existing_file or expect(all_paths).to match_path_pattern() instead" ')
|
185
|
+
|
186
|
+
stop_processes!
|
187
|
+
|
188
|
+
Array(paths).each do |path|
|
189
|
+
if path.kind_of? Regexp
|
190
|
+
if expect_presence
|
191
|
+
expect(all_paths).to match_path_pattern(path)
|
192
|
+
else
|
193
|
+
expect(all_paths).not_to match_path_pattern(path)
|
194
|
+
end
|
195
|
+
else
|
196
|
+
if expect_presence
|
197
|
+
expect(path).to be_an_existing_file
|
198
|
+
else
|
199
|
+
expect(path).not_to be_an_existing_file
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# @deprecated
|
206
|
+
# Check the file size of paths
|
207
|
+
#
|
208
|
+
# @params [Hash] paths_and_sizes
|
209
|
+
# A hash containing the path (key) and the expected size (value)
|
210
|
+
#
|
211
|
+
# @example
|
212
|
+
#
|
213
|
+
# paths_and_sizes = {
|
214
|
+
# 'file' => 10
|
215
|
+
# }
|
216
|
+
#
|
217
|
+
# check_file_size(paths_and_sizes)
|
218
|
+
#
|
219
|
+
def check_file_size(paths_and_sizes)
|
220
|
+
Aruba::Platform.deprecated('The use of "#check_file_size" is deprecated. Use "expect(file).to have_file_size(size)", "expect(all_files).to all have_file_size(1)", "expect(all_files).to include a_file_with_size(1)" instead')
|
221
|
+
stop_processes!
|
222
|
+
|
223
|
+
paths_and_sizes.each do |path, size|
|
224
|
+
expect(path).to have_file_size size
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# @deprecated
|
229
|
+
def check_exact_file_content(file, exact_content, expect_match = true)
|
230
|
+
Aruba::Platform.deprecated('The use of "#check_exact_file_content" is deprecated. Use "expect(file).to have_file_content(content)" with a string')
|
231
|
+
|
232
|
+
check_file_content(file, exact_content, expect_match)
|
233
|
+
end
|
234
|
+
|
235
|
+
# @deprecated
|
236
|
+
# Check if the content of file against the content of a reference file
|
237
|
+
#
|
238
|
+
# @param [String] file
|
239
|
+
# The file to be checked
|
240
|
+
#
|
241
|
+
# @param [String] reference_file
|
242
|
+
# The reference file
|
243
|
+
#
|
244
|
+
# @param [true, false] expect_match
|
245
|
+
# Must the content be in the file or not
|
246
|
+
def check_binary_file_content(file, reference_file, expect_match = true)
|
247
|
+
Aruba::Platform.deprecated('The use of "#check_binary_file_content" is deprecated. Use "expect(file).to have_same_file_content_like(file)"')
|
248
|
+
|
249
|
+
stop_processes!
|
250
|
+
|
251
|
+
if expect_match
|
252
|
+
expect(file).to have_same_file_content_like reference_file
|
253
|
+
else
|
254
|
+
expect(file).not_to have_same_file_content_like reference_file
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# @deprecated
|
259
|
+
# Check presence of a directory
|
260
|
+
#
|
261
|
+
# @param [Array] paths
|
262
|
+
# The paths to be checked
|
263
|
+
#
|
264
|
+
# @param [true, false] expect_presence
|
265
|
+
# Should the directory be there or should the directory not be there
|
266
|
+
def check_directory_presence(paths, expect_presence)
|
267
|
+
Aruba::Platform.deprecated('The use of "#check_directory_presence" is deprecated. Use "expect(directory).to be_an_existing_directory"')
|
268
|
+
|
269
|
+
stop_processes!
|
270
|
+
|
271
|
+
paths.each do |path|
|
272
|
+
path = expand_path(path)
|
273
|
+
|
274
|
+
if expect_presence
|
275
|
+
expect(path).to be_an_existing_directory
|
276
|
+
else
|
277
|
+
expect(path).not_to be_an_existing_directory
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
# @deprecated
|
283
|
+
def prep_for_fs_check(&block)
|
284
|
+
Aruba::Platform.deprecated('The use of "prep_for_fs_check" is deprecated. Use apropriate methods and the new rspec matchers instead')
|
285
|
+
|
286
|
+
process_monitor.stop_processes!
|
287
|
+
cd('') { block.call }
|
288
|
+
end
|
289
|
+
|
290
|
+
# @deprecated
|
291
|
+
def assert_exit_status_and_partial_output(expect_to_pass, expected)
|
292
|
+
Aruba::Platform.deprecated('The use of "assert_exit_status_and_partial_output" is deprecated. Use "#assert_access" and "#assert_partial_output" instead')
|
293
|
+
|
294
|
+
assert_success(expect_to_pass)
|
295
|
+
assert_partial_output(expected, all_output)
|
296
|
+
end
|
297
|
+
|
298
|
+
# TODO: Remove this. Call more methods elsewhere instead. Reveals more intent.
|
299
|
+
# @deprecated
|
300
|
+
def assert_exit_status_and_output(expect_to_pass, expected_output, expect_exact_output)
|
301
|
+
assert_success(expect_to_pass)
|
302
|
+
if expect_exact_output
|
303
|
+
assert_exact_output(expected_output, all_output)
|
304
|
+
else
|
305
|
+
assert_partial_output(expected_output, all_output)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
# Check the content of file
|
310
|
+
#
|
311
|
+
# It supports partial content as well. And it is up to you to decided if
|
312
|
+
# the content must be there or not.
|
313
|
+
#
|
314
|
+
# @param [String] file
|
315
|
+
# The file to be checked
|
316
|
+
#
|
317
|
+
# @param [String, Regexp] content
|
318
|
+
# The content which must/must not be in the file. If content is
|
319
|
+
# a String exact match is done, if content is a Regexp then file
|
320
|
+
# is matched using regular expression
|
321
|
+
#
|
322
|
+
# @param [true, false] expect_match
|
323
|
+
# Must the content be in the file or not
|
324
|
+
def check_file_content(file, content, expect_match = true)
|
325
|
+
Aruba::Platform.deprecated('The use of "#check_file_content" is deprecated. Use "expect(file).to have_file_content(content)" instead. For eq match use string, for partial match use /regex/')
|
326
|
+
|
327
|
+
stop_processes!
|
328
|
+
|
329
|
+
if expect_match
|
330
|
+
expect(file).to have_file_content content
|
331
|
+
else
|
332
|
+
expect(file).not_to have_file_content content
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
# @deprecated
|
337
|
+
def _mkdir(dir_name)
|
338
|
+
Aruba::Platform.deprecated('The use of "#_mkdir" is deprecated')
|
339
|
+
|
340
|
+
Aruba::Platform.mkdir(dir_name)
|
341
|
+
end
|
342
|
+
|
343
|
+
# @deprecated
|
344
|
+
def _rm(dir_name)
|
345
|
+
Aruba::Platform.deprecated('The use of "#_rm_rf" is deprecated')
|
346
|
+
|
347
|
+
Aruba::Platform.rm(dir_name)
|
348
|
+
end
|
349
|
+
|
350
|
+
# @deprecated
|
351
|
+
def current_dir(*args, &block)
|
352
|
+
Aruba::Platform.deprecated('The use of "#current_dir" is deprecated. Use "#current_directory" instead')
|
353
|
+
|
354
|
+
current_directory(*args, &block)
|
355
|
+
end
|
356
|
+
|
357
|
+
# @deprecated
|
358
|
+
def clean_current_dir(*args, &block)
|
359
|
+
Aruba::Platform.deprecated('The use of "clean_current_dir" is deprecated. Either use "#setup_aruba" or `#remove(\'.\') to clean up aruba\'s working directory before your tests are run')
|
360
|
+
|
361
|
+
setup_aruba
|
362
|
+
end
|
363
|
+
|
364
|
+
# @deprecated
|
365
|
+
def in_current_dir(*args, &block)
|
366
|
+
Aruba::Platform.deprecated('The use of "in_current_dir" is deprecated. Use "#cd(\'.\') { }" instead')
|
367
|
+
|
368
|
+
in_current_directory
|
369
|
+
end
|
370
|
+
|
371
|
+
# @deprecated
|
372
|
+
# Run block with environment
|
373
|
+
#
|
374
|
+
# @param [Hash] env
|
375
|
+
# The variables to be used for block.
|
376
|
+
#
|
377
|
+
# @yield
|
378
|
+
# The block of code which should be run with the modified environment variables
|
379
|
+
def with_env(env = {}, &block)
|
380
|
+
Aruba::Platform.deprecated('The use of "#with_env" is deprecated. Use "#with_environment {}" instead. But be careful this uses a different implementation')
|
381
|
+
|
382
|
+
env.each do |k,v|
|
383
|
+
set_env k, v
|
384
|
+
end
|
385
|
+
block.call
|
386
|
+
restore_env
|
387
|
+
end
|
388
|
+
|
389
|
+
# @deprecated
|
390
|
+
# Restore original process environment
|
391
|
+
def restore_env
|
392
|
+
# No output because we need to reset env on each scenario/spec run
|
393
|
+
# Aruba::Platform.deprecated('The use of "#restore_env" is deprecated. If you use "set_environment_variable" there\'s no need to restore the environment')
|
394
|
+
|
395
|
+
original_env.each do |key, value|
|
396
|
+
if value
|
397
|
+
ENV[key] = value
|
398
|
+
else
|
399
|
+
ENV.delete key
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
# @deprecated
|
405
|
+
# Set environment variable
|
406
|
+
#
|
407
|
+
# @param [String] key
|
408
|
+
# The name of the environment variable as string, e.g. 'HOME'
|
409
|
+
#
|
410
|
+
# @param [String] value
|
411
|
+
# The value of the environment variable. Needs to be a string.
|
412
|
+
def set_env(key, value)
|
413
|
+
Aruba::Platform.deprecated('The use of "#set_env" is deprecated. Please use "set_environment_variable" instead. But be careful, this method uses a different kind of implementation')
|
414
|
+
|
415
|
+
announcer.announce(:environment, key, value)
|
416
|
+
original_env[key] = ENV.delete(key) unless original_env.key? key
|
417
|
+
ENV[key] = value
|
418
|
+
end
|
419
|
+
|
420
|
+
# @deprecated
|
421
|
+
def original_env
|
422
|
+
# Aruba::Platform.deprecated('The use of "#original_env" is deprecated.')
|
423
|
+
|
424
|
+
@original_env ||= {}
|
425
|
+
end
|
426
|
+
|
427
|
+
# @deprecated
|
428
|
+
def filesystem_permissions(*args)
|
429
|
+
Aruba::Platform.deprecated('The use of "#filesystem_permissions" is deprecated. Please use "#chmod" instead.')
|
430
|
+
|
431
|
+
chmod(*args)
|
432
|
+
end
|
433
|
+
|
434
|
+
# Check file system permissions of file
|
435
|
+
#
|
436
|
+
# @param [Octal] expected_permissions
|
437
|
+
# Expected file system permissions, e.g. 0755
|
438
|
+
# @param [String] file_names
|
439
|
+
# The file name(s)
|
440
|
+
# @param [Boolean] expected_result
|
441
|
+
# Are the permissions expected to be mode or are they expected not to be mode?
|
442
|
+
def check_filesystem_permissions(*args)
|
443
|
+
Aruba::Platform.deprecated('The use of "#check_filesystem_permissions" is deprecated. Please use "expect().to have_permissions perms" instead.')
|
444
|
+
|
445
|
+
args = args.flatten
|
446
|
+
|
447
|
+
expected_permissions = args.shift
|
448
|
+
expected_result = args.pop
|
449
|
+
|
450
|
+
args.each do |p|
|
451
|
+
raise "Expected #{p} to be present" unless exist? p
|
452
|
+
|
453
|
+
if expected_result
|
454
|
+
expect(p).to have_permissions expected_permissions
|
455
|
+
else
|
456
|
+
expect(p).not_to have_permissions expected_permissions
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
# @deprecated
|
462
|
+
def _create_file(name, content, check_presence)
|
463
|
+
Aruba::Platform.deprecated('The use of "#_create_file" is deprecated. It will be removed soon.')
|
464
|
+
|
465
|
+
ArubaFileCreator.new.write(expand_path(name), content, check_presence)
|
466
|
+
|
467
|
+
self
|
468
|
+
end
|
469
|
+
|
470
|
+
# @deprecated
|
471
|
+
def _create_fixed_size_file(file_name, file_size, check_presence)
|
472
|
+
Aruba::Platform.deprecated('The use of "#_create_fixed_size_file" is deprecated. It will be removed soon.')
|
473
|
+
|
474
|
+
ArubaFixedSizeFileCreator.new.write(expand_path(name), size, check_presence)
|
475
|
+
|
476
|
+
self
|
477
|
+
end
|
478
|
+
|
479
|
+
# @deprecated
|
480
|
+
# Unescape string
|
481
|
+
#
|
482
|
+
# @param [String] string
|
483
|
+
# The string which should be unescaped, e.g. the output of a command
|
484
|
+
#
|
485
|
+
# @return
|
486
|
+
# The string stripped from escape sequences
|
487
|
+
def unescape(string)
|
488
|
+
Aruba::Platform.deprecated('The use of "#unescape" is deprecated. Use "Aruba::Platform.unescape" instead')
|
489
|
+
|
490
|
+
Aruba::Platform.unescape(string, aruba.config.keep_ansi)
|
491
|
+
end
|
492
|
+
|
493
|
+
# @deprecated
|
494
|
+
# The root directory of aruba
|
495
|
+
def root_directory
|
496
|
+
Aruba::Platform.deprecated('The use of "#root_directory" is deprecated. Use "aruba.root_directory" instead')
|
497
|
+
|
498
|
+
aruba.root_directory
|
499
|
+
end
|
500
|
+
# The path to the directory which contains fixtures
|
501
|
+
# You might want to overwrite this method to place your data else where.
|
502
|
+
#
|
503
|
+
# @return [String]
|
504
|
+
# The directory to where your fixtures are stored
|
505
|
+
def fixtures_directory
|
506
|
+
Aruba::Platform.deprecated('The use of "#fixtures_directory" is deprecated. Use "aruba.fixtures_directory" instead')
|
507
|
+
|
508
|
+
aruba.fixtures_directory
|
509
|
+
end
|
510
|
+
|
511
|
+
# @deprecated
|
512
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
513
|
+
# rubocop:disable Metrics/MethodLength
|
514
|
+
def check_for_deprecated_variables
|
515
|
+
if defined? @aruba_io_wait_seconds
|
516
|
+
Aruba::Platform.deprecated('The use of "@aruba_io_wait_seconds" is deprecated. Use "#aruba.config.io_wait_timeout = <numeric>" instead')
|
517
|
+
aruba.config.io_wait_timeout = @aruba_io_wait_seconds
|
518
|
+
end
|
519
|
+
|
520
|
+
if root_directory != aruba.config.root_directory
|
521
|
+
Aruba::Platform.deprecated('Overwriting of methods for configuration is deprecated. Use "#aruba.config.root_directory = <string>" instead')
|
522
|
+
aruba.config.root_directory = root_directory
|
523
|
+
end
|
524
|
+
|
525
|
+
if current_directory != aruba.config.current_directory
|
526
|
+
Aruba::Platform.deprecated('Overwriting of methods for configuration is deprecated. Use "#aruba.config.current_directory = <string>" instead')
|
527
|
+
aruba.config.current_directory = current_directory
|
528
|
+
end
|
529
|
+
|
530
|
+
if defined? @keep_ansi
|
531
|
+
Aruba::Platform.deprecated('The use of "@aruba_keep_ansi" is deprecated. Use "#aruba.config.keep_ansi = <true|false>" instead')
|
532
|
+
aruba.config.keep_ansi = @keep_ansi
|
533
|
+
end
|
534
|
+
|
535
|
+
if defined? @aruba_root_directory
|
536
|
+
Aruba::Platform.deprecated('The use of "@aruba_root_directory" is deprecated. Use "#aruba.config.root_directory = <string>" instead')
|
537
|
+
aruba.config.keep_ansi = @aruba_root_directory
|
538
|
+
end
|
539
|
+
|
540
|
+
if root_directory != aruba.config.root_directory
|
541
|
+
Aruba::Platform.deprecated('Overwriting of methods for configuration of "root_directory" is deprecated.')
|
542
|
+
aruba.config.root_directory = root_directory
|
543
|
+
end
|
544
|
+
end
|
545
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
546
|
+
# rubocop:enable Metrics/MethodLength
|
547
|
+
end
|
548
|
+
end
|
549
|
+
end
|