aruba 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -1
  3. data/CONTRIBUTING.md +11 -23
  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 -11
  8. data/lib/aruba/api/bundler.rb +1 -1
  9. data/lib/aruba/api/commands.rb +7 -7
  10. data/lib/aruba/api/core.rb +20 -20
  11. data/lib/aruba/api/environment.rb +2 -2
  12. data/lib/aruba/api/filesystem.rb +41 -14
  13. data/lib/aruba/api/text.rb +4 -4
  14. data/lib/aruba/aruba_path.rb +2 -2
  15. data/lib/aruba/basic_configuration.rb +11 -11
  16. data/lib/aruba/cli.rb +7 -7
  17. data/lib/aruba/command.rb +4 -4
  18. data/lib/aruba/config/jruby.rb +9 -9
  19. data/lib/aruba/config_wrapper.rb +2 -2
  20. data/lib/aruba/configuration.rb +14 -14
  21. data/lib/aruba/console.rb +11 -11
  22. data/lib/aruba/console/help.rb +5 -5
  23. data/lib/aruba/contracts/absolute_path.rb +1 -1
  24. data/lib/aruba/contracts/enum.rb +1 -1
  25. data/lib/aruba/contracts/is_power_of_two.rb +1 -1
  26. data/lib/aruba/contracts/relative_path.rb +1 -1
  27. data/lib/aruba/cucumber.rb +7 -7
  28. data/lib/aruba/cucumber/command.rb +31 -31
  29. data/lib/aruba/cucumber/environment.rb +7 -7
  30. data/lib/aruba/cucumber/file.rb +7 -3
  31. data/lib/aruba/cucumber/hooks.rb +29 -29
  32. data/lib/aruba/cucumber/testing_frameworks.rb +18 -18
  33. data/lib/aruba/event_bus.rb +4 -4
  34. data/lib/aruba/event_bus/name_resolver.rb +4 -4
  35. data/lib/aruba/file_size.rb +1 -1
  36. data/lib/aruba/generators/script_file.rb +2 -2
  37. data/lib/aruba/in_config_wrapper.rb +1 -1
  38. data/lib/aruba/initializer.rb +10 -10
  39. data/lib/aruba/matchers/base/base_matcher.rb +1 -1
  40. data/lib/aruba/matchers/base/message_indenter.rb +1 -1
  41. data/lib/aruba/matchers/base/object_formatter.rb +2 -2
  42. data/lib/aruba/matchers/collection.rb +1 -1
  43. data/lib/aruba/matchers/collection/all.rb +1 -1
  44. data/lib/aruba/matchers/collection/include_an_object.rb +2 -2
  45. data/lib/aruba/matchers/command.rb +1 -1
  46. data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -4
  47. data/lib/aruba/matchers/command/have_finished_in_time.rb +1 -1
  48. data/lib/aruba/matchers/command/have_output.rb +1 -1
  49. data/lib/aruba/matchers/directory.rb +1 -1
  50. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
  51. data/lib/aruba/matchers/directory/have_sub_directory.rb +3 -3
  52. data/lib/aruba/matchers/environment.rb +1 -1
  53. data/lib/aruba/matchers/file.rb +1 -1
  54. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
  55. data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
  56. data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
  57. data/lib/aruba/matchers/file/have_file_content.rb +1 -1
  58. data/lib/aruba/matchers/file/have_file_size.rb +1 -1
  59. data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
  60. data/lib/aruba/matchers/path.rb +1 -1
  61. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
  62. data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
  63. data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
  64. data/lib/aruba/matchers/path/have_permissions.rb +2 -2
  65. data/lib/aruba/matchers/string.rb +1 -1
  66. data/lib/aruba/matchers/string/include_output_string.rb +1 -1
  67. data/lib/aruba/matchers/string/match_output_string.rb +1 -1
  68. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  69. data/lib/aruba/platform.rb +2 -2
  70. data/lib/aruba/platforms/announcer.rb +14 -14
  71. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
  72. data/lib/aruba/platforms/aruba_logger.rb +1 -1
  73. data/lib/aruba/platforms/command_monitor.rb +5 -5
  74. data/lib/aruba/platforms/determine_disk_usage.rb +1 -1
  75. data/lib/aruba/platforms/filesystem_status.rb +1 -1
  76. data/lib/aruba/platforms/simple_table.rb +1 -1
  77. data/lib/aruba/platforms/unix_command_string.rb +2 -2
  78. data/lib/aruba/platforms/unix_platform.rb +22 -22
  79. data/lib/aruba/platforms/unix_which.rb +1 -1
  80. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  81. data/lib/aruba/platforms/windows_environment_variables.rb +1 -1
  82. data/lib/aruba/platforms/windows_platform.rb +6 -6
  83. data/lib/aruba/platforms/windows_which.rb +5 -5
  84. data/lib/aruba/processes/basic_process.rb +2 -2
  85. data/lib/aruba/processes/debug_process.rb +5 -5
  86. data/lib/aruba/processes/in_process.rb +7 -7
  87. data/lib/aruba/processes/spawn_process.rb +17 -22
  88. data/lib/aruba/rspec.rb +6 -6
  89. data/lib/aruba/runtime.rb +6 -6
  90. data/lib/aruba/setup.rb +3 -3
  91. data/lib/aruba/version.rb +1 -1
  92. metadata +21 -22
  93. data/lib/aruba/tasks/docker_helpers.rb +0 -156
