aruba 1.0.0.pre.alpha.4 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +249 -46
  3. data/CONTRIBUTING.md +7 -16
  4. data/LICENSE +1 -1
  5. data/README.md +37 -30
  6. data/exe/aruba +1 -1
  7. data/lib/aruba/api.rb +6 -6
  8. data/lib/aruba/api/bundler.rb +1 -1
  9. data/lib/aruba/api/commands.rb +36 -13
  10. data/lib/aruba/api/core.rb +74 -47
  11. data/lib/aruba/api/environment.rb +16 -4
  12. data/lib/aruba/api/filesystem.rb +48 -48
  13. data/lib/aruba/api/text.rb +15 -3
  14. data/lib/aruba/aruba_path.rb +24 -95
  15. data/lib/aruba/basic_configuration.rb +5 -6
  16. data/lib/aruba/basic_configuration/option.rb +2 -2
  17. data/lib/aruba/cli.rb +4 -1
  18. data/lib/aruba/colorizer.rb +10 -99
  19. data/lib/aruba/config/jruby.rb +15 -5
  20. data/lib/aruba/config_wrapper.rb +17 -2
  21. data/lib/aruba/configuration.rb +43 -14
  22. data/lib/aruba/console.rb +0 -2
  23. data/lib/aruba/console/help.rb +8 -5
  24. data/lib/aruba/contracts/absolute_path.rb +3 -3
  25. data/lib/aruba/contracts/is_power_of_two.rb +2 -2
  26. data/lib/aruba/contracts/relative_path.rb +3 -3
  27. data/lib/aruba/cucumber.rb +0 -2
  28. data/lib/aruba/cucumber/command.rb +199 -110
  29. data/lib/aruba/cucumber/file.rb +53 -35
  30. data/lib/aruba/cucumber/hooks.rb +4 -1
  31. data/lib/aruba/cucumber/testing_frameworks.rb +76 -50
  32. data/lib/aruba/event_bus.rb +4 -2
  33. data/lib/aruba/event_bus/name_resolver.rb +9 -8
  34. data/lib/aruba/events.rb +2 -1
  35. data/lib/aruba/hooks.rb +2 -4
  36. data/lib/aruba/in_config_wrapper.rb +10 -3
  37. data/lib/aruba/initializer.rb +37 -31
  38. data/lib/aruba/matchers/base/base_matcher.rb +2 -11
  39. data/lib/aruba/matchers/base/message_indenter.rb +1 -1
  40. data/lib/aruba/matchers/base/object_formatter.rb +0 -5
  41. data/lib/aruba/matchers/collection/include_an_object.rb +4 -4
  42. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -0
  43. data/lib/aruba/matchers/command/have_exit_status.rb +15 -3
  44. data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -1
  45. data/lib/aruba/matchers/command/have_output.rb +3 -1
  46. data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
  47. data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
  48. data/lib/aruba/matchers/command/have_output_size.rb +1 -1
  49. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
  50. data/lib/aruba/matchers/directory/have_sub_directory.rb +8 -3
  51. data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
  52. data/lib/aruba/matchers/file/have_file_size.rb +4 -2
  53. data/lib/aruba/matchers/path/have_permissions.rb +7 -4
  54. data/lib/aruba/platform.rb +0 -7
  55. data/lib/aruba/platforms/announcer.rb +36 -17
  56. data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
  57. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
  58. data/lib/aruba/platforms/command_monitor.rb +40 -6
  59. data/lib/aruba/platforms/determine_disk_usage.rb +56 -19
  60. data/lib/aruba/platforms/simple_table.rb +2 -10
  61. data/lib/aruba/platforms/unix_environment_variables.rb +10 -13
  62. data/lib/aruba/platforms/unix_platform.rb +16 -12
  63. data/lib/aruba/platforms/unix_which.rb +1 -1
  64. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  65. data/lib/aruba/platforms/windows_environment_variables.rb +9 -2
  66. data/lib/aruba/platforms/windows_platform.rb +4 -0
  67. data/lib/aruba/platforms/windows_which.rb +6 -2
  68. data/lib/aruba/processes/basic_process.rb +14 -16
  69. data/lib/aruba/processes/debug_process.rb +11 -5
  70. data/lib/aruba/processes/in_process.rb +4 -2
  71. data/lib/aruba/processes/spawn_process.rb +32 -16
  72. data/lib/aruba/rspec.rb +24 -14
  73. data/lib/aruba/runtime.rb +11 -4
  74. data/lib/aruba/setup.rb +27 -14
  75. data/lib/aruba/tasks/docker_helpers.rb +3 -1
  76. data/lib/aruba/version.rb +1 -1
  77. metadata +214 -79
  78. data/.cucumberproignore +0 -3
  79. data/.document +0 -5
  80. data/.github/ISSUE_TEMPLATE.md +0 -48
  81. data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
  82. data/.gitignore +0 -38
  83. data/.rspec +0 -4
  84. data/.rubocop.yml +0 -13
  85. data/.rubocop_todo.yml +0 -364
  86. data/.simplecov +0 -34
  87. data/.travis.yml +0 -75
  88. data/.yardopts +0 -11
  89. data/Dockerfile +0 -67
  90. data/Gemfile +0 -63
  91. data/Rakefile +0 -109
  92. data/TODO.md +0 -13
  93. data/appveyor.yml +0 -32
  94. data/aruba.gemspec +0 -36
  95. data/bin/build +0 -3
  96. data/bin/console +0 -7
  97. data/bin/release +0 -3
  98. data/bin/test +0 -9
  99. data/config/.gitignore +0 -1
  100. data/cucumber.yml +0 -17
  101. data/docker-compose.yml +0 -26
  102. data/fixtures/cli-app/.gitignore +0 -9
  103. data/fixtures/cli-app/.rspec +0 -2
  104. data/fixtures/cli-app/README.md +0 -39
  105. data/fixtures/cli-app/Rakefile +0 -1
  106. data/fixtures/cli-app/bin/aruba-test-cli +0 -6
  107. data/fixtures/cli-app/cli-app.gemspec +0 -27
  108. data/fixtures/cli-app/features/support/aruba.rb +0 -1
  109. data/fixtures/cli-app/features/support/env.rb +0 -1
  110. data/fixtures/cli-app/lib/cli/app.rb +0 -9
  111. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
  112. data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
  113. data/fixtures/cli-app/script/console +0 -14
  114. data/fixtures/cli-app/spec/spec_helper.rb +0 -7
  115. data/fixtures/cli-app/spec/support/aruba.rb +0 -1
  116. data/fixtures/copy/file.txt +0 -1
  117. data/fixtures/empty-app/.gitignore +0 -9
  118. data/fixtures/empty-app/.rspec +0 -2
  119. data/fixtures/empty-app/README.md +0 -24
  120. data/fixtures/empty-app/Rakefile +0 -1
  121. data/fixtures/empty-app/cli-app.gemspec +0 -27
  122. data/fixtures/empty-app/lib/cli/app.rb +0 -9
  123. data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
  124. data/fixtures/getting-started-app/.gitignore +0 -4
  125. data/fixtures/getting-started-app/Gemfile +0 -4
  126. data/fixtures/getting-started-app/README.md +0 -3
  127. data/fixtures/getting-started-app/features/support/env.rb +0 -1
  128. data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
