aruba 1.0.0.pre.alpha.2 → 1.0.0.pre.alpha.3

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 (113) hide show
  1. checksums.yaml +5 -5
  2. data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
  3. data/.rubocop.yml +6 -181
  4. data/.rubocop_todo.yml +364 -0
  5. data/.travis.yml +63 -34
  6. data/.yardopts +3 -0
  7. data/CHANGELOG.md +1121 -0
  8. data/CONTRIBUTING.md +179 -78
  9. data/Gemfile +29 -44
  10. data/README.md +41 -11
  11. data/Rakefile +35 -35
  12. data/appveyor.yml +6 -5
  13. data/aruba.gemspec +14 -16
  14. data/bin/console +2 -11
  15. data/cucumber.yml +0 -7
  16. data/fixtures/cli-app/README.md +1 -1
  17. data/fixtures/cli-app/Rakefile +1 -1
  18. data/fixtures/cli-app/cli-app.gemspec +1 -0
  19. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
  20. data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
  21. data/fixtures/empty-app/Rakefile +1 -1
  22. data/fixtures/empty-app/cli-app.gemspec +1 -0
  23. data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
  24. data/fixtures/getting-started-app/Gemfile +1 -1
  25. data/lib/aruba/api.rb +3 -10
  26. data/lib/aruba/api/bundler.rb +16 -0
  27. data/lib/aruba/api/commands.rb +249 -0
  28. data/lib/aruba/api/core.rb +24 -10
  29. data/lib/aruba/api/environment.rb +12 -7
  30. data/lib/aruba/api/filesystem.rb +22 -20
  31. data/lib/aruba/api/text.rb +3 -9
  32. data/lib/aruba/aruba_path.rb +3 -18
  33. data/lib/aruba/basic_configuration.rb +3 -19
  34. data/lib/aruba/cli.rb +1 -1
  35. data/lib/aruba/colorizer.rb +33 -33
  36. data/lib/aruba/command.rb +4 -0
  37. data/lib/aruba/config_wrapper.rb +1 -1
  38. data/lib/aruba/configuration.rb +78 -0
  39. data/lib/aruba/console.rb +5 -5
  40. data/lib/aruba/console/help.rb +1 -1
  41. data/lib/aruba/cucumber.rb +0 -1
  42. data/lib/aruba/cucumber/command.rb +55 -115
  43. data/lib/aruba/cucumber/environment.rb +1 -1
  44. data/lib/aruba/cucumber/file.rb +9 -21
  45. data/lib/aruba/cucumber/hooks.rb +6 -62
  46. data/lib/aruba/event_bus/name_resolver.rb +1 -2
  47. data/lib/aruba/hooks.rb +1 -1
  48. data/lib/aruba/initializer.rb +3 -3
  49. data/lib/aruba/matchers/base/base_matcher.rb +2 -2
  50. data/lib/aruba/matchers/base/message_indenter.rb +19 -0
  51. data/lib/aruba/matchers/base/object_formatter.rb +2 -2
  52. data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
  53. data/lib/aruba/matchers/command/be_successfully_executed.rb +2 -4
  54. data/lib/aruba/matchers/command/have_exit_status.rb +1 -1
  55. data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -4
  56. data/lib/aruba/matchers/command/have_output.rb +9 -4
  57. data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -1
  58. data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
  59. data/lib/aruba/matchers/command/have_output_size.rb +1 -1
  60. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +4 -6
  61. data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
  62. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
  63. data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
  64. data/lib/aruba/matchers/file/be_an_existing_file.rb +4 -6
  65. data/lib/aruba/matchers/file/have_file_content.rb +4 -4
  66. data/lib/aruba/matchers/file/have_file_size.rb +6 -8
  67. data/lib/aruba/matchers/file/have_same_file_content.rb +9 -12
  68. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
  69. data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
  70. data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
  71. data/lib/aruba/matchers/path/have_permissions.rb +6 -8
  72. data/lib/aruba/matchers/string/include_output_string.rb +8 -10
  73. data/lib/aruba/matchers/string/match_output_string.rb +9 -11
  74. data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
  75. data/lib/aruba/platform.rb +0 -1
  76. data/lib/aruba/platforms/announcer.rb +26 -70
  77. data/lib/aruba/platforms/aruba_file_creator.rb +1 -1
  78. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
  79. data/lib/aruba/platforms/aruba_logger.rb +22 -2
  80. data/lib/aruba/platforms/command_monitor.rb +2 -125
  81. data/lib/aruba/platforms/filesystem_status.rb +9 -9
  82. data/lib/aruba/platforms/local_environment.rb +2 -2
  83. data/lib/aruba/platforms/simple_table.rb +3 -3
  84. data/lib/aruba/platforms/unix_command_string.rb +7 -4
  85. data/lib/aruba/platforms/unix_environment_variables.rb +9 -13
  86. data/lib/aruba/platforms/unix_platform.rb +2 -27
  87. data/lib/aruba/platforms/unix_which.rb +2 -1
  88. data/lib/aruba/platforms/windows_command_string.rb +20 -7
  89. data/lib/aruba/platforms/windows_environment_variables.rb +35 -30
  90. data/lib/aruba/platforms/windows_which.rb +4 -3
  91. data/lib/aruba/processes/basic_process.rb +11 -15
  92. data/lib/aruba/processes/debug_process.rb +5 -0
  93. data/lib/aruba/processes/in_process.rb +17 -8
  94. data/lib/aruba/processes/spawn_process.rb +35 -23
  95. data/lib/aruba/rspec.rb +9 -22
  96. data/lib/aruba/runtime.rb +7 -5
  97. data/lib/aruba/setup.rb +6 -4
  98. data/lib/aruba/tasks/docker_helpers.rb +1 -1
  99. data/lib/aruba/version.rb +1 -1
  100. metadata +37 -57
  101. data/History.md +0 -612
  102. data/bin/bootstrap +0 -34
  103. data/fixtures/spawn_process/stderr.sh +0 -3
  104. data/lib/aruba/api/command.rb +0 -309
  105. data/lib/aruba/api/deprecated.rb +0 -895
  106. data/lib/aruba/api/rvm.rb +0 -44
  107. data/lib/aruba/config.rb +0 -101
  108. data/lib/aruba/cucumber/rvm.rb +0 -3
  109. data/lib/aruba/in_process.rb +0 -14
  110. data/lib/aruba/jruby.rb +0 -4
  111. data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
  112. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
  113. data/lib/aruba/spawn_process.rb +0 -11