@@ -1,4 +1,4 @@
1
- require 'aruba/matchers/base/object_formatter'
1
+ require "aruba/matchers/base/object_formatter"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -8,7 +8,7 @@ module Aruba
8
8
  module_function
9
9
 
10
10
  def indent_multiline_message(message)
11
- message = message.sub(/\n+\z/, '')
11
+ message = message.sub(/\n+\z/, "")
12
12
  message.lines.map do |line|
13
13
  /\S/.match?(line) ? " #{line}" : line
14
14
  end.join
@@ -52,7 +52,7 @@ module Aruba
52
52
  end
53
53
  end
54
54
 
55
- TIME_FORMAT = '%Y-%m-%d %H:%M:%S'.freeze
55
+ TIME_FORMAT = "%Y-%m-%d %H:%M:%S".freeze
56
56
 
57
57
  if Time.method_defined?(:nsec)
58
58
  # @private
@@ -61,7 +61,7 @@ module Aruba
61
61
  end
62
62
  end
63
63
 
64
- DATE_TIME_FORMAT = '%a, %d %b %Y %H:%M:%S.%N %z'.freeze
64
+ DATE_TIME_FORMAT = "%a, %d %b %Y %H:%M:%S.%N %z".freeze
65
65
 
66
66
  # ActiveSupport sometimes overrides inspect. If `ActiveSupport` is
67
67
  # defined use a custom format string that includes more time precision.
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../collection/**/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../collection/**/*.rb", __FILE__)
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations'
1
+ require "rspec/expectations"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -1,5 +1,5 @@
1
- require 'aruba/matchers/base/base_matcher'
2
- require 'aruba/matchers/base/message_indenter'
1
+ require "aruba/matchers/base/base_matcher"
2
+ require "aruba/matchers/base/message_indenter"
3
3
 
4
4
  # Aruba
5
5
  module Aruba
@@ -1 +1 @@
1
- Aruba.platform.require_matching_files('../command/**/*.rb', __FILE__)
1
+ Aruba.platform.require_matching_files("../command/**/*.rb", __FILE__)
@@ -1,7 +1,7 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
- require 'aruba/matchers/command/have_exit_status'
4
- require 'aruba/matchers/command/have_finished_in_time'
3
+ require "aruba/matchers/command/have_exit_status"
4
+ require "aruba/matchers/command/have_finished_in_time"
5
5
 
6
6
  # @!method be_successfuly_executed
7
7
  # This matchers checks if execution of <command> was successful
@@ -30,7 +30,7 @@ RSpec::Matchers.define :be_successfully_executed do
30
30
 
31
31
  failure_message do |_actual|
32
32
  "Expected `#{@actual}` to succeed" \
33
- ' but got non-zero exit status and the following output:' \
33
+ " but got non-zero exit status and the following output:" \
34
34
  "\n\n#{@old_actual.output}\n"
35
35
  end
36
36
  end
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations/version'
1
+ require "rspec/expectations/version"
2
2
 
3
3
  # @!method run_too_long
4
4
  # This matchers checks if <command> run too long. Say the timeout is 10
@@ -1,4 +1,4 @@
1
- require 'aruba/matchers/base/message_indenter'
1
+ require "aruba/matchers/base/message_indenter"
2
2
 
3
3
  # @!method have_output
4
4
  # This matchers checks if <command> has created output
@@ -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
@@ -42,13 +42,13 @@ RSpec::Matchers.define :have_sub_directory do |expected|
42
42
 
43
43
  failure_message do |actual|
44
44
  format('expected that directory "%s" has the following sub-directories: %s.',
45
- actual.join(', '),
45
+ actual.join(", "),
46
46
  expected)
47
47
  end
48
48
 
49
49
  failure_message_when_negated do |actual|
50
50
  format('expected that directory "%s" does not have the following sub-directories: %s.',
51
- actual.join(', '),
51
+ actual.join(", "),
52
52
  expected)
53
53
  end
54
54
  end
@@ -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
@@ -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
@@ -43,7 +43,7 @@ RSpec::Matchers.define :have_permissions do |expected|
43
43
  when Integer
44
44
  expected.to_s(8)
45
45
  when String
46
- expected.gsub(/^0*/, '')
46
+ expected.gsub(/^0*/, "")
47
47
  else
48
48
  expected
49
49
  end
@@ -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
@@ -81,29 +81,29 @@ module Aruba
81
81
  private
82
82
 
83
83
  def after_init
84
- output_format :changed_configuration, proc { |n, v| format('# %s = %s', n, v) }
84
+ output_format :changed_configuration, proc { |n, v| format("# %s = %s", n, v) }
85
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'
86
+ proc { |n, v| format("$ export %s=%s", n, Shellwords.escape(v)) }
87
+ output_format :command, "$ %s"
88
+ output_format :directory, "$ cd %s"
89
89
  output_format :environment,
