aruba 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -1
  3. data/CONTRIBUTING.md +11 -31
  4. data/README.md +1 -2
  5. data/exe/aruba +2 -2
  6. data/lib/aruba.rb +1 -1
  7. data/lib/aruba/api.rb +11 -12
  8. data/lib/aruba/api/bundler.rb +18 -3
  9. data/lib/aruba/api/commands.rb +19 -22
  10. data/lib/aruba/api/core.rb +65 -48
  11. data/lib/aruba/api/environment.rb +13 -5
  12. data/lib/aruba/api/filesystem.rb +69 -39
  13. data/lib/aruba/api/text.rb +15 -3
  14. data/lib/aruba/aruba_path.rb +3 -4
  15. data/lib/aruba/basic_configuration.rb +52 -71
  16. data/lib/aruba/basic_configuration/option.rb +2 -2
  17. data/lib/aruba/cli.rb +9 -6
  18. data/lib/aruba/command.rb +4 -4
  19. data/lib/aruba/config/jruby.rb +9 -9
  20. data/lib/aruba/config_wrapper.rb +17 -2
  21. data/lib/aruba/configuration.rb +37 -32
  22. data/lib/aruba/console.rb +11 -13
  23. data/lib/aruba/console/help.rb +9 -6
  24. data/lib/aruba/contracts/absolute_path.rb +2 -2
  25. data/lib/aruba/contracts/enum.rb +1 -1
  26. data/lib/aruba/contracts/is_power_of_two.rb +3 -3
  27. data/lib/aruba/contracts/relative_path.rb +2 -2
  28. data/lib/aruba/cucumber.rb +7 -7
  29. data/lib/aruba/cucumber/command.rb +106 -95
  30. data/lib/aruba/cucumber/environment.rb +7 -7
  31. data/lib/aruba/cucumber/file.rb +50 -26
  32. data/lib/aruba/cucumber/hooks.rb +32 -29
  33. data/lib/aruba/cucumber/testing_frameworks.rb +32 -30
  34. data/lib/aruba/event_bus.rb +6 -4
  35. data/lib/aruba/event_bus/name_resolver.rb +12 -11
  36. data/lib/aruba/events.rb +2 -1
  37. data/lib/aruba/file_size.rb +1 -1
  38. data/lib/aruba/generators/script_file.rb +2 -2
  39. data/lib/aruba/hooks.rb +2 -4
  40. data/lib/aruba/in_config_wrapper.rb +8 -5
  41. data/lib/aruba/initializer.rb +14 -12
  42. data/lib/aruba/matchers/base/base_matcher.rb +3 -12
  43. data/lib/aruba/matchers/base/message_indenter.rb +2 -2
  44. data/lib/aruba/matchers/base/object_formatter.rb +2 -5
  45. data/lib/aruba/matchers/collection.rb +1 -1
  46. data/lib/aruba/matchers/collection/all.rb +1 -1
  47. data/lib/aruba/matchers/collection/include_an_object.rb +6 -6
  48. data/lib/aruba/matchers/command.rb +1 -1
  49. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
  50. data/lib/aruba/matchers/command/have_exit_status.rb +3 -1
  51. data/lib/aruba/matchers/command/have_finished_in_time.rb +4 -2
  52. data/lib/aruba/matchers/command/have_output.rb +4 -2
  53. data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
  54. data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
  55. data/lib/aruba/matchers/directory.rb +1 -1
  56. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
  57. data/lib/aruba/matchers/directory/have_sub_directory.rb +9 -4
  58. data/lib/aruba/matchers/environment.rb +1 -1
  59. data/lib/aruba/matchers/file.rb +1 -1
  60. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
  61. data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
  62. data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
  63. data/lib/aruba/matchers/file/have_file_content.rb +1 -1
  64. data/lib/aruba/matchers/file/have_file_size.rb +5 -3
  65. data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
  66. data/lib/aruba/matchers/path.rb +1 -1
  67. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
  68. data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
  69. data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
  70. data/lib/aruba/matchers/path/have_permissions.rb +9 -6
  71. data/lib/aruba/matchers/string.rb +1 -1
  72. data/lib/aruba/matchers/string/include_output_string.rb +1 -1
  73. data/lib/aruba/matchers/string/match_output_string.rb +1 -1
  74. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  75. data/lib/aruba/platform.rb +2 -2
  76. data/lib/aruba/platforms/announcer.rb +29 -17
  77. data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
  78. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
  79. data/lib/aruba/platforms/aruba_logger.rb +11 -10
  80. data/lib/aruba/platforms/command_monitor.rb +7 -9
  81. data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
  82. data/lib/aruba/platforms/filesystem_status.rb +20 -14
  83. data/lib/aruba/platforms/simple_table.rb +3 -3
  84. data/lib/aruba/platforms/unix_command_string.rb +2 -2
  85. data/lib/aruba/platforms/unix_environment_variables.rb +2 -4
  86. data/lib/aruba/platforms/unix_platform.rb +23 -23
  87. data/lib/aruba/platforms/unix_which.rb +2 -2
  88. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  89. data/lib/aruba/platforms/windows_environment_variables.rb +3 -2
  90. data/lib/aruba/platforms/windows_platform.rb +7 -7
  91. data/lib/aruba/platforms/windows_which.rb +8 -4
  92. data/lib/aruba/processes/basic_process.rb +4 -4
  93. data/lib/aruba/processes/debug_process.rb +5 -3
  94. data/lib/aruba/processes/in_process.rb +10 -8
  95. data/lib/aruba/processes/spawn_process.rb +28 -25
  96. data/lib/aruba/rspec.rb +30 -20
  97. data/lib/aruba/runtime.rb +16 -9
  98. data/lib/aruba/setup.rb +25 -12
  99. data/lib/aruba/version.rb +1 -1
  100. metadata +77 -88
  101. data/.cucumberproignore +0 -3
  102. data/.document +0 -5
  103. data/.github/ISSUE_TEMPLATE.md +0 -48
  104. data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
  105. data/.gitignore +0 -38
  106. data/.rspec +0 -3
  107. data/.rubocop.yml +0 -31
  108. data/.rubocop_todo.yml +0 -262
  109. data/.simplecov +0 -36
  110. data/.travis.yml +0 -62
  111. data/.yardopts +0 -11
  112. data/Dockerfile +0 -67
  113. data/Gemfile +0 -12
  114. data/Rakefile +0 -80
  115. data/TODO.md +0 -13
  116. data/appveyor.yml +0 -29
  117. data/aruba.gemspec +0 -54
  118. data/bin/console +0 -7
  119. data/bin/test +0 -9
  120. data/config/.gitignore +0 -1
  121. data/cucumber.yml +0 -6
  122. data/docker-compose.yml +0 -26
  123. data/fixtures/cli-app/.gitignore +0 -9
  124. data/fixtures/cli-app/.rspec +0 -2
  125. data/fixtures/cli-app/README.md +0 -39
  126. data/fixtures/cli-app/Rakefile +0 -1
  127. data/fixtures/cli-app/bin/aruba-test-cli +0 -6
  128. data/fixtures/cli-app/cli-app.gemspec +0 -25
  129. data/fixtures/cli-app/features/support/aruba.rb +0 -1
  130. data/fixtures/cli-app/features/support/env.rb +0 -1
  131. data/fixtures/cli-app/lib/cli/app.rb +0 -9
  132. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
  133. data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
  134. data/fixtures/cli-app/script/console +0 -14
  135. data/fixtures/cli-app/spec/spec_helper.rb +0 -7
  136. data/fixtures/cli-app/spec/support/aruba.rb +0 -1
  137. data/fixtures/copy/file.txt +0 -1
  138. data/fixtures/empty-app/.gitignore +0 -9
  139. data/fixtures/empty-app/.rspec +0 -2
  140. data/fixtures/empty-app/README.md +0 -24
  141. data/fixtures/empty-app/Rakefile +0 -1
  142. data/fixtures/empty-app/cli-app.gemspec +0 -25
  143. data/fixtures/empty-app/lib/cli/app.rb +0 -7
  144. data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
  145. data/fixtures/getting-started-app/.gitignore +0 -4
  146. data/fixtures/getting-started-app/Gemfile +0 -4
  147. data/fixtures/getting-started-app/README.md +0 -3
  148. data/fixtures/getting-started-app/features/support/env.rb +0 -1
  149. data/lib/aruba/extensions/string/strip.rb +0 -25
  150. data/lib/aruba/tasks/docker_helpers.rb +0 -154