@@ -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(:old => old_directory, :new => new_directory)
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(:old => old_directory, :new => new_directory)
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
- aruba.logger.warn %(`aruba`'s working directory does not exist. Maybe you forgot to run `setup_aruba` before using it's API. This warning will be an error from 1.0.0) unless Aruba.platform.directory? File.join(aruba.config.root_directory, aruba.config.working_directory)
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 '~' == prefix
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
- ArubaPath.new(File.join(*[directory, dir_string, file_name].compact)).expand_path.to_s
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 Metrics/CyclomaticComplexity
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(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => value })
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(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => value })
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(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => value })
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] key
77
+ # @param [String] name
72
78
  # The name of the environment variable as string, e.g. 'HOME'
73
79
  #
74
- # @param [String] value
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(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => '' })
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
@@ -40,8 +40,10 @@ module Aruba
40
40
 
41
41
  # Check if file exist and is executable
42
42
  #
43
- # @param [String] file
44
- # The file which should exist
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 [TrueClass, FalseClass]
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 [TrueClass, FalseClass]
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 { |p| expand_path(p) }
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] file_name
131
+ # @param [String] name
132
132
  # The name of the file
133
133
  #
134
- # @param [String] file_content
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, "Multiples sources can only be copied to a directory" if source.count > 1 && exist?(destination) && !directory?(destination)
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, "Multiple sources can only be copied to a directory" if source.count > 1 && exist?(destination) && !directory?(destination)
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] file_name
255
+ # @param [String] name
256
256
  # The name of the file
257
257
  #
258
- # @param [Integer] file_size
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 { |p| raise "Expected #{p} to be present" unless exist?(p) }
301
- paths = args.map { |p| expand_path(p) }
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 { |p| expand_path(p) }
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, &block)
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
- # @result [FileSize]
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 { |p| ArubaPath.new(expand_path(p)) }
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)
@@ -22,11 +22,7 @@ module Aruba
22
22
  # @param [#to_s] text
23
23
  # Input
24
24
  def extract_text(text)
25
- if Aruba::VERSION < '1'
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 !aruba.config.keep_ansi || aruba.config.remove_ansi_escape_sequences
34
+ text = extract_text(text) if aruba.config.remove_ansi_escape_sequences
39
35
 
40
36
  text.chomp
41
37
  end
42
38
 
43
- # @experimental
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
@@ -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
- # path = ArubaPath.new('path/to/file.txt')
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, :contract => { None => contract.values.first }
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(:name => name, :value => value)
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 = self.dup
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
@@ -18,7 +18,7 @@ module Aruba
18
18
  end
19
19
 
20
20
  desc 'init', 'Initialize aruba'
21
- option :test_framework, :default => 'cucumber', :enum => %w(cucumber rspec minitest), :desc => 'Choose which test framework to use'
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
@@ -4,34 +4,34 @@ module Aruba
4
4
  module AnsiColor
5
5
  # :stopdoc:
6
6
  ATTRIBUTES = [
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 ]
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
- if klass == String
78
- ATTRIBUTES.delete(:clear)
79
- ATTRIBUTE_NAMES.delete(:clear)
80
- end
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