aruba 1.0.0.pre.alpha.2 → 1.0.1

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 (135) hide show
  1. checksums.yaml +5 -5
  2. data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
  3. data/.rspec +0 -1
  4. data/.rubocop.yml +46 -182
  5. data/.rubocop_todo.yml +216 -0
  6. data/.simplecov +7 -5
  7. data/.travis.yml +56 -40
  8. data/.yardopts +3 -0
  9. data/CHANGELOG.md +1312 -0
  10. data/CONTRIBUTING.md +175 -83
  11. data/Gemfile +5 -69
  12. data/LICENSE +1 -1
  13. data/README.md +58 -21
  14. data/Rakefile +27 -54
  15. data/appveyor.yml +7 -10
  16. data/aruba.gemspec +38 -19
  17. data/bin/console +3 -12
  18. data/cucumber.yml +4 -22
  19. data/exe/aruba +1 -1
  20. data/fixtures/cli-app/README.md +1 -1
  21. data/fixtures/cli-app/Rakefile +1 -1
  22. data/fixtures/cli-app/bin/aruba-test-cli +1 -1
  23. data/fixtures/cli-app/cli-app.gemspec +4 -4
  24. data/fixtures/cli-app/lib/cli/app.rb +1 -1
  25. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
  26. data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
  27. data/fixtures/cli-app/spec/spec_helper.rb +3 -2
  28. data/fixtures/empty-app/Rakefile +1 -1
  29. data/fixtures/empty-app/cli-app.gemspec +4 -4
  30. data/fixtures/empty-app/lib/cli/app.rb +0 -2
  31. data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
  32. data/fixtures/getting-started-app/Gemfile +1 -1
  33. data/lib/aruba/api.rb +8 -15
  34. data/lib/aruba/api/bundler.rb +16 -0
  35. data/lib/aruba/api/commands.rb +272 -0
  36. data/lib/aruba/api/core.rb +82 -43
  37. data/lib/aruba/api/environment.rb +24 -7
  38. data/lib/aruba/api/filesystem.rb +66 -64
  39. data/lib/aruba/api/text.rb +17 -11
  40. data/lib/aruba/aruba_path.rb +25 -111
  41. data/lib/aruba/basic_configuration.rb +8 -25
  42. data/lib/aruba/basic_configuration/option.rb +2 -2
  43. data/lib/aruba/cli.rb +4 -1
  44. data/lib/aruba/colorizer.rb +10 -99
  45. data/lib/aruba/command.rb +4 -0
  46. data/lib/aruba/config/jruby.rb +15 -5
  47. data/lib/aruba/config_wrapper.rb +17 -2
  48. data/lib/aruba/configuration.rb +107 -0
  49. data/lib/aruba/console.rb +5 -7
  50. data/lib/aruba/console/help.rb +5 -2
  51. data/lib/aruba/contracts/absolute_path.rb +3 -3
  52. data/lib/aruba/contracts/is_power_of_two.rb +2 -2
  53. data/lib/aruba/contracts/relative_path.rb +3 -3
  54. data/lib/aruba/cucumber.rb +0 -3
  55. data/lib/aruba/cucumber/command.rb +227 -190
  56. data/lib/aruba/cucumber/environment.rb +1 -1
  57. data/lib/aruba/cucumber/file.rb +56 -50
  58. data/lib/aruba/cucumber/hooks.rb +10 -63
  59. data/lib/aruba/cucumber/testing_frameworks.rb +76 -50
  60. data/lib/aruba/event_bus.rb +4 -2
  61. data/lib/aruba/event_bus/name_resolver.rb +10 -10
  62. data/lib/aruba/events.rb +2 -1
  63. data/lib/aruba/hooks.rb +3 -5
  64. data/lib/aruba/in_config_wrapper.rb +10 -3
  65. data/lib/aruba/initializer.rb +40 -34
  66. data/lib/aruba/matchers/base/base_matcher.rb +2 -11
  67. data/lib/aruba/matchers/base/message_indenter.rb +19 -0
  68. data/lib/aruba/matchers/base/object_formatter.rb +2 -7
  69. data/lib/aruba/matchers/collection/include_an_object.rb +11 -13
  70. data/lib/aruba/matchers/command/be_successfully_executed.rb +8 -4
  71. data/lib/aruba/matchers/command/have_exit_status.rb +16 -4
  72. data/lib/aruba/matchers/command/have_finished_in_time.rb +5 -5
  73. data/lib/aruba/matchers/command/have_output.rb +12 -5
  74. data/lib/aruba/matchers/command/have_output_on_stderr.rb +4 -2
  75. data/lib/aruba/matchers/command/have_output_on_stdout.rb +4 -2
  76. data/lib/aruba/matchers/command/have_output_size.rb +2 -2
  77. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +5 -7
  78. data/lib/aruba/matchers/directory/have_sub_directory.rb +10 -7
  79. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
  80. data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
  81. data/lib/aruba/matchers/file/be_an_existing_file.rb +5 -7
  82. data/lib/aruba/matchers/file/have_file_content.rb +4 -4
  83. data/lib/aruba/matchers/file/have_file_size.rb +8 -8
  84. data/lib/aruba/matchers/file/have_same_file_content.rb +9 -12
  85. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
  86. data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
  87. data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
  88. data/lib/aruba/matchers/path/have_permissions.rb +8 -8
  89. data/lib/aruba/matchers/string/include_output_string.rb +8 -10
  90. data/lib/aruba/matchers/string/match_output_string.rb +9 -11
  91. data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
  92. data/lib/aruba/platform.rb +0 -8
  93. data/lib/aruba/platforms/announcer.rb +60 -85
  94. data/lib/aruba/platforms/aruba_file_creator.rb +4 -2
  95. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +8 -3
  96. data/lib/aruba/platforms/aruba_logger.rb +22 -2
  97. data/lib/aruba/platforms/command_monitor.rb +15 -102
  98. data/lib/aruba/platforms/determine_disk_usage.rb +56 -19
  99. data/lib/aruba/platforms/filesystem_status.rb +9 -9
  100. data/lib/aruba/platforms/local_environment.rb +2 -2
  101. data/lib/aruba/platforms/simple_table.rb +3 -11
  102. data/lib/aruba/platforms/unix_command_string.rb +7 -4
  103. data/lib/aruba/platforms/unix_environment_variables.rb +19 -26
  104. data/lib/aruba/platforms/unix_platform.rb +18 -39
  105. data/lib/aruba/platforms/unix_which.rb +3 -2
  106. data/lib/aruba/platforms/windows_command_string.rb +20 -7
  107. data/lib/aruba/platforms/windows_environment_variables.rb +42 -30
  108. data/lib/aruba/platforms/windows_platform.rb +4 -0
  109. data/lib/aruba/platforms/windows_which.rb +9 -4
  110. data/lib/aruba/processes/basic_process.rb +21 -27
  111. data/lib/aruba/processes/debug_process.rb +16 -5
  112. data/lib/aruba/processes/in_process.rb +20 -9
  113. data/lib/aruba/processes/spawn_process.rb +64 -36
  114. data/lib/aruba/rspec.rb +28 -31
  115. data/lib/aruba/runtime.rb +16 -7
  116. data/lib/aruba/setup.rb +32 -17
  117. data/lib/aruba/tasks/docker_helpers.rb +4 -2
  118. data/lib/aruba/version.rb +1 -1
  119. metadata +194 -64
  120. data/History.md +0 -612
  121. data/bin/bootstrap +0 -34
  122. data/bin/build +0 -3
  123. data/bin/release +0 -3
  124. data/fixtures/spawn_process/stderr.sh +0 -3
  125. data/lib/aruba/api/command.rb +0 -309
  126. data/lib/aruba/api/deprecated.rb +0 -895
  127. data/lib/aruba/api/rvm.rb +0 -44
  128. data/lib/aruba/config.rb +0 -101
  129. data/lib/aruba/cucumber/rvm.rb +0 -3
  130. data/lib/aruba/in_process.rb +0 -14
  131. data/lib/aruba/jruby.rb +0 -4
  132. data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
  133. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
  134. data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
  135. data/lib/aruba/spawn_process.rb +0 -11
