aruba 1.0.0.pre.alpha.5 → 1.0.4

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 (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +153 -28
  3. data/CONTRIBUTING.md +0 -9
  4. data/LICENSE +1 -1
  5. data/README.md +37 -30
  6. data/lib/aruba/api.rb +0 -1
  7. data/lib/aruba/api/bundler.rb +17 -2
  8. data/lib/aruba/api/commands.rb +15 -16
  9. data/lib/aruba/api/core.rb +64 -50
  10. data/lib/aruba/api/environment.rb +12 -4
  11. data/lib/aruba/api/filesystem.rb +32 -46
  12. data/lib/aruba/api/text.rb +15 -3
  13. data/lib/aruba/aruba_path.rb +23 -95
  14. data/lib/aruba/basic_configuration.rb +46 -65
  15. data/lib/aruba/basic_configuration/option.rb +2 -2
  16. data/lib/aruba/cli.rb +4 -1
  17. data/lib/aruba/config/jruby.rb +1 -1
  18. data/lib/aruba/config_wrapper.rb +17 -4
  19. data/lib/aruba/configuration.rb +29 -22
  20. data/lib/aruba/console.rb +0 -2
  21. data/lib/aruba/console/help.rb +8 -5
  22. data/lib/aruba/contracts/absolute_path.rb +3 -3
  23. data/lib/aruba/contracts/is_power_of_two.rb +2 -2
  24. data/lib/aruba/contracts/relative_path.rb +3 -3
  25. data/lib/aruba/cucumber/command.rb +93 -82
  26. data/lib/aruba/cucumber/file.rb +43 -23
  27. data/lib/aruba/cucumber/hooks.rb +4 -1
  28. data/lib/aruba/cucumber/testing_frameworks.rb +14 -12
  29. data/lib/aruba/event_bus.rb +4 -2
  30. data/lib/aruba/event_bus/name_resolver.rb +9 -8
  31. data/lib/aruba/events.rb +2 -1
  32. data/lib/aruba/hooks.rb +2 -4
  33. data/lib/aruba/in_config_wrapper.rb +8 -5
  34. data/lib/aruba/initializer.rb +9 -3
  35. data/lib/aruba/matchers/base/base_matcher.rb +2 -11
  36. data/lib/aruba/matchers/base/message_indenter.rb +1 -1
  37. data/lib/aruba/matchers/base/object_formatter.rb +0 -5
  38. data/lib/aruba/matchers/collection/include_an_object.rb +4 -4
  39. data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -1
  40. data/lib/aruba/matchers/command/have_exit_status.rb +3 -1
  41. data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -1
  42. data/lib/aruba/matchers/command/have_output.rb +3 -1
  43. data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
  44. data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
  45. data/lib/aruba/matchers/directory/have_sub_directory.rb +8 -3
  46. data/lib/aruba/matchers/file/have_file_size.rb +4 -2
  47. data/lib/aruba/matchers/path/have_permissions.rb +7 -4
  48. data/lib/aruba/platforms/announcer.rb +25 -11
  49. data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
  50. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
  51. data/lib/aruba/platforms/aruba_logger.rb +10 -9
  52. data/lib/aruba/platforms/command_monitor.rb +4 -6
  53. data/lib/aruba/platforms/determine_disk_usage.rb +55 -20
  54. data/lib/aruba/platforms/filesystem_status.rb +19 -13
  55. data/lib/aruba/platforms/simple_table.rb +2 -2
  56. data/lib/aruba/platforms/unix_environment_variables.rb +9 -4
  57. data/lib/aruba/platforms/unix_platform.rb +10 -10
  58. data/lib/aruba/platforms/unix_which.rb +1 -1
  59. data/lib/aruba/platforms/windows_command_string.rb +1 -1
  60. data/lib/aruba/platforms/windows_environment_variables.rb +2 -1
  61. data/lib/aruba/platforms/windows_platform.rb +3 -3
  62. data/lib/aruba/platforms/windows_which.rb +6 -2
  63. data/lib/aruba/processes/basic_process.rb +4 -6
  64. data/lib/aruba/processes/debug_process.rb +4 -2
  65. data/lib/aruba/processes/in_process.rb +5 -3
  66. data/lib/aruba/processes/spawn_process.rb +27 -16
  67. data/lib/aruba/rspec.rb +25 -15
  68. data/lib/aruba/runtime.rb +11 -4
  69. data/lib/aruba/setup.rb +23 -10
  70. data/lib/aruba/tasks/docker_helpers.rb +3 -1
  71. data/lib/aruba/version.rb +1 -1
  72. metadata +96 -109
  73. data/.cucumberproignore +0 -3
  74. data/.document +0 -5
  75. data/.github/ISSUE_TEMPLATE.md +0 -48
  76. data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
  77. data/.gitignore +0 -38
  78. data/.rspec +0 -3
  79. data/.rubocop.yml +0 -31
  80. data/.rubocop_todo.yml +0 -258
  81. data/.simplecov +0 -34
  82. data/.travis.yml +0 -73
  83. data/.yardopts +0 -11
  84. data/Dockerfile +0 -67
  85. data/Gemfile +0 -15
  86. data/Rakefile +0 -92
  87. data/TODO.md +0 -13
  88. data/appveyor.yml +0 -30
  89. data/aruba.gemspec +0 -46
  90. data/bin/console +0 -7
  91. data/bin/test +0 -9
  92. data/config/.gitignore +0 -1
  93. data/cucumber.yml +0 -6
  94. data/docker-compose.yml +0 -26
  95. data/fixtures/cli-app/.gitignore +0 -9
  96. data/fixtures/cli-app/.rspec +0 -2
  97. data/fixtures/cli-app/README.md +0 -39
  98. data/fixtures/cli-app/Rakefile +0 -1
  99. data/fixtures/cli-app/bin/aruba-test-cli +0 -6
  100. data/fixtures/cli-app/cli-app.gemspec +0 -25
  101. data/fixtures/cli-app/features/support/aruba.rb +0 -1
  102. data/fixtures/cli-app/features/support/env.rb +0 -1
  103. data/fixtures/cli-app/lib/cli/app.rb +0 -9
  104. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
  105. data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
  106. data/fixtures/cli-app/script/console +0 -14
  107. data/fixtures/cli-app/spec/spec_helper.rb +0 -7
  108. data/fixtures/cli-app/spec/support/aruba.rb +0 -1
  109. data/fixtures/copy/file.txt +0 -1
  110. data/fixtures/empty-app/.gitignore +0 -9
  111. data/fixtures/empty-app/.rspec +0 -2
  112. data/fixtures/empty-app/README.md +0 -24
  113. data/fixtures/empty-app/Rakefile +0 -1
  114. data/fixtures/empty-app/cli-app.gemspec +0 -25
  115. data/fixtures/empty-app/lib/cli/app.rb +0 -7
  116. data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
  117. data/fixtures/getting-started-app/.gitignore +0 -4
  118. data/fixtures/getting-started-app/Gemfile +0 -4
  119. data/fixtures/getting-started-app/README.md +0 -3
  120. data/fixtures/getting-started-app/features/support/env.rb +0 -1
  121. data/lib/aruba/extensions/string/strip.rb +0 -25
  122. data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
@@ -1,28 +1,34 @@
1
- require 'forwardable'
2
-
3
1
  module Aruba
4
2
  module Platforms
5
3
  # File System Status object
6
4
  #
7
5
  # This is a wrapper for File::Stat returning only a subset of information.
8
6
  class FilesystemStatus
9
- METHODS = [
10
- :executable?,
11
- :ctime,
12
- :atime,
13
- :mtime,
14
- :size
15
- ].freeze
16
-
17
- extend Forwardable
18
-
19
7
  private
20
8
 
21
9
  attr_reader :status
22
10
 
23
11
  public
24
12
 
25
- def_delegators :@status, *METHODS
13
+ def executable?
14
+ status.executable?
15
+ end
16
+
17
+ def ctime
18
+ status.ctime
19
+ end
20
+
21
+ def atime
22
+ status.atime
23
+ end
24
+
25
+ def mtime
26
+ status.mtime
27
+ end
28
+
29
+ def size
30
+ status.size
31
+ end
26
32
 
27
33
  def initialize(path)
28
34
  @status = File::Stat.new(path)
@@ -31,8 +31,8 @@ module Aruba
31
31
 
32
32
  name_size = longest_key.length
33
33
 
34
- rows = hash.each_with_object([]) do |(k, v), a|
35
- a << format("# %-#{name_size}s => %s", k, v)
34
+ rows = hash.map do |k, v|
35
+ format("# %-#{name_size}s => %s", k, v)
36
36
  end
37
37
 
38
38
  if opts[:sort] == true
@@ -9,11 +9,9 @@ module Aruba
9
9
  attr_reader :other_env, :block
10
10
 
11
11
  def initialize(other_env, &block)
12
- @other_env = other_env.to_h.each_with_object({}) { |(k, v), a| a[k] = v.to_s }
12
+ @other_env = other_env.to_h.transform_values(&:to_s)
13
13
 
14
- @block = if block_given?
15
- block
16
- end
14
+ @block = block
17
15
  end
18
16
 
19
17
  def call(env)
@@ -188,6 +186,13 @@ module Aruba
188
186
  value
189
187
  end
190
188
 
189
+ def nest
190
+ old_actions = @actions.dup
191
+ yield(self)
192
+ ensure
193
+ @actions = old_actions
194
+ end
195
+
191
196
  def self.hash_from_env
192
197
  ENV.to_hash
193
198
  end
@@ -31,7 +31,7 @@ module Aruba
31
31
  # @private
32
32
  class UnixPlatform
33
33
  def self.match?
34
- !FFI::Platform.windows?
34
+ !Cucumber::WINDOWS
35
35
  end
36
36
 
37
37
  def environment_variables
@@ -62,8 +62,8 @@ module Aruba
62
62
  DetermineFileSize.new.call(*args)
63
63
  end
64
64
 
65
- def determine_disk_usage(*args)
66
- DetermineDiskUsage.new.call(*args)
65
+ def determine_disk_usage(paths)
66
+ DetermineDiskUsage.new.call(paths)
67
67
  end
68
68
 
69
69
  def create_file(*args)
@@ -83,7 +83,7 @@ module Aruba
83
83
  end
84
84
 
85
85
  def detect_ruby(cmd)
86
- if cmd =~ /^ruby\s/
86
+ if /^ruby\s/.match?(cmd)
87
87
  cmd.gsub(/^ruby\s/, "#{current_ruby} ")
88
88
  else
89
89
  cmd
@@ -136,13 +136,13 @@ module Aruba
136
136
  end
137
137
 
138
138
  # Copy file/directory
139
- def cp(args, options)
140
- FileUtils.cp_r(args, options)
139
+ def cp(src, dest)
140
+ FileUtils.cp_r(src, dest)
141
141
  end
142
142
 
143
143
  # Move file/directory
144
- def mv(args, options)
145
- FileUtils.mv(args, options)
144
+ def mv(src, dest)
145
+ FileUtils.mv(src, dest)
146
146
  end
147
147
 
148
148
  # Change mode of file/directory
@@ -195,8 +195,8 @@ module Aruba
195
195
  # * /bin/command.sh
196
196
  # * command.sh
197
197
  def relative_command?(path)
198
- p = ArubaPath.new(path)
199
- p.relative? && p.depth > 1
198
+ p = Pathname.new(path)
199
+ p.relative? && p.basename != p
200
200
  end
201
201
 
202
202
  # Check if command is relative
@@ -13,7 +13,7 @@ module Aruba
13
13
  end
14
14
 
15
15
  def call(program, path)
16
- fail %(Invalid input program "#{program}" and/or path "#{path}".)
16
+ raise %(Invalid input program "#{program}" and/or path "#{path}".)
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ module Aruba
22
22
 
23
23
  def escaped_arguments
24
24
  @arguments.map { |arg| arg.gsub(/"/, '"""') }
25
- .map { |arg| arg =~ / / ? "\"#{arg}\"" : arg }
25
+ .map { |arg| / /.match?(arg) ? "\"#{arg}\"" : arg }
26
26
  end
27
27
 
28
28
  def escaped_command
@@ -16,7 +16,8 @@ module Aruba
16
16
  # C:>set PATH
17
17
  # C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
18
18
  #
19
- # @example If you access environment variables through ENV, you can access values no matter the case of the key:
19
+ # @example If you access environment variables through ENV, you can access
20
+ # values no matter the case of the key:
20
21
  # ENV["Path"] # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
21
22
  # ENV["PATH"] # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
22
23
  #
@@ -1,4 +1,4 @@
1
- require 'ffi'
1
+ require 'cucumber/platform'
2
2
 
3
3
  require 'aruba/platforms/unix_platform'
4
4
  require 'aruba/platforms/windows_command_string'
@@ -20,7 +20,7 @@ module Aruba
20
20
  # @private
21
21
  class WindowsPlatform < UnixPlatform
22
22
  def self.match?
23
- FFI::Platform.windows?
23
+ Cucumber::WINDOWS
24
24
  end
25
25
 
26
26
  # @see UnixPlatform#command_string
@@ -39,7 +39,7 @@ module Aruba
39
39
  end
40
40
 
41
41
  def builtin_shell_commands
42
- ['cd', 'dir', 'echo', 'exit', 'set', 'type']
42
+ %w(cd dir echo exit set type)
43
43
  end
44
44
  end
45
45
  end
@@ -13,7 +13,7 @@ module Aruba
13
13
  end
14
14
 
15
15
  def call(program, path)
16
- fail %(Invalid input program "#{program}" and/or path "#{path}".)
16
+ raise %(Invalid input program "#{program}" and/or path "#{path}".)
17
17
  end
18
18
  end
19
19
 
@@ -96,7 +96,11 @@ module Aruba
96
96
  private
97
97
 
98
98
  def windows_executable_extentions
99
- ENV['PATHEXT'] ? format('.{%s}', ENV['PATHEXT'].tr(';', ',').tr('.', '')).downcase : '.{exe,com,bat}'
99
+ if ENV['PATHEXT']
100
+ format('.{%s}', ENV['PATHEXT'].tr(';', ',').tr('.', '')).downcase
101
+ else
102
+ '.{exe,com,bat}'
103
+ end
100
104
  end
101
105
  end
102
106
  end
@@ -14,7 +14,7 @@ module Aruba
14
14
  attr_reader :exit_status, :environment, :working_directory, :main_class,
15
15
  :io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal
16
16
 
17
- def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
17
+ def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, # rubocop:disable Metrics/ParameterLists
18
18
  environment = Aruba.platform.environment_variables.hash_from_env,
19
19
  main_class = nil, stop_signal = nil, startup_wait_time = 0)
20
20
  @cmd = cmd
@@ -111,10 +111,8 @@ module Aruba
111
111
  def after_run; end
112
112
 
113
113
  def inspect
114
- # rubocop:disable Style/UnneededInterpolation
115
- out = truncate("#{stdout(wait_for_io: 0).inspect}", 35)
116
- err = truncate("#{stderr(wait_for_io: 0).inspect}", 35)
117
- # rubocop:enable Style/UnneededInterpolation
114
+ out = truncate(stdout(wait_for_io: 0).inspect, 35)
115
+ err = truncate(stderr(wait_for_io: 0).inspect, 35)
118
116
 
119
117
  fmt = '#<%s:%s commandline="%s": stdout=%s stderr=%s>'
120
118
  format fmt, self.class, object_id, commandline, out, err
@@ -137,7 +135,7 @@ module Aruba
137
135
  def truncate(string, max_length)
138
136
  return string if string.length <= max_length
139
137
 
140
- string[0, max_length - 1] + ' ...'
138
+ "#{string[0, max_length - 1]} ..."
141
139
  end
142
140
  end
143
141
  end
@@ -41,7 +41,8 @@ module Aruba
41
41
  # @return [String]
42
42
  # A predefined string to make users aware they are using the DebugProcess
43
43
  def stdout(*)
44
- 'This is the debug launcher on STDOUT. If this output is unexpected, please check your setup.'
44
+ 'This is the debug launcher on STDOUT.' \
45
+ ' If this output is unexpected, please check your setup.'
45
46
  end
46
47
 
47
48
  # Return stderr
@@ -49,7 +50,8 @@ module Aruba
49
50
  # @return [String]
50
51
  # A predefined string to make users aware they are using the DebugProcess
51
52
  def stderr(*)
52
- 'This is the debug launcher on STDERR. If this output is unexpected, please check your setup.'
53
+ 'This is the debug launcher on STDERR.' \
54
+ ' If this output is unexpected, please check your setup.'
53
55
  end
54
56
 
55
57
  # Write to nothing
@@ -46,7 +46,7 @@ module Aruba
46
46
  # @private
47
47
  attr_reader :main_class
48
48
 
49
- def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
49
+ def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, # rubocop:disable Metrics/ParameterLists
50
50
  environment = Aruba.platform.environment_variables.hash_from_env,
51
51
  main_class = nil, stop_signal = nil, startup_wait_time = 0)
52
52
  @cmd = cmd
@@ -61,7 +61,7 @@ module Aruba
61
61
 
62
62
  # Start command
63
63
  def start
64
- fail 'You need to call aruba.config.main_class = YourMainClass' unless main_class
64
+ raise 'You need to call aruba.config.main_class = YourMainClass' unless main_class
65
65
 
66
66
  @started = true
67
67
 
@@ -109,7 +109,9 @@ module Aruba
109
109
 
110
110
  # Close io
111
111
  def close_io(name)
112
- fail ArgumentError, 'Only stdin stdout and stderr are allowed to close' unless [:stdin, :stdout, :stderr].include? name
112
+ unless [:stdin, :stdout, :stderr].include? name
113
+ raise ArgumentError, 'Only stdin stdout and stderr are allowed to close'
114
+ end
113
115
 
114
116
  get_instance_variable(name.to_sym).close
115
117
  end
@@ -48,7 +48,7 @@ module Aruba
48
48
  #
49
49
  # @param [Numeric] startup_wait_time
50
50
  # The amount of seconds to wait after Aruba has started a command.
51
- def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
51
+ def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, # rubocop:disable Metrics/ParameterLists
52
52
  environment = Aruba.platform.environment_variables.hash_from_env,
53
53
  main_class = nil, stop_signal = nil, startup_wait_time = 0)