@@ -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
@@ -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,11 @@ 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
+ end
25
+
26
+ def respond_to_missing?(*)
27
+ true
24
28
  end
25
29
  end
26
30
 
@@ -30,7 +34,11 @@ module Aruba
30
34
  end
31
35
 
32
36
  def method_missing(*)
33
- fail NoCommandHasBeenStartedError, 'No last command started available'
37
+ raise NoCommandHasBeenStartedError, 'No last command started available'
38
+ end
39
+
40
+ def respond_to_missing?(*)
41
+ true
34
42
  end
35
43
  end
36
44
 
@@ -44,8 +52,6 @@ module Aruba
44
52
  raise ArgumentError, e.message
45
53
  end
46
54
 
47
- attr_reader :last_command_stopped
48
-
49
55
  # Set last command started
50
56
  #
51
57
  # @param [String] cmd
@@ -70,7 +76,7 @@ module Aruba
70
76
  cmd = cmd.commandline if cmd.respond_to? :commandline
71
77
  command = registered_commands.reverse.find { |c| c.commandline == cmd }
72
78
 
73
- 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?
74
80
 
75
81
  command
76
82
  end
@@ -83,6 +89,34 @@ module Aruba
83
89
  self
84
90
  end
85
91
 
92
+ # Get stdout of all commands
93
+ #
94
+ # @return [String]
95
+ # The stdout of all command which have run before
96
+ def all_stdout
97
+ registered_commands.each(&:stop)
98
+
99
+ registered_commands.each_with_object('') { |e, a| a << e.stdout }
100
+ end
101
+
102
+ # Get stderr of all commands
103
+ #
104
+ # @return [String]
105
+ # The stderr of all command which have run before
106
+ def all_stderr
107
+ registered_commands.each(&:stop)
108
+
109
+ registered_commands.each_with_object('') { |e, a| a << e.stderr }
110
+ end
111
+
112
+ # Get stderr and stdout of all commands
113
+ #
114
+ # @return [String]
115
+ # The stderr and stdout of all command which have run before
116
+ def all_output
117
+ all_stdout << all_stderr
118
+ end
119
+
86
120
  # Register command to monitor