@@ -17,7 +17,9 @@ RSpec::Matchers.define :have_output_on_stderr do |expected|
17
17
  match do |actual|
18
18
  @old_actual = actual
19
19
 
20
- raise "Expected #{@old_actual} to respond to #stderr" unless @old_actual.respond_to? :stderr
20
+ unless @old_actual.respond_to? :stderr
21
+ raise "Expected #{@old_actual} to respond to #stderr"
22
+ end
21
23
 
22
24
  @old_actual.stop
23
25
 
@@ -17,7 +17,9 @@ RSpec::Matchers.define :have_output_on_stdout do |expected|
17
17
  match do |actual|
18
18
  @old_actual = actual
19
19
 
20
- raise "Expected #{@old_actual} to respond to #stdout" unless @old_actual.respond_to? :stdout
20
+ unless @old_actual.respond_to? :stdout
21
+ raise "Expected #{@old_actual} to respond to #stdout"
22
+ end
21
23
 
22
24
  @old_actual.stop
23
25
 
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../directory/**/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../directory/**/*.rb", __FILE__)
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method be_an_existing_directory
4
4
  # This matchers checks if <directory> exists in filesystem
@@ -19,7 +19,7 @@ RSpec::Matchers.define :be_an_existing_directory do |_|
19
19
  match do |actual|
