aruba 1.0.0.pre.alpha.2 → 1.0.0.pre.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
- data/.rubocop.yml +6 -181
- data/.rubocop_todo.yml +364 -0
- data/.travis.yml +63 -34
- data/.yardopts +3 -0
- data/CHANGELOG.md +1121 -0
- data/CONTRIBUTING.md +179 -78
- data/Gemfile +29 -44
- data/README.md +41 -11
- data/Rakefile +35 -35
- data/appveyor.yml +6 -5
- data/aruba.gemspec +14 -16
- data/bin/console +2 -11
- data/cucumber.yml +0 -7
- data/fixtures/cli-app/README.md +1 -1
- data/fixtures/cli-app/Rakefile +1 -1
- data/fixtures/cli-app/cli-app.gemspec +1 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
- data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
- data/fixtures/empty-app/Rakefile +1 -1
- data/fixtures/empty-app/cli-app.gemspec +1 -0
- data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
- data/fixtures/getting-started-app/Gemfile +1 -1
- data/lib/aruba/api.rb +3 -10
- data/lib/aruba/api/bundler.rb +16 -0
- data/lib/aruba/api/commands.rb +249 -0
- data/lib/aruba/api/core.rb +24 -10
- data/lib/aruba/api/environment.rb +12 -7
- data/lib/aruba/api/filesystem.rb +22 -20
- data/lib/aruba/api/text.rb +3 -9
- data/lib/aruba/aruba_path.rb +3 -18
- data/lib/aruba/basic_configuration.rb +3 -19
- data/lib/aruba/cli.rb +1 -1
- data/lib/aruba/colorizer.rb +33 -33
- data/lib/aruba/command.rb +4 -0
- data/lib/aruba/config_wrapper.rb +1 -1
- data/lib/aruba/configuration.rb +78 -0
- data/lib/aruba/console.rb +5 -5
- data/lib/aruba/console/help.rb +1 -1
- data/lib/aruba/cucumber.rb +0 -1
- data/lib/aruba/cucumber/command.rb +55 -115
- data/lib/aruba/cucumber/environment.rb +1 -1
- data/lib/aruba/cucumber/file.rb +9 -21
- data/lib/aruba/cucumber/hooks.rb +6 -62
- data/lib/aruba/event_bus/name_resolver.rb +1 -2
- data/lib/aruba/hooks.rb +1 -1
- data/lib/aruba/initializer.rb +3 -3
- data/lib/aruba/matchers/base/base_matcher.rb +2 -2
- data/lib/aruba/matchers/base/message_indenter.rb +19 -0
- data/lib/aruba/matchers/base/object_formatter.rb +2 -2
- data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
- data/lib/aruba/matchers/command/be_successfully_executed.rb +2 -4
- data/lib/aruba/matchers/command/have_exit_status.rb +1 -1
- data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -4
- data/lib/aruba/matchers/command/have_output.rb +9 -4
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
- data/lib/aruba/matchers/command/have_output_size.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +4 -6
- data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
- data/lib/aruba/matchers/file/be_an_existing_file.rb +4 -6
- data/lib/aruba/matchers/file/have_file_content.rb +4 -4
- data/lib/aruba/matchers/file/have_file_size.rb +6 -8
- data/lib/aruba/matchers/file/have_same_file_content.rb +9 -12
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
- data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
- data/lib/aruba/matchers/path/have_permissions.rb +6 -8
- data/lib/aruba/matchers/string/include_output_string.rb +8 -10
- data/lib/aruba/matchers/string/match_output_string.rb +9 -11
- data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
- data/lib/aruba/platform.rb +0 -1
- data/lib/aruba/platforms/announcer.rb +26 -70
- data/lib/aruba/platforms/aruba_file_creator.rb +1 -1
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
- data/lib/aruba/platforms/aruba_logger.rb +22 -2
- data/lib/aruba/platforms/command_monitor.rb +2 -125
- data/lib/aruba/platforms/filesystem_status.rb +9 -9
- data/lib/aruba/platforms/local_environment.rb +2 -2
- data/lib/aruba/platforms/simple_table.rb +3 -3
- data/lib/aruba/platforms/unix_command_string.rb +7 -4
- data/lib/aruba/platforms/unix_environment_variables.rb +9 -13
- data/lib/aruba/platforms/unix_platform.rb +2 -27
- data/lib/aruba/platforms/unix_which.rb +2 -1
- data/lib/aruba/platforms/windows_command_string.rb +20 -7
- data/lib/aruba/platforms/windows_environment_variables.rb +35 -30
- data/lib/aruba/platforms/windows_which.rb +4 -3
- data/lib/aruba/processes/basic_process.rb +11 -15
- data/lib/aruba/processes/debug_process.rb +5 -0
- data/lib/aruba/processes/in_process.rb +17 -8
- data/lib/aruba/processes/spawn_process.rb +35 -23
- data/lib/aruba/rspec.rb +9 -22
- data/lib/aruba/runtime.rb +7 -5
- data/lib/aruba/setup.rb +6 -4
- data/lib/aruba/tasks/docker_helpers.rb +1 -1
- data/lib/aruba/version.rb +1 -1
- metadata +37 -57
- data/History.md +0 -612
- data/bin/bootstrap +0 -34
- data/fixtures/spawn_process/stderr.sh +0 -3
- data/lib/aruba/api/command.rb +0 -309
- data/lib/aruba/api/deprecated.rb +0 -895
- data/lib/aruba/api/rvm.rb +0 -44
- data/lib/aruba/config.rb +0 -101
- data/lib/aruba/cucumber/rvm.rb +0 -3
- data/lib/aruba/in_process.rb +0 -14
- data/lib/aruba/jruby.rb +0 -4
- data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
- data/lib/aruba/spawn_process.rb +0 -11
data/lib/aruba/api/core.rb
CHANGED
@@ -25,8 +25,8 @@ module Aruba
|
|
25
25
|
# This will only clean up aruba's working directory to remove all
|
26
26
|
# artifacts of your tests. This does NOT clean up the current working
|
27
27
|
# directory.
|
28
|
-
def setup_aruba
|
29
|
-
Aruba::Setup.new(aruba).call
|
28
|
+
def setup_aruba(clobber = true)
|
29
|
+
Aruba::Setup.new(aruba).call(clobber)
|
30
30
|
|
31
31
|
self
|
32
32
|
end
|
@@ -55,7 +55,7 @@ module Aruba
|
|
55
55
|
aruba.current_directory << dir
|
56
56
|
new_directory = expand_path('.')
|
57
57
|
|
58
|
-
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(:
|
58
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory, new: new_directory)
|
59
59
|
|
60
60
|
old_dir = Aruba.platform.getwd
|
61
61
|
|
@@ -80,7 +80,7 @@ module Aruba
|
|
80
80
|
aruba.current_directory << dir
|
81
81
|
new_directory = expand_path('.')
|
82
82
|
|
83
|
-
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(:
|
83
|
+
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory, new: new_directory)
|
84
84
|
|
85
85
|
self
|
86
86
|
end
|
@@ -117,11 +117,15 @@ module Aruba
|
|
117
117
|
# # => <path>/test/fixtures/file
|
118
118
|
# expand_path('%/file')
|
119
119
|
#
|
120
|
+
# @example Absolute directory
|
121
|
+
#
|
122
|
+
# # => /foo/bar
|
123
|
+
# expand_path('/foo/bar')
|
124
|
+
#
|
120
125
|
# rubocop:disable Metrics/MethodLength
|
121
126
|
# rubocop:disable Metrics/CyclomaticComplexity
|
127
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
122
128
|
def expand_path(file_name, dir_string = nil)
|
123
|
-
check_for_deprecated_variables if Aruba::VERSION < '1'
|
124
|
-
|
125
129
|
# rubocop:disable Metrics/LineLength
|
126
130
|
message = %(Filename "#{file_name}" needs to be a string. It cannot be nil or empty either. Please use `expand_path('.')` if you want the current directory to be expanded.)
|
127
131
|
# rubocop:enable Metrics/LineLength
|
@@ -129,7 +133,8 @@ module Aruba
|
|
129
133
|
fail ArgumentError, message unless file_name.is_a?(String) && !file_name.empty?
|
130
134
|
|
131
135
|
# rubocop:disable Metrics/LineLength
|
132
|
-
|
136
|
+
fail %(Aruba's working directory does not exist. Maybe you forgot to run `setup_aruba` before using its API.) unless Aruba.platform.directory? File.join(aruba.config.root_directory, aruba.config.working_directory)
|
137
|
+
|
133
138
|
# rubocop:enable Metrics/LineLength
|
134
139
|
|
135
140
|
prefix = file_name[0]
|
@@ -140,10 +145,11 @@ module Aruba
|
|
140
145
|
|
141
146
|
# rubocop:disable Metrics/LineLength
|
142
147
|
fail ArgumentError, %(Fixture "#{rest}" does not exist in fixtures directory "#{aruba.fixtures_directory}". This was the one we found first on your system from all possible candidates: #{aruba.config.fixtures_directories.map { |p| format('"%s"', p) }.join(', ')}.) unless Aruba.platform.exist? path
|
148
|
+
|
143
149
|
# rubocop:enable Metrics/LineLength
|
144
150
|
|
145
151
|
path
|
146
|
-
elsif '~'
|
152
|
+
elsif prefix == '~'
|
147
153
|
path = with_environment do
|
148
154
|
ArubaPath.new(File.expand_path(file_name))
|
149
155
|
end
|
@@ -152,13 +158,21 @@ module Aruba
|
|
152
158
|
fail ArgumentError, %(Expanding "~/" to a relative path "#{path}" is not allowed) unless path.absolute?
|
153
159
|
|
154
160
|
path.to_s
|
161
|
+
elsif absolute? file_name
|
162
|
+
unless aruba.config.allow_absolute_paths
|
163
|
+
aruba.logger.warn 'Using absolute paths in Aruba is not recommended.' \
|
164
|
+
' Set config.allow_absolute_paths = true to silence this warning'
|
165
|
+
end
|
166
|
+
file_name
|
155
167
|
else
|
156
168
|
directory = File.join(aruba.root_directory, aruba.current_directory)
|
157
|
-
|
169
|
+
directory = File.expand_path(dir_string, directory) if dir_string
|
170
|
+
File.expand_path(file_name, directory)
|
158
171
|
end
|
159
172
|
end
|
160
173
|
# rubocop:enable Metrics/MethodLength
|
161
|
-
# rubocop:enable
|
174
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
175
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
162
176
|
|
163
177
|
# Run block with environment
|
164
178
|
#
|
@@ -13,6 +13,8 @@ module Aruba
|
|
13
13
|
#
|
14
14
|
# @param [String] value
|
15
15
|
# The value of the environment variable. Needs to be a string.
|
16
|
+
#
|
17
|
+
# @return [self]
|
16
18
|
def set_environment_variable(name, value)
|
17
19
|
name = name.to_s
|
18
20
|
value = value.to_s
|
@@ -21,7 +23,7 @@ module Aruba
|
|
21
23
|
aruba.environment[name] = value
|
22
24
|
new_environment = aruba.environment.to_h
|
23
25
|
|
24
|
-
aruba.event_bus.notify Events::AddedEnvironmentVariable.new(:
|
26
|
+
aruba.event_bus.notify Events::AddedEnvironmentVariable.new(old: old_environment, new: new_environment, changed: { name: name, value: value })
|
25
27
|
|
26
28
|
self
|
27
29
|
end
|
@@ -33,6 +35,8 @@ module Aruba
|
|
33
35
|
#
|
34
36
|
# @param [String] value
|
35
37
|
# The value of the environment variable. Needs to be a string.
|
38
|
+
#
|
39
|
+
# @return [self]
|
36
40
|
def append_environment_variable(name, value)
|
37
41
|
name = name.to_s
|
38
42
|
value = value.to_s
|
@@ -41,7 +45,7 @@ module Aruba
|
|
41
45
|
aruba.environment.append name, value
|
42
46
|
new_environment = aruba.environment.to_h
|
43
47
|
|
44
|
-
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(:
|
48
|
+
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(old: old_environment, new: new_environment, changed: { name: name, value: value })
|
45
49
|
|
46
50
|
self
|
47
51
|
end
|
@@ -53,6 +57,8 @@ module Aruba
|
|
53
57
|
#
|
54
58
|
# @param [String] value
|
55
59
|
# The value of the environment variable. Needs to be a string.
|
60
|
+
#
|
61
|
+
# @return [self]
|
56
62
|
def prepend_environment_variable(name, value)
|
57
63
|
name = name.to_s
|
58
64
|
value = value.to_s
|
@@ -61,18 +67,17 @@ module Aruba
|
|
61
67
|
aruba.environment.prepend name, value
|
62
68
|
new_environment = aruba.environment.to_h
|
63
69
|
|
64
|
-
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(:
|
70
|
+
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(old: old_environment, new: new_environment, changed: { name: name, value: value })
|
65
71
|
|
66
72
|
self
|
67
73
|
end
|
68
74
|
|
69
75
|
# Remove existing environment variable
|
70
76
|
#
|
71
|
-
# @param [String]
|
77
|
+
# @param [String] name
|
72
78
|
# The name of the environment variable as string, e.g. 'HOME'
|
73
79
|
#
|
74
|
-
# @
|
75
|
-
# The value of the environment variable. Needs to be a string.
|
80
|
+
# @return [self]
|
76
81
|
def delete_environment_variable(name)
|
77
82
|
name = name.to_s
|
78
83
|
|
@@ -80,7 +85,7 @@ module Aruba
|
|
80
85
|
aruba.environment.delete name
|
81
86
|
new_environment = aruba.environment.to_h
|
82
87
|
|
83
|
-
aruba.event_bus.notify Events::DeletedEnvironmentVariable.new(:
|
88
|
+
aruba.event_bus.notify Events::DeletedEnvironmentVariable.new(old: old_environment, new: new_environment, changed: { name: name, value: '' })
|
84
89
|
|
85
90
|
self
|
86
91
|
end
|
data/lib/aruba/api/filesystem.rb
CHANGED
@@ -40,8 +40,10 @@ module Aruba
|
|
40
40
|
|
41
41
|
# Check if file exist and is executable
|
42
42
|
#
|
43
|
-
# @param [String]
|
44
|
-
# The
|
43
|
+
# @param [String] path
|
44
|
+
# The path which should exist and be executable
|
45
|
+
#
|
46
|
+
# @return [Boolean]
|
45
47
|
def executable?(path)
|
46
48
|
path = expand_path(path)
|
47
49
|
|
@@ -50,16 +52,14 @@ module Aruba
|
|
50
52
|
|
51
53
|
# Check if path is absolute
|
52
54
|
#
|
53
|
-
# @return [
|
54
|
-
# Result of check
|
55
|
+
# @return [Boolean]
|
55
56
|
def absolute?(path)
|
56
57
|
ArubaPath.new(path).absolute?
|
57
58
|
end
|
58
59
|
|
59
60
|
# Check if path is relative
|
60
61
|
#
|
61
|
-
# @return [
|
62
|
-
# Result of check
|
62
|
+
# @return [Boolean]
|
63
63
|
def relative?(path)
|
64
64
|
ArubaPath.new(path).relative?
|
65
65
|
end
|
@@ -69,7 +69,7 @@ module Aruba
|
|
69
69
|
# @return [Array]
|
70
70
|
# List of files and directories
|
71
71
|
def all_paths
|
72
|
-
list('.').map { |
|
72
|
+
list('.').map { |path| expand_path(path) }
|
73
73
|
end
|
74
74
|
|
75
75
|
# Return all existing files in current directory
|
@@ -128,10 +128,10 @@ module Aruba
|
|
128
128
|
# The method does not check if file already exists. If the file name is a
|
129
129
|
# path the method will create all neccessary directories.
|
130
130
|
#
|
131
|
-
# @param [String]
|
131
|
+
# @param [String] name
|
132
132
|
# The name of the file
|
133
133
|
#
|
134
|
-
# @param [String]
|
134
|
+
# @param [String] content
|
135
135
|
# The content which should be written to the file
|
136
136
|
def write_file(name, content)
|
137
137
|
Aruba.platform.create_file(expand_path(name), content, false)
|
@@ -182,7 +182,7 @@ module Aruba
|
|
182
182
|
end
|
183
183
|
|
184
184
|
raise ArgumentError, "Using a fixture as destination (#{destination}) is not supported" if destination.start_with? aruba.config.fixtures_path_prefix
|
185
|
-
raise ArgumentError,
|
185
|
+
raise ArgumentError, 'Multiples sources can only be copied to a directory' if source.count > 1 && exist?(destination) && !directory?(destination)
|
186
186
|
|
187
187
|
source_paths = source.map { |f| expand_path(f) }
|
188
188
|
destination_path = expand_path(destination)
|
@@ -228,7 +228,7 @@ module Aruba
|
|
228
228
|
raise ArgumentError, %(The following source "#{s}" does not exist.) unless exist? s
|
229
229
|
end
|
230
230
|
|
231
|
-
raise ArgumentError,
|
231
|
+
raise ArgumentError, 'Multiple sources can only be copied to a directory' if source.count > 1 && exist?(destination) && !directory?(destination)
|
232
232
|
|
233
233
|
source_paths = source.map { |f| expand_path(f) }
|
234
234
|
destination_path = expand_path(destination)
|
@@ -252,10 +252,10 @@ module Aruba
|
|
252
252
|
# The method does not check if file already exists. If the file name is a
|
253
253
|
# path the method will create all neccessary directories.
|
254
254
|
#
|
255
|
-
# @param [String]
|
255
|
+
# @param [String] name
|
256
256
|
# The name of the file
|
257
257
|
#
|
258
|
-
# @param [Integer]
|
258
|
+
# @param [Integer] size
|
259
259
|
# The size of the file
|
260
260
|
def write_fixed_size_file(name, size)
|
261
261
|
Aruba.platform.create_fixed_size_file(expand_path(name), size, false)
|
@@ -297,8 +297,8 @@ module Aruba
|
|
297
297
|
mode
|
298
298
|
end
|
299
299
|
|
300
|
-
args.each { |
|
301
|
-
paths = args.map { |
|
300
|
+
args.each { |path| raise "Expected #{path} to be present" unless exist?(path) }
|
301
|
+
paths = args.map { |path| expand_path(path) }
|
302
302
|
|
303
303
|
Aruba.platform.chmod(mode, paths, options)
|
304
304
|
|
@@ -342,7 +342,7 @@ module Aruba
|
|
342
342
|
{}
|
343
343
|
end
|
344
344
|
|
345
|
-
args = args.map { |
|
345
|
+
args = args.map { |path| expand_path(path) }
|
346
346
|
|
347
347
|
Aruba.platform.rm(args, options)
|
348
348
|
end
|
@@ -354,7 +354,7 @@ module Aruba
|
|
354
354
|
#
|
355
355
|
# @yield
|
356
356
|
# Pass the content of the given file to this block
|
357
|
-
def with_file_content(file
|
357
|
+
def with_file_content(file)
|
358
358
|
expect(file).to be_an_existing_path
|
359
359
|
|
360
360
|
content = read(file).join("\n")
|
@@ -370,12 +370,11 @@ module Aruba
|
|
370
370
|
# @param [Array, Path] paths
|
371
371
|
# The paths
|
372
372
|
#
|
373
|
-
# @
|
373
|
+
# @return [FileSize]
|
374
374
|
# Bytes on disk
|
375
|
-
|
376
375
|
def disk_usage(*paths)
|
377
376
|
expect(paths.flatten).to Aruba::Matchers.all be_an_existing_path
|
378
|
-
expanded = paths.flatten.map { |
|
377
|
+
expanded = paths.flatten.map { |path| ArubaPath.new(expand_path(path)) }
|
379
378
|
|
380
379
|
# TODO: change the API so that you could set something like
|
381
380
|
# aruba.config.fs_allocation_unit_size directly
|
@@ -395,6 +394,9 @@ module Aruba
|
|
395
394
|
|
396
395
|
# Get size of file
|
397
396
|
#
|
397
|
+
# @param [String] name
|
398
|
+
# File name
|
399
|
+
#
|
398
400
|
# @return [Numeric]
|
399
401
|
# The size of the file
|
400
402
|
def file_size(name)
|
data/lib/aruba/api/text.rb
CHANGED
@@ -22,11 +22,7 @@ module Aruba
|
|
22
22
|
# @param [#to_s] text
|
23
23
|
# Input
|
24
24
|
def extract_text(text)
|
25
|
-
|
26
|
-
text.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '')
|
27
|
-
else
|
28
|
-
text.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '').gsub(/\\\[|\\\]/, '').gsub(/\007|\016|\017/, '')
|
29
|
-
end
|
25
|
+
text.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '').gsub(/\\\[|\\\]/, '').gsub(/\007|\016|\017/, '')
|
30
26
|
end
|
31
27
|
|
32
28
|
# Unescape special characters and remove ANSI characters
|
@@ -35,14 +31,12 @@ module Aruba
|
|
35
31
|
# The text to sanitize
|
36
32
|
def sanitize_text(text)
|
37
33
|
text = unescape_text(text)
|
38
|
-
text = extract_text(text) if
|
34
|
+
text = extract_text(text) if aruba.config.remove_ansi_escape_sequences
|
39
35
|
|
40
36
|
text.chomp
|
41
37
|
end
|
42
38
|
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# Replace variables in command string
|
39
|
+
# Replace variables in command string (experimental)
|
46
40
|
#
|
47
41
|
# @param [#to_s] text
|
48
42
|
# The text to parse
|
data/lib/aruba/aruba_path.rb
CHANGED
@@ -48,8 +48,7 @@ module Aruba
|
|
48
48
|
# @example
|
49
49
|
# path = ArubaPath.new 'path/to/dir.d'
|
50
50
|
# path.pop
|
51
|
-
# puts path
|
52
|
-
# # => path/to
|
51
|
+
# puts path # => path/to
|
53
52
|
def pop
|
54
53
|
@delegate_sd_obj.pop
|
55
54
|
end
|
@@ -60,9 +59,8 @@ module Aruba
|
|
60
59
|
# The count of file name parts
|
61
60
|
#
|
62
61
|
# @example
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# path.depth # => 3
|
62
|
+
# path = ArubaPath.new('path/to/file.txt')
|
63
|
+
# path.depth # => 3
|
66
64
|
#
|
67
65
|
def depth
|
68
66
|
__getobj__.each_filename.to_a.size
|
@@ -91,19 +89,6 @@ module Aruba
|
|
91
89
|
to_s[index]
|
92
90
|
end
|
93
91
|
|
94
|
-
# Report count of blocks allocated on disk
|
95
|
-
#
|
96
|
-
# This reports the amount of blocks which are allocated by the path.
|
97
|
-
#
|
98
|
-
# @return [Integer]
|
99
|
-
# The count of blocks on disk
|
100
|
-
#
|
101
|
-
# @deprecated
|
102
|
-
def blocks
|
103
|
-
min_bytes_used = minimum_disk_space_used
|
104
|
-
min_bytes_used / Aruba.config.physical_block_size
|
105
|
-
end
|
106
|
-
|
107
92
|
# TODO: Aruba.config.physical_block_size could be allowed to be nil
|
108
93
|
# (So the unit size can be autodetected)
|
109
94
|
|
@@ -72,7 +72,7 @@ module Aruba
|
|
72
72
|
define_method("#{name}=") { |v| find_option(name).value = v }
|
73
73
|
|
74
74
|
# Add reader
|
75
|
-
option_reader name, :
|
75
|
+
option_reader name, contract: { None => contract.values.first }
|
76
76
|
end
|
77
77
|
|
78
78
|
private
|
@@ -80,7 +80,7 @@ module Aruba
|
|
80
80
|
def add_option(name, value = nil)
|
81
81
|
return if known_options.key?(name)
|
82
82
|
|
83
|
-
known_options[name] = Option.new(:
|
83
|
+
known_options[name] = Option.new(name: name, value: value)
|
84
84
|
|
85
85
|
self
|
86
86
|
end
|
@@ -114,29 +114,13 @@ module Aruba
|
|
114
114
|
|
115
115
|
# Make deep dup copy of configuration
|
116
116
|
def make_copy
|
117
|
-
obj =
|
117
|
+
obj = dup
|
118
118
|
obj.local_options = Marshal.load(Marshal.dump(local_options))
|
119
119
|
obj.hooks = @hooks
|
120
120
|
|
121
121
|
obj
|
122
122
|
end
|
123
123
|
|
124
|
-
# Get access to hooks
|
125
|
-
def hooks
|
126
|
-
# rubocop:disable Metrics/LineLength
|
127
|
-
Aruba.platform.deprecated 'The use of the "#aruba.config.hooks" is deprecated. Please use "#aruba.config.before(:name) {}" to define and "#aruba.config.before(:name, *args)" to run a hook. This method will become private in the next major version.'
|
128
|
-
# rubocop:enable Metrics/LineLength
|
129
|
-
|
130
|
-
@hooks
|
131
|
-
end
|
132
|
-
|
133
|
-
# @deprecated
|
134
|
-
def before_cmd(&block)
|
135
|
-
Aruba.platform.deprecated 'The use of the "#before_cmd"-hook is deprecated. Please define with "#before(:command) {}" instead'
|
136
|
-
|
137
|
-
before(:command, &block)
|
138
|
-
end
|
139
|
-
|
140
124
|
# Define or run before-hook
|
141
125
|
#
|
142
126
|
# @param [Symbol, String] name
|
data/lib/aruba/cli.rb
CHANGED
@@ -18,7 +18,7 @@ module Aruba
|
|
18
18
|
end
|
19
19
|
|
20
20
|
desc 'init', 'Initialize aruba'
|
21
|
-
option :test_framework, :
|
21
|
+
option :test_framework, default: 'cucumber', enum: %w(cucumber rspec minitest), desc: 'Choose which test framework to use'
|
22
22
|
def init
|
23
23
|
Aruba::Initializer.new.call(options[:test_framework])
|
24
24
|
end
|
data/lib/aruba/colorizer.rb
CHANGED
@@ -4,34 +4,34 @@ module Aruba
|
|
4
4
|
module AnsiColor
|
5
5
|
# :stopdoc:
|
6
6
|
ATTRIBUTES = [
|
7
|
-
[
|
8
|
-
[
|
9
|
-
[
|
10
|
-
[
|
11
|
-
[
|
12
|
-
[
|
13
|
-
[
|
14
|
-
[
|
15
|
-
[
|
16
|
-
[
|
17
|
-
[
|
18
|
-
[
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
22
|
-
[
|
23
|
-
[
|
24
|
-
[
|
25
|
-
[
|
26
|
-
[
|
27
|
-
[
|
28
|
-
[
|
29
|
-
[
|
30
|
-
[
|
31
|
-
[
|
32
|
-
[
|
33
|
-
[
|
34
|
-
[
|
7
|
+
[:clear, 0],
|
8
|
+
[:reset, 0], # synonym for :clear
|
9
|
+
[:bold, 1],
|
10
|
+
[:dark, 2],
|
11
|
+
[:italic, 3], # not widely implemented
|
12
|
+
[:underline, 4],
|
13
|
+
[:underscore, 4], # synonym for :underline
|
14
|
+
[:blink, 5],
|
15
|
+
[:rapid_blink, 6], # not widely implemented
|
16
|
+
[:negative, 7], # no reverse because of String#reverse
|
17
|
+
[:concealed, 8],
|
18
|
+
[:strikethrough, 9], # not widely implemented
|
19
|
+
[:black, 30],
|
20
|
+
[:red, 31],
|
21
|
+
[:green, 32],
|
22
|
+
[:yellow, 33],
|
23
|
+
[:blue, 34],
|
24
|
+
[:magenta, 35],
|
25
|
+
[:cyan, 36],
|
26
|
+
[:white, 37],
|
27
|
+
[:on_black, 40],
|
28
|
+
[:on_red, 41],
|
29
|
+
[:on_green, 42],
|
30
|
+
[:on_yellow, 43],
|
31
|
+
[:on_blue, 44],
|
32
|
+
[:on_magenta, 45],
|
33
|
+
[:on_cyan, 46],
|
34
|
+
[:on_white, 47]
|
35
35
|
].freeze
|
36
36
|
|
37
37
|
ATTRIBUTE_NAMES = ATTRIBUTES.transpose.first
|
@@ -62,7 +62,7 @@ module Aruba
|
|
62
62
|
elsif respond_to?(:to_str)
|
63
63
|
result << to_str
|
64
64
|
else
|
65
|
-
return result #only switch on
|
65
|
+
return result # only switch on
|
66
66
|
end
|
67
67
|
result << "\e[0m" if Aruba::AnsiColor.coloring?
|
68
68
|
result
|
@@ -74,10 +74,10 @@ module Aruba
|
|
74
74
|
COLORED_REGEXP = /\e\[(?:[34][0-7]|[0-9])?m/
|
75
75
|
|
76
76
|
def self.included(klass)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
return unless klass == String
|
78
|
+
|
79
|
+
ATTRIBUTES.delete(:clear)
|
80
|
+
ATTRIBUTE_NAMES.delete(:clear)
|
81
81
|
end
|
82
82
|
|
83
83
|
# Returns an uncolored version of the string, that is all
|