@@ -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
@@ -98,14 +98,6 @@ module Aruba
98
98
  ::File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
99
99
  end
100
100
 
101
- # @deprecated
102
- # Add newline at the end
103
- def ensure_newline(str)
104
- deprecated('The use of "#ensure_newline" is deprecated. It will be removed soon')
105
-
106
- str.chomp << "\n"
107
- end
108
-
109
101
  def require_matching_files(pattern, base)
110
102
  ::Dir.glob(::File.expand_path(pattern, base)).each { |f| require_relative f }
111
103
  end
@@ -121,7 +113,7 @@ module Aruba
121
113
  def rm(paths, options = {})
122
114
  paths = Array(paths).map { |p| ::File.expand_path(p) }
123
115
 
124
- FileUtils.rm_r(paths, options)
116
+ FileUtils.rm_r(paths, **options)
125
117
  end
126
118
 
127
119
  # Get current working directory
@@ -140,22 +132,22 @@ module Aruba
140
132
 
141
133
  # Touch file, directory
142
134
  def touch(args, options)
143
- FileUtils.touch(args, options)
135
+ FileUtils.touch(args, **options)
144
136
  end
145
137
 
146
138
  # Copy file/directory
147
- def cp(args, options)
148
- FileUtils.cp_r(args, options)
139
+ def cp(src, dest)
140
+ FileUtils.cp_r(src, dest)
149
141
  end