20
20
  stop_all_commands
21
21
 
22
- raise 'String expected' unless actual.is_a? String
22
+ raise "String expected" unless actual.is_a? String
23
23
 
24
24
  directory?(actual)
25
25
  end
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method have_sub_directory(sub_directory)
4
4
  # This matchers checks if <directory> has given sub-directory
@@ -23,7 +23,8 @@ require 'rspec/expectations/version'
23
23
  #
24
24
  # RSpec.describe do
25
25
  # it { expect('dir1.d').to have_sub_directory(['subdir.1.d', 'subdir.2.d']) }
26
- # it { expect(directories).to include a_directory_with_sub_directory(['subdir.1.d', 'subdir.2.d']) }
26
+ # it { expect(directories)
27
+ # . to include a_directory_with_sub_directory(['subdir.1.d', 'subdir.2.d']) }
27
28
  # end
28
29
  RSpec::Matchers.define :have_sub_directory do |expected|
29
30
  match do |actual|
@@ -40,11 +41,15 @@ RSpec::Matchers.define :have_sub_directory do |expected|
40
41
  diffable
41
42
 
42
43
  failure_message do |actual|
43
- format('expected that directory "%s" has the following sub-directories: %s.', actual.join(', '), expected)
44
+ format('expected that directory "%s" has the following sub-directories: %s.',
45
+ actual.join(", "),
46
+ expected)
44
47
  end
45
48
 
46
49
  failure_message_when_negated do |actual|
47
- format('expected that directory "%s" does not have the following sub-directories: %s.', actual.join(', '), expected)
50
+ format('expected that directory "%s" does not have the following sub-directories: %s.',
51
+ actual.join(", "),
52
+ expected)
48
53
  end
49
54
  end
50
55
 
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../matchers/environment/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../matchers/environment/*.rb", __FILE__)
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../file/**/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../file/**/*.rb", __FILE__)
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method be_a_command_found_in_path
4
4
  # This matchers checks if <command> can be found in path
@@ -1,5 +1,5 @@
1
- require 'rspec/expectations/version'
2
- require 'shellwords'
1
+ require "rspec/expectations/version"
2
+ require "shellwords"
3
3
 
4
4
  # @!method be_an_existing_executable
5
5
  # This matchers checks if <file> exists in filesystem
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method be_an_existing_file
4
4
  # This matchers checks if <file> exists in filesystem
@@ -19,7 +19,7 @@ RSpec::Matchers.define :be_an_existing_file do |_|
19
19
  match do |actual|
20
20
  stop_all_commands
21
21
 
22
- raise 'String expected' unless actual.is_a? String
22
+ raise "String expected" unless actual.is_a? String
23
23
 
24
24
  file?(actual)
25
25
  end
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method have_file_content(content)
4
4
  # This matchers checks if <file> has content. `content` can be a string,
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method have_file_size(size)
4
4
  # This matchers checks if path has file size
@@ -34,11 +34,13 @@ RSpec::Matchers.define :have_file_size do |expected|
34
34
  end
35
35
 
36
36
  failure_message do |_actual|
37
- format('expected that file "%s" has size "%s", but has "%s"', @old_actual, @actual, @expected)
37
+ format('expected that file "%s" has size "%s", but has "%s"',
38
+ @old_actual, @actual, @expected)
38
39
  end
39
40
 
40
41
  failure_message_when_negated do |_actual|