87
121
  def register_command(cmd)
88
122
  registered_commands << cmd
@@ -1,33 +1,70 @@
1
- require 'aruba/platforms/disk_usage_calculator'
1
+ require 'aruba/file_size'
2
2
 
3
- # Aruba
4
3
  module Aruba
5
- # Platforms
6
4
  module Platforms
7
5
  # Determinate disk usage
8
6
  #
9
7
  # @private
10
8
  class DetermineDiskUsage
11
- def call(*args)
12
- args = args.flatten
13
-
14
- deprecated_block_size = args.pop
15
- paths = args
16
-
17
- size = paths.flatten.map do |p|
18
- # TODO: replace the `call` methods signature so that you can use just
19
- # p.minimum_disk_space_used
20
- #
21
- # (Same result, since the values are multiplied, so
22
- # deprecated_block_size is canceled out
23
- DiskUsageCalculator.new.call(
24
- (p.minimum_disk_space_used / deprecated_block_size),
25
- deprecated_block_size
26
- )
9
+ def call(paths)
10
+ size = paths.flatten.map do |path|
11
+ minimum_disk_space_used path
27
12
  end.inject(0, &:+)
28
13
 
29
14
  FileSize.new(size)
30
15
  end
16
+
17
+ private
18
+
19
+ # TODO: Aruba.config.physical_block_size could be allowed to be nil
20
+ # (So the unit size can be autodetected)
21
+
22
+ # Report minimum disk space used
23
+ #
24
+ # This estimates the minimum bytes allocated by the path.
25
+ #
26
+ # E.g. a 1-byte text file on a typical EXT-3 filesystem takes up 4096 bytes
27
+ # (could be more if it was truncated or less for sparse files).
28
+ #
29
+ # Both `File::Stat` and the `stat()` system call will report 8 `blocks`
30
+ # (each "usually" represents 512 bytes). So 8 * 512 is exactly 4096 bytes.
31
+ #
32
+ # (The "magic" 512 bye implied makes the value of "blocks" so confusing).
33
+ #
34
+ # Currently Aruba allows you to set what's called the `physical_block_size`,
35
+ # which is a bit misleading - it's the "512" value. So if you somehow have a
36
+ # "filesystem unit size" of 8192 (instead of a typical 4KB), set the
37
+ # `physical_block_size` to 1024 (yes, divide by 8: 8192/8 = 1024).
38
+ #
39
+ # Ideally, Aruba should provide e.g. `Aruba.config.fs_allocation_unit`
40
+ # (with 4096 as the default), so you wouldn't have to "divide by 8".
41
+ #
42
+ # (typical_fs_unit / typical_dev_bsize = 4096 / 512 = 8)
43
+ #
44
+ #
45
+ # @return [Integer]
46
+ # Total bytes allocate
47
+ #
48
+ # TODO: this is recommended over the above "blocks"
49
+ def minimum_disk_space_used(path)
50
+ # TODO: replace Aruba.config.physical_block_size
51
+ # with something like Aruba.config.fs_allocation_unit
52
+ dev_bsize = Aruba.config.physical_block_size
53
+
54
+ stat = File::Stat.new(path.to_s)
55
+
56
+ blocks = stat.blocks
57
+ return (blocks * dev_bsize) if blocks
58
+
59
+ typical_fs_unit = 4096
60
+ typical_dev_bsize = 512 # google dev_bsize for more info
61
+
62
+ block_multiplier = typical_fs_unit / typical_dev_bsize
63
+ fs_unit_size = dev_bsize * block_multiplier
64
+ fs_units = (stat.size + fs_unit_size - 1) / fs_unit_size
65
+ fs_units = 1 if fs_units.zero?
66
+ fs_units * fs_unit_size
67
+ end
31
68
  end