54
54
  super
@@ -63,16 +63,15 @@ module Aruba
63
63
  # @yield [SpawnProcess]
64
64
  # Run code for process which was started
65
65
  #
66
- # rubocop:disable Metrics/MethodLength
67
66
  def start
68
- # rubocop:disable Metrics/LineLength
69
67
  if started?
70
- error_message = %(Command "#{commandline}" has already been started. Please `#stop` the command first and `#start` it again. Alternatively use `#restart`.\n#{caller.join("\n")})
71
- fail CommandAlreadyStartedError, error_message
68
+ error_message =
69
+ "Command \"#{commandline}\" has already been started." \
70
+ ' Please `#stop` the command first and `#start` it again.' \
71
+ ' Alternatively use `#restart`.'
72
+ raise CommandAlreadyStartedError, error_message
72
73
  end
73
74
 
74
- # rubocop:enable Metrics/LineLength
75
-
76
75
  @started = true
77
76
 
78
77
  @process = ChildProcess.build(*command_string.to_a)
@@ -204,18 +203,19 @@ module Aruba
204
203
  # ... and set the exit status
205
204
  wait
206
205
  else
207
- @process.stop
206
+ begin
207
+ @process.stop
208
+ rescue Errno::EPERM # This can occur on MacOS
209
+ nil
210
+ end
208
211
  end
209
212
  end
210
213
 
211
- @exit_status = @process.exit_code
212
-
214
+ @exit_status = @process.exit_code
215
+
213
216
  @stdout_cache = read_temporary_output_file @stdout_file
214
217
  @stderr_cache = read_temporary_output_file @stderr_file
215
218
 
216
- # @stdout_file = nil
217
- # @stderr_file = nil
218
-
219
219
  @started = false
220
220
 
221
221
  @exit_status
@@ -234,7 +234,7 @@ module Aruba
234
234
  # The signal, i.e. 'TERM'
235
235
  def send_signal(signal)
236
236
  error_message = %(Command "#{commandline}" with PID "#{pid}" has already stopped.)
237
- fail CommandAlreadyStoppedError, error_message if @process.exited?
237
+ raise CommandAlreadyStoppedError, error_message if @process.exited?
238
238
 
239
239
  Process.kill signal, pid
240
240
  rescue Errno::ESRCH
@@ -265,12 +265,23 @@ module Aruba
265
265
  private
266
266
 
267
267
  def command_string
268
- fail LaunchError, %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".) if command_path.nil?
268
+ if command_path.nil?
269
+ raise LaunchError,
270
+ %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".)
271
+ end
272
+
269
273
  Aruba.platform.command_string.new(command_path, *arguments)
270
274
  end
271
275
 
272
276
  def command_path
273
- @command_path ||= (Aruba.platform.builtin_shell_commands.include?(command) ? command : Aruba.platform.which(command, environment['PATH']))
277
+ @command_path ||=
278
+ begin
279
+ if Aruba.platform.builtin_shell_commands.include?(command)
280
+ command
281
+ else
282
+ Aruba.platform.which(command, environment['PATH'])
283
+ end
284
+ end
274
285
  end
275
286
 
276
287
  def wait_for_io(time_to_wait)
@@ -13,8 +13,10 @@ RSpec.configure do |config|
13
13
  setup_aruba
14
14
 
15
15
  # Modify PATH to include project/bin
16
- prepend_environment_variable 'PATH',
17
- aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
16
+ prepend_environment_variable(
17
+ 'PATH',
18
+ aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
19
+ )
18
20
 
19
21
  # Use configured home directory as HOME
20
22
  set_environment_variable 'HOME', aruba.config.home_directory
@@ -47,19 +49,27 @@ RSpec.configure do |config|
47
49
  config.before :each do |example|
48
50
  next unless self.class.include?(Aruba::Api)
49
51
 
50
- aruba.announcer.activate(:full_environment) if example.metadata[:announce_full_environment]
51
- aruba.announcer.activate(:changed_environment) if example.metadata[:announce_changed_environment]
52
-
53
- aruba.announcer.activate(:command) if example.metadata[:announce_command]
54
- aruba.announcer.activate(:directory) if example.metadata[:announce_directory]
55
- aruba.announcer.activate(:full_environment) if example.metadata[:announce_full_environment]
56
- aruba.announcer.activate(:stderr) if example.metadata[:announce_stderr]
57
- aruba.announcer.activate(:stdout) if example.metadata[:announce_stdout]
58
- aruba.announcer.activate(:stop_signal) if example.metadata[:announce_stop_signal]
59
- aruba.announcer.activate(:timeout) if example.metadata[:announce_timeout]
60
- aruba.announcer.activate(:wait_time) if example.metadata[:announce_wait_time]
61
- aruba.announcer.activate(:command_content) if example.metadata[:announce_command_content]
62
- aruba.announcer.activate(:command_filesystem_status) if example.metadata[:announce_command_filesystem_status]
52
+ if example.metadata[:announce_full_environment]
53
+ aruba.announcer.activate(:full_environment)
54
+ end
55
+ if example.metadata[:announce_changed_environment]
56
+ aruba.announcer.activate(:changed_environment)
57
+ end
58
+
59
+ aruba.announcer.activate(:command) if example.metadata[:announce_command]
60
+ aruba.announcer.activate(:directory) if example.metadata[:announce_directory]
61
+ if example.metadata[:announce_full_environment]
62
+ aruba.announcer.activate(:full_environment)
63
+ end
64
+ aruba.announcer.activate(:stderr) if example.metadata[:announce_stderr]
65
+ aruba.announcer.activate(:stdout) if example.metadata[:announce_stdout]
66
+ aruba.announcer.activate(:stop_signal) if example.metadata[:announce_stop_signal]
67
+ aruba.announcer.activate(:timeout) if example.metadata[:announce_timeout]
68
+ aruba.announcer.activate(:wait_time) if example.metadata[:announce_wait_time]
69
+ aruba.announcer.activate(:command_content) if example.metadata[:announce_command_content]
70
+ if example.metadata[:announce_command_filesystem_status]
71
+ aruba.announcer.activate(:command_filesystem_status)
72
+ end
63
73
 
64
74
  if example.metadata[:announce_output]
65
75
  aruba.announcer.activate(:stderr)
@@ -42,14 +42,16 @@ module Aruba
42
42
  def initialize(opts = {})
43
43
  @event_bus = EventBus.new(EventBus::NameResolver.new(Aruba::Events))
44
44
  @announcer = opts.fetch(:announcer, Aruba.platform.announcer.new)
45
- @config = opts.fetch(:config, ConfigWrapper.new(Aruba.config.make_copy, @event_bus))
45
+ @config = opts.fetch(:config,
46
+ ConfigWrapper.new(Aruba.config.make_copy, @event_bus))
46
47
  @environment = opts.fetch(:environment, Aruba.platform.environment_variables.new)
47
48
  @current_directory = ArubaPath.new(@config.working_directory)
48
49
  @root_directory = ArubaPath.new(@config.root_directory)
49
50
 
50
51
  @environment.update(@config.command_runtime_environment)
51
52
 
52
- @command_monitor = opts.fetch(:command_monitor, Aruba.platform.command_monitor.new(announcer: @announcer))
53
+ @command_monitor = opts.fetch(:command_monitor,
54
+ Aruba.platform.command_monitor.new(announcer: @announcer))
53
55
 
54
56
  @logger = opts.fetch(:logger, Aruba.platform.logger.new)
55
57
  @logger.mode = @config.log_level
@@ -81,12 +83,17 @@ module Aruba
81
83
  candidates = config.fixtures_directories.map { |dir| File.join(root_directory, dir) }
82
84
  directory = candidates.find { |d| Aruba.platform.directory? d }
83
85
 
84
- fail "No existing fixtures directory found in #{candidates.map { |d| format('"%s"', d) }.join(', ')}." unless directory
86
+ unless directory
87
+ canditates_display = candidates.map { |d| format('"%s"', d) }.join(', ')
88
+ raise "No existing fixtures directory found in #{canditates_display}."
89
+ end
85
90
 
86
91
  directory
87
92
  end
88
93
 
89
- fail %(Fixtures directory "#{@fixtures_directory}" is not a directory) unless Aruba.platform.directory?(@fixtures_directory)
94
+ unless Aruba.platform.directory?(@fixtures_directory)
95
+ raise %(Fixtures directory "#{@fixtures_directory}" is not a directory)
96
+ end
90
97
 
91
98
  ArubaPath.new(@fixtures_directory)
92
99
  end