41
- format('expected that file "%s" does not have size "%s", but has "%s"', @old_actual, @actual, @expected)
42
+ format('expected that file "%s" does not have size "%s", but has "%s"',
43
+ @old_actual, @actual, @expected)
42
44
  end
43
45
  end
44
46
 
@@ -1,5 +1,5 @@
1
- require 'rspec/expectations/version'
2
- require 'fileutils'
1
+ require "rspec/expectations/version"
2
+ require "fileutils"
3
3
 
4
4
  # @!method have_same_file_content_as(file_name)
5
5
  # This matchers checks if <file1> has the same content like <file2>
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../path/**/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../path/**/*.rb", __FILE__)
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method a_path_matching_pattern(/pattern/)
4
4
  # This matchers checks if <path> matches pattern. `pattern` can be a string,
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method be_an_absolute_path
4
4
  # This matchers checks if <path> exists in filesystem
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method be_an_existing_path
4
4
  # This matchers checks if <path> exists in filesystem
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method have_permissions(permissions)
4
4
  # This matchers checks if <file> or <directory> has <perm> permissions
@@ -39,10 +39,11 @@ RSpec::Matchers.define :have_permissions do |expected|
39
39
  @old_actual = actual
40
40
  @actual = permissions(expand_path(@old_actual))
41
41
 
42
- @expected = if expected.is_a? Integer
42
+ @expected = case expected
43
+ when Integer
43
44
  expected.to_s(8)
44
- elsif expected.is_a? String
45
- expected.gsub(/^0*/, '')
45
+ when String
46
+ expected.gsub(/^0*/, "")
46
47
  else
47
48
  expected
48
49
  end
@@ -51,11 +52,13 @@ RSpec::Matchers.define :have_permissions do |expected|
51
52
  end
52
53
 
53
54
  failure_message do |_actual|
54
- format('expected that path "%s" has permissions "%s", but has "%s".', @old_actual, @expected, @actual)
55
+ format('expected that path "%s" has permissions "%s", but has "%s".',
56
+ @old_actual, @expected, @actual)
55
57
  end
56
58
 
57
59
  failure_message_when_negated do |_actual|
58
- format('expected that path "%s" does not have permissions "%s", but has "%s".', @old_actual, @expected, @actual)
60
+ format('expected that path "%s" does not have permissions "%s", but has "%s".',
61
+ @old_actual, @expected, @actual)
59
62
  end
60
63
  end
61
64
 
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../string/**/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../string/**/*.rb", __FILE__)
@@ -18,7 +18,7 @@
18
18
  # end
19
19
  RSpec::Matchers.define :include_output_string do |expected|
20
20
  match do |actual|
21
- actual.force_encoding('UTF-8')
21
+ actual.force_encoding("UTF-8")
22
22
  @expected = Regexp.new(Regexp.escape(sanitize_text(expected.to_s)), Regexp::MULTILINE)
23
23
  @actual = sanitize_text(actual)
24
24
 
@@ -18,7 +18,7 @@
18
18
  # end
19
19
  RSpec::Matchers.define :match_output_string do |expected|
20
20
  match do |actual|
21
- actual.force_encoding('UTF-8')
21
+ actual.force_encoding("UTF-8")
22
22
  @expected = Regexp.new(unescape_text(expected), Regexp::MULTILINE)
23
23
  @actual = sanitize_text(actual)
24
24
 
@@ -18,7 +18,7 @@
18
18
  # end
19
19
  RSpec::Matchers.define :output_string_eq do |expected|
20
20
  match do |actual|
21
- actual.force_encoding('UTF-8')
21
+ actual.force_encoding("UTF-8")
22
22
  @expected = sanitize_text(expected.to_s)
23
23
  @actual = sanitize_text(actual.to_s)
24
24
 
@@ -1,5 +1,5 @@
1
- require 'aruba/platforms/unix_platform'
2
- require 'aruba/platforms/windows_platform'
1
+ require "aruba/platforms/unix_platform"
2
+ require "aruba/platforms/windows_platform"
3
3
 
4
4
  # Aruba
5
5
  module Aruba
@@ -1,7 +1,7 @@
1
- require 'shellwords'
2
- require 'aruba/colorizer'
1
+ require "shellwords"
2
+ require "aruba/colorizer"
3
3
 
4
- Aruba::Colorizer.coloring = false if !STDOUT.tty? && !ENV.key?('AUTOTEST')
4
+ Aruba::Colorizer.coloring = false if !$stdout.tty? && !ENV.key?("AUTOTEST")
5
5
 