150
142
 
151
143
  # Move file/directory
152
- def mv(args, options)
153
- FileUtils.mv(args, options)
144
+ def mv(src, dest)
145
+ FileUtils.mv(src, dest)
154
146
  end
155
147
 
156
148
  # Change mode of file/directory
157
149
  def chmod(mode, args, options)
158
- FileUtils.chmod_R(mode, args, options)
150
+ FileUtils.chmod_R(mode, args, **options)
159
151
  end
160
152
 
161
153
  # Exists and is file
@@ -195,7 +187,7 @@ module Aruba
195
187
 
196
188
  # Check if command is relative
197
189
  #
198
- # @return [TrueClass, FalseClass]
190
+ # @return [Boolean]
199
191
  # true
200
192
  # * bin/command.sh
201
193
  #
@@ -203,13 +195,13 @@ module Aruba
203
195
  # * /bin/command.sh
204
196
  # * command.sh
205
197
  def relative_command?(path)
206
- p = ArubaPath.new(path)
207
- p.relative? && p.depth > 1
198
+ p = Pathname.new(path)
199
+ p.relative? && p.basename != p
208
200
  end
209
201
 
210
202
  # Check if command is relative
211
203
  #
212
- # @return [TrueClass, FalseClass]
204
+ # @return [Boolean]
213
205
  # true
214
206
  # * command.sh
215
207
  #
@@ -226,23 +218,6 @@ module Aruba
226
218
  File.write(path, content)
227
219
  end
228
220
 