32
69
  end
33
70
  end
@@ -31,16 +31,8 @@ module Aruba
31
31
 
32
32
  name_size = longest_key.length
33
33
 
34
- if RUBY_VERSION < '2'
35
- rows = []
36
-
37
- hash.each do |k, v|
38
- rows << format("# %-#{name_size}s => %s", k, v)
39
- end
40
- else
41
- rows = hash.each_with_object([]) do |(k, v), a|
42
- a << format("# %-#{name_size}s => %s", k, v)
43
- end
34
+ rows = hash.map do |k, v|
35
+ format("# %-#{name_size}s => %s", k, v)
44
36
  end
45
37
 
46
38
  if opts[:sort] == true
@@ -9,15 +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
12
+ @other_env = other_env.to_h.transform_values(&:to_s)
13
13
 
14
- to_hash = RUBY_VERSION >= '2' ? :to_h : :to_hash
15
-
16
- @other_env = @other_env.public_send(to_hash).each_with_object({}) { |(k, v), a| a[k] = v.to_s }
17
-
18
- @block = if block_given?
19
- block
20
- end
14
+ @block = (block if block_given?)
21
15
  end
22
16
 
23
17
  def call(env)
@@ -56,11 +50,7 @@ module Aruba
56
50
  def initialize(env = ENV)
57
51
  @actions = []
58
52
 
59
- @env = if RUBY_VERSION < '2.0'
60
- env.to_hash
61
- else
62
- env.to_h
63
- end
53
+ @env = env.to_h
64
54
  end
65
55
 
66
56
  # Update environment with other en
@@ -196,6 +186,13 @@ module Aruba
196
186
  value
197
187
  end
198
188
 
189
+ def nest
190
+ old_actions = @actions.dup
191
+ yield(self)
192
+ ensure
193
+ @actions = old_actions
194
+ end
195
+
199
196
  def self.hash_from_env
200
197
  ENV.to_hash
201
198
  end
@@ -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
@@ -113,7 +113,7 @@ module Aruba
113
113
  def rm(paths, options = {})
114
114
  paths = Array(paths).map { |p| ::File.expand_path(p) }
115
115
 
116
- FileUtils.rm_r(paths, options)
116
+ FileUtils.rm_r(paths, **options)
117
117
  end
118
118
 
119
119
  # Get current working directory
@@ -132,22 +132,22 @@ module Aruba
132
132
 
133
133
  # Touch file, directory
134
134
  def touch(args, options)
135
- FileUtils.touch(args, options)
135
+ FileUtils.touch(args, **options)
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
149
149
  def chmod(mode, args, options)