6
6
  # Aruba
7
7
  module Aruba
@@ -21,7 +21,9 @@ module Aruba
21
21
  #
22
22
  # before do
23
23
  # current_example = context.example
24
- # aruba.announcer.activate :my_channel if current_example.metadata[:announce_my_channel]
24
+ # if current_example.metadata[:announce_my_channel]
25
+ # aruba.announcer.activate :my_channel
26
+ # end
25
27
  # end
26
28
  #
27
29
  # Aruba.announcer.announce(:my_channel, 'my message')
@@ -79,19 +81,29 @@ module Aruba
79
81
  private
80
82
 
81
83
  def after_init
82
- output_format :changed_configuration, proc { |n, v| format('# %s = %s', n, v) }
83
- output_format :changed_environment, proc { |n, v| format('$ export %s=%s', n, Shellwords.escape(v)) }
84
- output_format :command, '$ %s'
85
- output_format :directory, '$ cd %s'
86
- output_format :environment, proc { |n, v| format('$ export %s=%s', n, Shellwords.escape(v)) }
87
- output_format :full_environment, proc { |h| format("<<-ENVIRONMENT\n%s\nENVIRONMENT", Aruba.platform.simple_table(h)) }
88
- output_format :modified_environment, proc { |n, v| format('$ export %s=%s', n, Shellwords.escape(v)) }
84
+ output_format :changed_configuration, proc { |n, v| format("# %s = %s", n, v) }
85
+ output_format :changed_environment,
86
+ proc { |n, v| format("$ export %s=%s", n, Shellwords.escape(v)) }
87
+ output_format :command, "$ %s"
88
+ output_format :directory, "$ cd %s"
89
+ output_format :environment,
90
+ proc { |n, v| format("$ export %s=%s", n, Shellwords.escape(v)) }
91
+ output_format :full_environment,
92
+ proc { |h|
93
+ format("<<-ENVIRONMENT\n%s\nENVIRONMENT",
94
+ Aruba.platform.simple_table(h))
95
+ }
96
+ output_format :modified_environment,
97
+ proc { |n, v| format("$ export %s=%s", n, Shellwords.escape(v)) }
89
98
  output_format :stderr, "<<-STDERR\n%s\nSTDERR"
90
99
  output_format :stdout, "<<-STDOUT\n%s\nSTDOUT"
91
100
  output_format :command_content, "<<-COMMAND\n%s\nCOMMAND"
92
- output_format :stop_signal, proc { |p, s| format('Command will be stopped with `kill -%s %s`', s, p) }
93
- output_format :timeout, '# %s-timeout: %s seconds'
94
- output_format :wait_time, '# %s: %s seconds'
101
+ output_format :stop_signal,
102
+ proc { |p, s|
103
+ format("Command will be stopped with `kill -%s %s`", s, p)
104
+ }
105
+ output_format :timeout, "# %s-timeout: %s seconds"
106
+ output_format :wait_time, "# %s: %s seconds"
95
107
  output_format :command_filesystem_status,