229
- # Unescape string
230
- #
231
- # @param [String] string
232
- # The string which should be unescaped, e.g. the output of a command
233
- #
234
- # @return
235
- # The string stripped from escape sequences
236
- def unescape(string, keep_ansi = true)
237
- # rubocop:disable Metrics/LineLength
238
- deprecated('The use of "Aruba.platform.unescape" is deprecated. Please use "#unescape_text" and "#sanitize_text" instead. But be aware it uses a different implementation')
239
- # rubocop:enable Metrics/LineLength
240
-
241
- string = string.gsub('\n', "\n").gsub('\"', '"').gsub('\e', "\e")
242
- string = string.gsub(/\e\[\d+(?>(;\d+)*)m/, '') unless keep_ansi
243
- string
244
- end
245
-
246
221
  # Transform hash to a string table which can be output on stderr/stdout
247
222
  def simple_table(hash, opts = {})
248
223
  SimpleTable.new(hash, opts).to_s
@@ -261,6 +236,10 @@ module Aruba
261
236
  def which(program, path = ENV['PATH'])
262
237
  UnixWhich.new.call(program, path)
263
238
  end
239
+
240
+ def builtin_shell_commands
241
+ []
242
+ end
264
243
  end
265
244
  end
266
245
  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
 
@@ -23,7 +23,7 @@ module Aruba
23
23
  Aruba.platform.absolute_path?(program) || Aruba.platform.relative_command?(program)
24
24
  end
25
25
 
26
- def call(program, path)
26
+ def call(program, _path)
27
27
  return File.expand_path(program) if Aruba.platform.executable?(program)
28
28
 
29
29
  nil
@@ -72,6 +72,7 @@ module Aruba
72
72
  # ENV['PATH']
73
73
  def call(program, path = ENV['PATH'])
74
74
  raise ArgumentError, "ENV['PATH'] cannot be empty" if path.nil? || path.empty?
75
+
75
76
  program = program.to_s
76
77
 
77
78
  whiches.find { |w| w.match? program }.new.call(program, path)
@@ -1,5 +1,3 @@
1
- require 'delegate'
2
-
3
1
  # Aruba
4
2
  module Aruba
5
3
  # Platforms
@@ -9,15 +7,30 @@ module Aruba
9
7
  # This adds `cmd.exec` in front of commmand
10
8
  #
11
9
  # @private
12
- class WindowsCommandString < SimpleDelegator
13
- def initialize(cmd)
14
- __setobj__ format('%s /c "%s"', Aruba.platform.which('cmd.exe'), cmd)
10
+ class WindowsCommandString
11
+ def initialize(command, *arguments)
12
+ @command = command
13
+ @arguments = arguments
15
14
  end
16
15
 
17
16
  # Convert to array
18
17
  def to_a
19
- Shellwords.split( __getobj__.gsub('\\', 'ARUBA_TMP_PATHSEPARATOR') )
20
- .map { |w| w.gsub('ARUBA_TMP_PATHSEPARATOR', '\\') }
18
+ [cmd_path, '/c', [escaped_command, *escaped_arguments].join(' ')]
19
+ end
20
+
21
+ private
22
+
23
+ def escaped_arguments
24
+ @arguments.map { |arg| arg.gsub(/"/, '"""') }
25
+ .map { |arg| / /.match?(arg) ? "\"#{arg}\"" : arg }
26
+ end
27
+
28
+ def escaped_command
29
+ @command.gsub(/ /, '""" """')
30
+ end
31
+
32
+ def cmd_path
33
+ Aruba.platform.which('cmd.exe')
21
34
  end
22
35
  end
23
36
  end
@@ -5,44 +5,42 @@ module Aruba
5
5
  # Platforms
6
6
  module Platforms
7
7
  # Windows is case-insensitive when it accesses its environment variables.
8
- # That means that at the Windows command line:
9
8
  #
10
- # C:>set Path
11
- # C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
12
- # C:>set PATH
13
- # C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
9
+ # To work around this we turn all of the environment variable keys to
10
+ # upper-case so that aruba is ensured that accessing environment variables
11
+ # with upper-case keys will always work. See the following examples.
14
12
  #
15
- # If you access environment variables through ENV, you can access values no
16
- # matter the case of the key:
13
+ # @example Setting Windows environment variables using mixed case
14
+ # C:>set Path
15
+ # C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
16
+ # C:>set PATH
17
+ # C:>Path=.;.\bin;c:\rubys\ruby-2.1.6-p336\bin;
17
18
  #
18
- # irb: > ENV["Path"]
19
- # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
20
- # irb: > ENV["Path"]
21
- # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
19
+ # @example If you access environment variables through ENV, you can access
20
+ # values no matter the case of the key:
21
+ # ENV["Path"] # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
22
+ # ENV["PATH"] # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
22
23
  #
23
- # But if you copy the ENV to a hash, Ruby treats the keys as case sensitive:
24
- #
25
- # irb: > env_copy = ENV.to_hash
26
- # => {"ALLUSERSPROFILE"=>"C:\\ProgramData", "ANSICON"=>"119x1000 (119x58)", "ANSICON_DEF"=>"7", APPDATA"=>"C:\\Users\\blorf\\AppData\\Roaming", ....}
27
- # irb: > env["Path"]
28
- # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
29
- # irb: > env["PATH"]
30
- # => nil
31
- #
32
- # Thus we turn all of the environment variable keys to upper case so that
33
- # aruba is ensured that accessing environment variables with upper case keys
34
- # will always work.
24
+ # @example But if you copy the ENV to a hash, Ruby treats the keys as case sensitive:
25
+ # env_copy = ENV.to_hash
26
+ # # => {
27
+ # "ALLUSERSPROFILE"=>
28
+ # "C:\\ProgramData",
29
+ # "ANSICON"=>"119x1000 (119x58)",
30
+ # "ANSICON_DEF"=>"7",
31
+ # APPDATA" => "C:\\Users\\blorf\\AppData\\Roaming", ....
32
+ # }
33
+ # env["Path"]
34
+ # # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
35
+ # env["PATH"]
36
+ # # => nil
35
37
  class WindowsEnvironmentVariables < UnixEnvironmentVariables
36
- def initialize(env = ENV.to_hash)
37
- @actions = []
38
-
39
- @env = env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
38
+ def initialize(env = ENV)
39
+ super(upcase_env env)
40
40
  end
41
41
 
42
42
  def update(other_env, &block)
43
- other_env = other_env.each_with_object({}) { |(k,v), a| a[k.to_s.upcase] = v }
44
-
45
- super(other_env, &block)
43
+ super(upcase_env(other_env), &block)
46
44
  end
47
45
 
48
46
  def fetch(name, default = UnixEnvironmentVariables::UNDEFINED)
@@ -72,6 +70,20 @@ module Aruba
72
70
  def delete(name)
73
71
  super(name.upcase)
74
72
  end
73
+
74
+ def self.hash_from_env
75
+ upcase_env(ENV)
76
+ end
77
+
78
+ def self.upcase_env(env)
79
+ env.each_with_object({}) { |(k, v), a| a[k.to_s.upcase] = v }
80
+ end
81
+
82
+ private
83
+
84
+ def upcase_env(env)
85
+ self.class.upcase_env(env)
86
+ end
75
87
  end
76
88
  end
77
89
  end
@@ -37,6 +37,10 @@ module Aruba
37
37
  def which(program, path = ENV['PATH'])
38
38
  WindowsWhich.new.call(program, path)
39
39
  end
40
+
41
+ def builtin_shell_commands
42
+ %w(cd dir echo exit set type)
43
+ end
40
44
  end
41
45
  end
42
46
  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
 
@@ -23,11 +23,12 @@ module Aruba
23
23
  Aruba.platform.absolute_path?(program) || Aruba.platform.relative_command?(program)
24
24
  end
25
25
 
26
- def call(program, path)
26
+ def call(program, _path)
27
27
  # Expand `#path_exts`
28
28
  found = Dir[program].first
29
29
 
30
30
  return File.expand_path(found) if found && Aruba.platform.executable?(found)
31
+
31
32
  nil
32
33
  end
33
34
  end
@@ -48,7 +49,7 @@ module Aruba
48
49
  file = File.join(dir, program)
49
50
  # Dir[] doesn't handle backslashes properly, so convert them. Also, if
50
51
  # the program name doesn't have an extension, try them all.
51
- file = file.tr("\\", "/")
52
+ file = file.tr('\\', '/')
52
53
 
53
54
  found = Dir[file].first
54
55
 
@@ -95,7 +96,11 @@ module Aruba
95
96
  private
96
97
 
97
98
  def windows_executable_extentions
98
- 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
99
104
  end
100
105
  end
101
106
  end
@@ -11,9 +11,12 @@ module Aruba
11
11
  #
12
12
  # @private
13
13
  class BasicProcess
14
- attr_reader :exit_status, :environment, :working_directory, :main_class, :io_wait_timeout, :exit_timeout, :startup_wait_time
14
+ attr_reader :exit_status, :environment, :working_directory, :main_class,
15
+ :io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal
15
16
 
16
- def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, environment = ENV.to_hash.dup, main_class = nil, stop_signal = nil, startup_wait_time = 0)
17
+ def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
18
+ environment = Aruba.platform.environment_variables.hash_from_env,
19
+ main_class = nil, stop_signal = nil, startup_wait_time = 0)
17
20
  @cmd = cmd
18
21
  @working_directory = working_directory
19
22
  @environment = environment
@@ -36,7 +39,7 @@ module Aruba
36
39
 
37
40
  # Output pid of process
38
41
  def pid
39
- 'No implemented'
42
+ raise NotImplementedError
40
43
  end
41
44
 
42
45
  # Output stderr and stdout
@@ -45,39 +48,39 @@ module Aruba
45
48
  end
46
49
 
47
50
  def write(*)
48
- NotImplementedError
51
+ raise NotImplementedError
49
52
  end
50
53
 
51
54
  def stdin(*)
52
- NotImplementedError
55
+ raise NotImplementedError
53
56
  end
54
57
 
55
58
  def stdout(*)
56
- NotImplementedError
59
+ raise NotImplementedError
57
60
  end
58
61
 
59
62
  def stderr(*)
60
- NotImplementedError
63
+ raise NotImplementedError
61
64
  end
62
65
 
63
66
  def close_io(*)
64
- NotImplementedError
67
+ raise NotImplementedError
65
68
  end
66
69
 
67
70
  def send_signal(*)
68
- NotImplementedError
71
+ raise NotImplementedError
69
72
  end
70
73
 
71
74
  def filesystem_status
72
- NotImplementedError
75
+ raise NotImplementedError
73
76
  end
74
77
 
75
78
  def content
76
- NotImplementedError
79
+ raise NotImplementedError
77
80
  end
78
81
 
79
82
  def wait
80
- NotImplementedError
83
+ raise NotImplementedError
81
84
  end
82
85
 
83
86
  # Restart a command
@@ -101,14 +104,6 @@ module Aruba
101
104
  @timed_out == true
102
105
  end
103
106
 
104
- # @deprecated
105
- # @private
106
- def run!
107
- Aruba.platform.deprecated('The use of "command#run!" is deprecated. You can simply use "command#start" instead.')
108
-
109
- start
110
- end
111
-
112
107
  # Hook which is run before command is run
113
108
  def before_run; end
114
109
 
@@ -116,19 +111,15 @@ module Aruba
116
111
  def after_run; end
117
112
 
118
113
  def inspect
119
- # rubocop:disable Style/UnneededInterpolation
120
- out = truncate("#{stdout(:wait_for_io => 0).inspect}", 35)
121
- err = truncate("#{stderr(:wait_for_io => 0).inspect}", 35)
122
- # rubocop:enable Style/UnneededInterpolation
114
+ out = truncate(stdout(wait_for_io: 0).inspect, 35)
115
+ err = truncate(stderr(wait_for_io: 0).inspect, 35)
123
116
 
124
117
  fmt = '#<%s:%s commandline="%s": stdout=%s stderr=%s>'
125
- format fmt, self.class, self.object_id, commandline, out, err
118
+ format fmt, self.class, object_id, commandline, out, err
126
119
  end
127
120
 
128
121
  alias to_s inspect
129
122
 
130
- private
131
-
132
123
  def command
133
124
  Shellwords.split(commandline).first
134
125
  end
@@ -139,8 +130,11 @@ module Aruba
139
130
  []
140
131
  end
141
132
 
133
+ private
134
+
142
135
  def truncate(string, max_length)
143
136
  return string if string.length <= max_length
137
+
144
138
  string[0, max_length - 1] + ' ...'
145
139
  end
146
140
  end