90
- proc { |n, v| format('$ export %s=%s', n, Shellwords.escape(v)) }
90
+ proc { |n, v| format("$ export %s=%s", n, Shellwords.escape(v)) }
91
91
  output_format :full_environment,
92
92
  proc { |h|
93
93
  format("<<-ENVIRONMENT\n%s\nENVIRONMENT",
94
94
  Aruba.platform.simple_table(h))
95
95
  }
96
96
  output_format :modified_environment,
97
- proc { |n, v| format('$ export %s=%s', n, Shellwords.escape(v)) }
97
+ proc { |n, v| format("$ export %s=%s", n, Shellwords.escape(v)) }
98
98
  output_format :stderr, "<<-STDERR\n%s\nSTDERR"
99
99
  output_format :stdout, "<<-STDOUT\n%s\nSTDOUT"
100
100
  output_format :command_content, "<<-COMMAND\n%s\nCOMMAND"
101
101
  output_format :stop_signal,
102
102
  proc { |p, s|
103
- format('Command will be stopped with `kill -%s %s`', s, p)
103
+ format("Command will be stopped with `kill -%s %s`", s, p)
104
104
  }
105
- output_format :timeout, '# %s-timeout: %s seconds'
106
- output_format :wait_time, '# %s: %s seconds'
105
+ output_format :timeout, "# %s-timeout: %s seconds"
106
+ output_format :wait_time, "# %s: %s seconds"
107
107
  output_format :command_filesystem_status,
108
108
  proc { |status|
109
109
  format("<<-COMMAND FILESYSTEM STATUS\n%s\nCOMMAND FILESYSTEM STATUS",
@@ -111,7 +111,7 @@ module Aruba
111
111
  }
112
112
  end
113
113
 
114
- def output_format(channel, string = '%s', &block)
114
+ def output_format(channel, string = "%s", &block)
115
115
  output_formats[channel.to_sym] = if block
116
116
  block
117
117
  elsif string.is_a?(Proc)
@@ -180,7 +180,7 @@ module Aruba
180
180
  the_output_format = if output_formats.key? channel
181
181
  output_formats[channel]
182
182
  else
183
- proc { |v| format('%s', v) }
183
+ proc { |v| format("%s", v) }
184
184
  end
185
185
 
186
186
  return unless activated?(channel)
@@ -28,7 +28,7 @@ module Aruba
28
28
 
29
29
  Aruba.platform.mkdir(File.dirname(path))
30
30
 
31
- File.open(path, 'wb') do |f|
31
+ File.open(path, "wb") do |f|
32
32
  f.seek(size - 1)
33
33
  f.write("\0")
34
34
  end
@@ -1,4 +1,4 @@
1
- require 'logger'
1
+ require "logger"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -1,4 +1,4 @@
1
- require 'aruba/errors'
1
+ require "aruba/errors"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -20,7 +20,7 @@ module Aruba
20
20
  end
21
21
 
22
22
  def method_missing(*)
23
- raise 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
- raise 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?(*)
@@ -96,7 +96,7 @@ module Aruba
96
96
  def all_stdout
97
97
  registered_commands.each(&:stop)
98
98
 
99
- registered_commands.each_with_object('') { |e, a| a << e.stdout }
99
+ registered_commands.each_with_object("") { |e, a| a << e.stdout }
100
100
  end
101
101
 
102
102
  # Get stderr of all commands
@@ -106,7 +106,7 @@ module Aruba
106
106
  def all_stderr
107
107
  registered_commands.each(&:stop)
108
108
 
109
- registered_commands.each_with_object('') { |e, a| a << e.stderr }
109
+ registered_commands.each_with_object("") { |e, a| a << e.stderr }
110
110
  end
111
111
 
112
112
  # Get stderr and stdout of all commands
@@ -1,4 +1,4 @@
1
- require 'aruba/file_size'
1
+ require "aruba/file_size"
2
2
 
3
3
  module Aruba
4
4
  module Platforms
@@ -36,7 +36,7 @@ module Aruba
36
36
 
37
37
  # Return permissions
38
38
  def mode
39
- format('%o', status.mode)[-4, 4].gsub(/^0*/, '')
39
+ format("%o", status.mode)[-4, 4].gsub(/^0*/, "")
40
40
  end
41
41
 
42
42
  # Return owner
@@ -27,7 +27,7 @@ module Aruba
27
27
  # The table
28
28
  def to_s
29
29
  longest_key = hash.keys.map(&:to_s).max_by(&:length)
30
- return '' if longest_key.nil?
30
+ return "" if longest_key.nil?
31
31
 
32
32
  name_size = longest_key.length
33
33
 
@@ -1,5 +1,5 @@
1
- require 'delegate'
2
- require 'shellwords'
1
+ require "delegate"
2
+ require "shellwords"
3
3
 
4
4
  # Aruba
5
5
  module Aruba