96
108
  proc { |status|
97
109
  format("<<-COMMAND FILESYSTEM STATUS\n%s\nCOMMAND FILESYSTEM STATUS",
@@ -99,8 +111,8 @@ module Aruba
99
111
  }
100
112
  end
101
113
 
102
- def output_format(channel, string = '%s', &block)
103
- output_formats[channel.to_sym] = if block_given?
114
+ def output_format(channel, string = "%s", &block)
115
+ output_formats[channel.to_sym] = if block
104
116
  block
105
117
  elsif string.is_a?(Proc)
106
118
  string
@@ -168,7 +180,7 @@ module Aruba
168
180
  the_output_format = if output_formats.key? channel
169
181
  output_formats[channel]
170
182
  else
171
- proc { |v| format('%s', v) }
183
+ proc { |v| format("%s", v) }
172
184
  end
173
185
 
174
186
  return unless activated?(channel)
@@ -18,7 +18,9 @@ module Aruba
18
18
  # @param [Boolean] check_presence (false)
19
19
  # Check if file exist
20
20
  def call(path, content, check_presence = false)
21
- fail "Expected #{path} to be present" if check_presence && !Aruba.platform.file?(path)
21
+ if check_presence && !Aruba.platform.file?(path)
22
+ raise "Expected #{path} to be present"
23
+ end
22
24
 
23
25
  Aruba.platform.mkdir(File.dirname(path))
24
26
 
@@ -22,11 +22,16 @@ module Aruba
22
22
  # @param [Boolean] check_presence (false)
23
23
  # Check if file exist
24
24
  def call(path, size, check_presence)
25
- fail "Expected #{path} to be present" if check_presence && !Aruba.platform.file?(path)
25
+ if check_presence && !Aruba.platform.file?(path)
26
+ raise "Expected #{path} to be present"
27
+ end
26
28
 
27
29
  Aruba.platform.mkdir(File.dirname(path))
28
30
 
29
- File.open(path, 'wb') { |f| f.seek(size - 1); f.write("\0") }
31
+ File.open(path, "wb") do |f|
32
+ f.seek(size - 1)
33
+ f.write("\0")
34
+ end
30
35
 
31
36
  self
32
37
  end
@@ -1,4 +1,4 @@
1
- require 'logger'
1
+ require "logger"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -47,20 +47,21 @@ module Aruba
47
47
  def logger
48
48
  l = ::Logger.new($stderr)
49
49
 
50
- case mode
51
- when :debug
52
- l.level = ::Logger::DEBUG
50
+ if mode == :debug
53
51
  format_debug(l)
54
- when :silent
55
- l.level = 9_999
56
- when :info
57
- l.level = ::Logger::INFO
58
- format_standard(l)
59
52
  else
60
- l.level = ::Logger::INFO
61
53
  format_standard(l)
62
54
  end
63
55
 
56
+ l.level = case mode
57
+ when :debug
58
+ ::Logger::DEBUG
59
+ when :silent
60
+ 9_999
61
+ else
62
+ ::Logger::INFO
63
+ end
64
+
64
65
  l
65
66
  end
66
67
 
@@ -1,4 +1,4 @@
1
- require 'aruba/errors'
1
+ require "aruba/errors"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -12,7 +12,7 @@ module Aruba
12
12
 
13
13
  public
14
14
 
15
- attr_reader :registered_commands, :last_command_started
15
+ attr_reader :registered_commands, :last_command_started, :last_command_stopped
16
16
 
17
17
  class DefaultLastCommandStopped
18
18
  def nil?
@@ -20,7 +20,7 @@ module Aruba
20
20
  end
21
21
 
22
22
  def method_missing(*)
23
- fail NoCommandHasBeenStoppedError, 'No last command stopped available'
23
+ raise NoCommandHasBeenStoppedError, "No last command stopped available"
24
24
  end
25
25
 
26
26
  def respond_to_missing?(*)
@@ -34,7 +34,7 @@ module Aruba
34
34
  end
35
35
 
36
36
  def method_missing(*)
37
- fail NoCommandHasBeenStartedError, 'No last command started available'
37
+ raise NoCommandHasBeenStartedError, "No last command started available"
38
38
  end
39
39
 
40
40
  def respond_to_missing?(*)
@@ -52,8 +52,6 @@ module Aruba
52
52
  raise ArgumentError, e.message
53
53
  end
54
54
 
55
- attr_reader :last_command_stopped
56
-
57
55
  # Set last command started
58
56
  #
59
57
  # @param [String] cmd
@@ -78,7 +76,7 @@ module Aruba
78
76
  cmd = cmd.commandline if cmd.respond_to? :commandline
79
77
  command = registered_commands.reverse.find { |c| c.commandline == cmd }
80
78
 
81
- fail CommandNotFoundError, "No command named '#{cmd}' has been started" if command.nil?
79
+ raise CommandNotFoundError, "No command named '#{cmd}' has been started" if command.nil?
82
80
 
83
81
  command
84
82
  end
@@ -98,7 +96,7 @@ module Aruba
98
96
  def all_stdout
99
97
  registered_commands.each(&:stop)
100
98
 
101
- registered_commands.each_with_object('') { |e, a| a << e.stdout }
99
+ registered_commands.each_with_object("") { |e, a| a << e.stdout }
102
100
  end
103
101
 
104
102
  # Get stderr of all commands
@@ -108,7 +106,7 @@ module Aruba
108
106
  def all_stderr
109
107
  registered_commands.each(&:stop)
110
108
 
111
- registered_commands.each_with_object('') { |e, a| a << e.stderr }
109
+ registered_commands.each_with_object("") { |e, a| a << e.stderr }
112
110
  end
113
111
 
114
112
  # Get stderr and stdout of all commands