150
- FileUtils.chmod_R(mode, args, options)
150
+ FileUtils.chmod_R(mode, args, **options)
151
151
  end
152
152
 
153
153
  # Exists and is file
@@ -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
@@ -236,6 +236,10 @@ module Aruba
236
236
  def which(program, path = ENV['PATH'])
237
237
  UnixWhich.new.call(program, path)
238
238
  end
239
+
240
+ def builtin_shell_commands
241
+ []
242
+ end
239
243
  end
240
244
  end
241
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
 
@@ -21,8 +21,8 @@ module Aruba
21
21
  private
22
22
 
23
23
  def escaped_arguments
24
- @arguments.map { |arg| arg.gsub(/"/, '"""') }.
25
- map { |arg| arg =~ / / ? "\"#{arg}\"" : arg }
24
+ @arguments.map { |arg| arg.gsub(/"/, '"""') }
25
+ .map { |arg| / /.match?(arg) ? "\"#{arg}\"" : arg }
26
26
  end
27
27
 
28
28
  def escaped_command
@@ -16,13 +16,20 @@ 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
  #
23
24
  # @example But if you copy the ENV to a hash, Ruby treats the keys as case sensitive:
24
25
  # env_copy = ENV.to_hash
25
- # # => {"ALLUSERSPROFILE"=>"C:\\ProgramData", "ANSICON"=>"119x1000 (119x58)", "ANSICON_DEF"=>"7", APPDATA"=>"C:\\Users\\blorf\\AppData\\Roaming", ....}
26
+ # # => {
27
+ # "ALLUSERSPROFILE"=>
28
+ # "C:\\ProgramData",
29
+ # "ANSICON"=>"119x1000 (119x58)",
30
+ # "ANSICON_DEF"=>"7",
31
+ # APPDATA" => "C:\\Users\\blorf\\AppData\\Roaming", ....
32
+ # }
26
33
  # env["Path"]
27
34
  # # => ".;.\bin;c:\rubys\ruby-2.1.6-p336\bin;"
28
35
  # env["PATH"]
@@ -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
 
@@ -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
@@ -12,7 +12,7 @@ module Aruba
12
12
  # @private
13
13
  class BasicProcess
14
14
  attr_reader :exit_status, :environment, :working_directory, :main_class,
15
- :io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal
15
+ :io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal
16
16
 
17
17
  def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
18
18
  environment = Aruba.platform.environment_variables.hash_from_env,
@@ -39,7 +39,7 @@ module Aruba
39
39
 
40
40
  # Output pid of process
41
41
  def pid
42
- 'No implemented'
42
+ raise NotImplementedError
43
43
  end
44
44
 
45
45
  # Output stderr and stdout
@@ -48,39 +48,39 @@ module Aruba
48
48
  end
49
49
 
50
50
  def write(*)
51
- NotImplementedError
51
+ raise NotImplementedError
52
52
  end
53
53
 
54
54
  def stdin(*)
55
- NotImplementedError
55
+ raise NotImplementedError
56
56
  end
57
57
 
58
58
  def stdout(*)
59
- NotImplementedError
59
+ raise NotImplementedError
60
60
  end
61
61
 
62
62
  def stderr(*)
63
- NotImplementedError
63
+ raise NotImplementedError
64
64
  end
65
65
 
66
66
  def close_io(*)
67
- NotImplementedError
67
+ raise NotImplementedError
68
68
  end
69
69
 
70
70
  def send_signal(*)
71
- NotImplementedError
71
+ raise NotImplementedError
72
72
  end
73
73
 
74
74
  def filesystem_status
75
- NotImplementedError
75
+ raise NotImplementedError
76
76
  end
77
77
 
78
78
  def content
79
- NotImplementedError
79
+ raise NotImplementedError
80
80
  end
81
81
 
82
82
  def wait
83
- NotImplementedError
83
+ raise NotImplementedError
84
84
  end
85
85
 
86
86
  # Restart a command
@@ -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