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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +249 -46
- data/CONTRIBUTING.md +7 -16
- data/LICENSE +1 -1
- data/README.md +37 -30
- data/exe/aruba +1 -1
- data/lib/aruba/api.rb +6 -6
- data/lib/aruba/api/bundler.rb +1 -1
- data/lib/aruba/api/commands.rb +36 -13
- data/lib/aruba/api/core.rb +74 -47
- data/lib/aruba/api/environment.rb +16 -4
- data/lib/aruba/api/filesystem.rb +48 -48
- data/lib/aruba/api/text.rb +15 -3
- data/lib/aruba/aruba_path.rb +24 -95
- data/lib/aruba/basic_configuration.rb +5 -6
- data/lib/aruba/basic_configuration/option.rb +2 -2
- data/lib/aruba/cli.rb +4 -1
- data/lib/aruba/colorizer.rb +10 -99
- data/lib/aruba/config/jruby.rb +15 -5
- data/lib/aruba/config_wrapper.rb +17 -2
- data/lib/aruba/configuration.rb +43 -14
- data/lib/aruba/console.rb +0 -2
- data/lib/aruba/console/help.rb +8 -5
- data/lib/aruba/contracts/absolute_path.rb +3 -3
- data/lib/aruba/contracts/is_power_of_two.rb +2 -2
- data/lib/aruba/contracts/relative_path.rb +3 -3
- data/lib/aruba/cucumber.rb +0 -2
- data/lib/aruba/cucumber/command.rb +199 -110
- data/lib/aruba/cucumber/file.rb +53 -35
- data/lib/aruba/cucumber/hooks.rb +4 -1
- data/lib/aruba/cucumber/testing_frameworks.rb +76 -50
- data/lib/aruba/event_bus.rb +4 -2
- data/lib/aruba/event_bus/name_resolver.rb +9 -8
- data/lib/aruba/events.rb +2 -1
- data/lib/aruba/hooks.rb +2 -4
- data/lib/aruba/in_config_wrapper.rb +10 -3
- data/lib/aruba/initializer.rb +37 -31
- data/lib/aruba/matchers/base/base_matcher.rb +2 -11
- data/lib/aruba/matchers/base/message_indenter.rb +1 -1
- data/lib/aruba/matchers/base/object_formatter.rb +0 -5
- data/lib/aruba/matchers/collection/include_an_object.rb +4 -4
- data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +15 -3
- data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -1
- data/lib/aruba/matchers/command/have_output.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
- data/lib/aruba/matchers/command/have_output_size.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/directory/have_sub_directory.rb +8 -3
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +4 -2
- data/lib/aruba/matchers/path/have_permissions.rb +7 -4
- data/lib/aruba/platform.rb +0 -7
- data/lib/aruba/platforms/announcer.rb +36 -17
- data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
- data/lib/aruba/platforms/command_monitor.rb +40 -6
- data/lib/aruba/platforms/determine_disk_usage.rb +56 -19
- data/lib/aruba/platforms/simple_table.rb +2 -10
- data/lib/aruba/platforms/unix_environment_variables.rb +10 -13
- data/lib/aruba/platforms/unix_platform.rb +16 -12
- data/lib/aruba/platforms/unix_which.rb +1 -1
- data/lib/aruba/platforms/windows_command_string.rb +2 -2
- data/lib/aruba/platforms/windows_environment_variables.rb +9 -2
- data/lib/aruba/platforms/windows_platform.rb +4 -0
- data/lib/aruba/platforms/windows_which.rb +6 -2
- data/lib/aruba/processes/basic_process.rb +14 -16
- data/lib/aruba/processes/debug_process.rb +11 -5
- data/lib/aruba/processes/in_process.rb +4 -2
- data/lib/aruba/processes/spawn_process.rb +32 -16
- data/lib/aruba/rspec.rb +24 -14
- data/lib/aruba/runtime.rb +11 -4
- data/lib/aruba/setup.rb +27 -14
- data/lib/aruba/tasks/docker_helpers.rb +3 -1
- data/lib/aruba/version.rb +1 -1
- metadata +214 -79
- data/.cucumberproignore +0 -3
- data/.document +0 -5
- data/.github/ISSUE_TEMPLATE.md +0 -48
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
- data/.gitignore +0 -38
- data/.rspec +0 -4
- data/.rubocop.yml +0 -13
- data/.rubocop_todo.yml +0 -364
- data/.simplecov +0 -34
- data/.travis.yml +0 -75
- data/.yardopts +0 -11
- data/Dockerfile +0 -67
- data/Gemfile +0 -63
- data/Rakefile +0 -109
- data/TODO.md +0 -13
- data/appveyor.yml +0 -32
- data/aruba.gemspec +0 -36
- data/bin/build +0 -3
- data/bin/console +0 -7
- data/bin/release +0 -3
- data/bin/test +0 -9
- data/config/.gitignore +0 -1
- data/cucumber.yml +0 -17
- data/docker-compose.yml +0 -26
- data/fixtures/cli-app/.gitignore +0 -9
- data/fixtures/cli-app/.rspec +0 -2
- data/fixtures/cli-app/README.md +0 -39
- data/fixtures/cli-app/Rakefile +0 -1
- data/fixtures/cli-app/bin/aruba-test-cli +0 -6
- data/fixtures/cli-app/cli-app.gemspec +0 -27
- data/fixtures/cli-app/features/support/aruba.rb +0 -1
- data/fixtures/cli-app/features/support/env.rb +0 -1
- data/fixtures/cli-app/lib/cli/app.rb +0 -9
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
- data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
- data/fixtures/cli-app/script/console +0 -14
- data/fixtures/cli-app/spec/spec_helper.rb +0 -7
- data/fixtures/cli-app/spec/support/aruba.rb +0 -1
- data/fixtures/copy/file.txt +0 -1
- data/fixtures/empty-app/.gitignore +0 -9
- data/fixtures/empty-app/.rspec +0 -2
- data/fixtures/empty-app/README.md +0 -24
- data/fixtures/empty-app/Rakefile +0 -1
- data/fixtures/empty-app/cli-app.gemspec +0 -27
- data/fixtures/empty-app/lib/cli/app.rb +0 -9
- data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
- data/fixtures/getting-started-app/.gitignore +0 -4
- data/fixtures/getting-started-app/Gemfile +0 -4
- data/fixtures/getting-started-app/README.md +0 -3
- data/fixtures/getting-started-app/features/support/env.rb +0 -1
- 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
|
-
|
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
|
-
|
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')
|
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
|
-
|
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
|
-
|
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
|
-
|
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/
|
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(
|
12
|
-
|
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
|
-
|
35
|
-
|
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
|
-
|
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 =
|
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(
|
66
|
-
DetermineDiskUsage.new.call(
|
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
|
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(
|
140
|
-
FileUtils.cp_r(
|
139
|
+
def cp(src, dest)
|
140
|
+
FileUtils.cp_r(src, dest)
|
141
141
|
end
|
142
142
|
|
143
143
|
# Move file/directory
|
144
|
-
def mv(
|
145
|
-
FileUtils.mv(
|
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 =
|
199
|
-
p.relative? && p.
|
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
|
@@ -21,8 +21,8 @@ module Aruba
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def escaped_arguments
|
24
|
-
@arguments.map { |arg| arg.gsub(/"/, '"""') }
|
25
|
-
|
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
|
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
|
-
# # => {
|
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"]
|
@@ -13,7 +13,7 @@ module Aruba
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call(program, path)
|
16
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
115
|
-
|
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
|