aruba 0.9.0.pre → 0.9.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -3
- data/History.md +61 -19
- data/README.md +10 -6
- data/TODO.md +6 -1
- data/cucumber.yml +10 -6
- data/features/.nav +72 -0
- data/features/announce.feature +203 -0
- data/features/api/command/extract_text.feature +10 -0
- data/features/api/command/run.feature +6 -6
- data/features/api/command/stop_all_commands.feature +53 -0
- data/features/api/command/terminate_all_commands.feature +53 -0
- data/features/api/command/unescape_text.feature +12 -0
- data/features/api/command/which.feature +3 -3
- data/features/api/core/expand_path.feature +4 -4
- data/features/api/environment/append_environment_variable.feature +18 -8
- data/features/api/environment/prepend_environment_variable.feature +18 -8
- data/features/api/environment/set_environment_variable.feature +33 -16
- data/features/api/filesystem/cd.feature +23 -13
- data/features/api/filesystem/create_directory.feature +2 -2
- data/features/api/filesystem/disk_usage.feature +7 -6
- data/features/api/filesystem/does_exist.feature +2 -2
- data/features/api/filesystem/is_absolute.feature +2 -2
- data/features/api/filesystem/is_directory.feature +2 -2
- data/features/api/filesystem/is_file.feature +2 -2
- data/features/api/filesystem/is_relative.feature +2 -2
- data/features/api/filesystem/move.feature +119 -0
- data/features/cli/console.feature +3 -3
- data/features/commands/debug_command.feature +93 -0
- data/features/commands/environment_variables.feature +64 -0
- data/features/commands/flushing.feature +74 -0
- data/features/commands/interactive.feature +90 -0
- data/features/commands/output/all_output.feature +445 -0
- data/features/commands/output/stdout.feature +66 -0
- data/features/configuration/exit_timeout.feature +5 -5
- data/features/configuration/fixtures_directories.feature +3 -3
- data/features/configuration/fixtures_path_prefix.feature +1 -1
- data/features/configuration/home_directory.feature +4 -4
- data/features/configuration/io_timeout.feature +2 -2
- data/features/configuration/keep_ansi.feature +2 -2
- data/features/configuration/log_level.feature +3 -3
- data/features/configuration/physical_block_size.feature +3 -3
- data/features/configuration/usage.feature +159 -0
- data/features/core/cleanup_aruba_directory.feature +52 -0
- data/features/development/build.feature +16 -0
- data/features/development/test.feature +24 -0
- data/features/file_system_commands.feature +12 -12
- data/features/getting_started/supported_programming_languages.feature +89 -0
- data/features/hooks/after/command.feature +1 -1
- data/features/hooks/before/command.feature +2 -2
- data/features/matchers/collection/include_an_object.feature +72 -0
- data/features/matchers/timeouts.feature +2 -2
- data/features/output.feature +60 -181
- data/features/step_definitions/aruba_dev_steps.rb +17 -10
- data/features/step_definitions/hooks.rb +11 -0
- data/features/steps/commands/exit_statuses.feature +3 -3
- data/features/steps/commands/run.feature +0 -15
- data/features/steps/filesystem/copy.feature +45 -0
- data/features/steps/filesystem/create_directory.feature +47 -0
- data/features/steps/filesystem/create_file.feature +53 -0
- data/features/steps/filesystem/file_content.feature +1 -1
- data/features/steps/filesystem/move.feature +45 -0
- data/features/steps/filesystem/overwrite_file.feature +72 -0
- data/features/steps/filesystem/use_fixture.feature +77 -0
- data/features/usage/install.feature +8 -0
- data/{features/fixtures → fixtures}/cli-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/cli-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/README.md +0 -0
- data/{features/fixtures → fixtures}/cli-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/cli-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/cli-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/features/support/env.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app.rb +0 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +15 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/empty-app → fixtures/cli-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/cli-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/spec/support/aruba.rb +0 -0
- data/{features/fixtures → fixtures}/copy/file.txt +0 -0
- data/{features/fixtures → fixtures}/empty-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/empty-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/README.md +0 -0
- data/{features/fixtures → fixtures}/empty-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/empty-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/empty-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app.rb +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/cli-app → fixtures/empty-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/empty-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/fixtures-app/test.txt +0 -0
- data/fixtures/getting-started-app/.gitignore +4 -0
- data/fixtures/getting-started-app/Gemfile +4 -0
- data/fixtures/getting-started-app/README.md +3 -0
- data/fixtures/getting-started-app/features/support/env.rb +1 -0
- data/{features/fixtures → fixtures}/spawn_process/stderr.sh +0 -0
- data/lib/aruba/announcer.rb +6 -2
- data/lib/aruba/api.rb +0 -16
- data/lib/aruba/api/command.rb +64 -266
- data/lib/aruba/api/core.rb +24 -26
- data/lib/aruba/api/deprecated.rb +370 -12
- data/lib/aruba/api/filesystem.rb +64 -15
- data/lib/aruba/aruba_path.rb +4 -0
- data/lib/aruba/config.rb +1 -1
- data/lib/aruba/cucumber.rb +5 -449
- data/lib/aruba/cucumber/command.rb +378 -0
- data/lib/aruba/cucumber/core.rb +29 -0
- data/lib/aruba/cucumber/environment.rb +30 -0
- data/lib/aruba/cucumber/file.rb +210 -0
- data/lib/aruba/cucumber/hooks.rb +11 -14
- data/lib/aruba/cucumber/rvm.rb +3 -0
- data/lib/aruba/matchers/base/base_matcher.rb +94 -0
- data/lib/aruba/matchers/collection.rb +1 -0
- data/lib/aruba/matchers/collection/all_objects.rb +2 -0
- data/lib/aruba/matchers/collection/include_an_object.rb +120 -0
- data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -3
- data/lib/aruba/matchers/command/have_exit_status.rb +2 -11
- data/lib/aruba/matchers/command/have_finished_in_time.rb +5 -5
- data/lib/aruba/matchers/command/have_output.rb +46 -0
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +42 -0
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +42 -0
- data/lib/aruba/matchers/command/have_output_size.rb +28 -0
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +2 -2
- data/lib/aruba/matchers/file/have_same_file_content.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +1 -1
- data/lib/aruba/platforms/aruba_file_creator.rb +2 -3
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -3
- data/lib/aruba/platforms/determine_disk_usage.rb +23 -0
- data/lib/aruba/platforms/determine_file_size.rb +13 -0
- data/lib/aruba/platforms/disk_usage_calculator.rb +11 -0
- data/lib/aruba/platforms/local_environment.rb +15 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
- data/lib/aruba/platforms/unix_platform.rb +35 -14
- data/lib/aruba/process_monitor.rb +53 -7
- data/lib/aruba/processes/basic_process.rb +25 -5
- data/lib/aruba/processes/debug_process.rb +27 -25
- data/lib/aruba/processes/in_process.rb +7 -22
- data/lib/aruba/processes/spawn_process.rb +74 -31
- data/lib/aruba/rspec.rb +1 -6
- data/lib/aruba/version.rb +1 -1
- data/script/console +0 -1
- data/spec/aruba/api/environment/restore_env_spec.rb +65 -0
- data/spec/aruba/api/environment/set_env_spec.rb +42 -0
- data/spec/aruba/api/filesystem/file_size_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +10 -7
- data/spec/aruba/matchers/command/have_output_size_spec.rb +25 -0
- data/spec/aruba/matchers/command_spec.rb +135 -4
- data/spec/aruba/spawn_process_spec.rb +1 -1
- metadata +107 -65
- data/.nav +0 -12
- data/features/debug.feature +0 -15
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +0 -7
- data/features/flushing.feature +0 -26
- data/features/interactive.feature +0 -66
- data/features/no_clobber.feature +0 -25
- data/lib/aruba/disk_usage_calculator.rb +0 -7
@@ -0,0 +1,28 @@
|
|
1
|
+
# @!method have_output_size(output)
|
2
|
+
# This matchers checks if output has size.
|
3
|
+
#
|
4
|
+
# @param [String] output
|
5
|
+
# The content which should be checked
|
6
|
+
#
|
7
|
+
# @return [TrueClass, FalseClass] The result
|
8
|
+
#
|
9
|
+
# false:
|
10
|
+
# * if output does not have size
|
11
|
+
# true:
|
12
|
+
# * if output has size
|
13
|
+
#
|
14
|
+
# @example Use matcher
|
15
|
+
#
|
16
|
+
# RSpec.describe do
|
17
|
+
# it { expect(file1).to have_output_size(256) }
|
18
|
+
# end
|
19
|
+
RSpec::Matchers.define :have_output_size do |expected|
|
20
|
+
match do |actual|
|
21
|
+
next false unless actual.respond_to? :size
|
22
|
+
|
23
|
+
@actual = actual.size
|
24
|
+
values_match? expected, @actual
|
25
|
+
end
|
26
|
+
|
27
|
+
description { "output has size #{description_of expected}" }
|
28
|
+
end
|
@@ -22,12 +22,12 @@ require 'rspec/expectations/version'
|
|
22
22
|
# end
|
23
23
|
RSpec::Matchers.define :have_file_size do |expected|
|
24
24
|
match do |actual|
|
25
|
-
|
25
|
+
stop_all_commands
|
26
26
|
|
27
27
|
next false unless file?(actual)
|
28
28
|
|
29
29
|
@old_actual = actual
|
30
|
-
@actual =
|
30
|
+
@actual = file_size(actual)
|
31
31
|
@expected = expected.to_i
|
32
32
|
|
33
33
|
values_match?(@expected, @actual)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Aruba
|
2
|
-
|
3
|
-
module Creators
|
2
|
+
module Platforms
|
4
3
|
# Normal File Creator
|
5
4
|
# This class is not meant to be used directly by users.
|
6
5
|
class ArubaFileCreator
|
@@ -14,7 +13,7 @@ module Aruba
|
|
14
13
|
#
|
15
14
|
# @param [TrueClass, FalseClass] check_presence (false)
|
16
15
|
# Check if file exist
|
17
|
-
def
|
16
|
+
def call(path, content, check_presence = false)
|
18
17
|
fail "Expected #{path} to be present" if check_presence && !Aruba.platform.file?(path)
|
19
18
|
|
20
19
|
Aruba.platform.mkdir(File.dirname(path))
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Aruba
|
2
|
-
|
3
|
-
module Creators
|
2
|
+
module Platforms
|
4
3
|
# Create files with fixed size
|
5
4
|
#
|
6
5
|
# This class is not meant to be used directly by users.
|
@@ -18,7 +17,7 @@ module Aruba
|
|
18
17
|
#
|
19
18
|
# @param [TrueClass, FalseClass] check_presence (false)
|
20
19
|
# Check if file exist
|
21
|
-
def
|
20
|
+
def call(path, size, check_presence)
|
22
21
|
fail "Expected #{path} to be present" if check_presence && !Aruba.platform.file?(path)
|
23
22
|
|
24
23
|
Aruba.platform.mkdir(File.dirname(path))
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'aruba/platforms/disk_usage_calculator'
|
2
|
+
|
3
|
+
module Aruba
|
4
|
+
module Platforms
|
5
|
+
class DetermineDiskUsage
|
6
|
+
def call(*args)
|
7
|
+
args = args.flatten
|
8
|
+
|
9
|
+
physical_block_size = args.pop
|
10
|
+
paths = args
|
11
|
+
|
12
|
+
size = paths.flatten.map do |p|
|
13
|
+
DiskUsageCalculator.new.call(
|
14
|
+
p.blocks,
|
15
|
+
physical_block_size
|
16
|
+
)
|
17
|
+
end.inject(0, &:+)
|
18
|
+
|
19
|
+
FileSize.new(size)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'pathname'
|
3
3
|
|
4
|
+
require 'aruba/aruba_path'
|
5
|
+
|
4
6
|
require 'aruba/platforms/simple_table'
|
5
7
|
require 'aruba/platforms/unix_command_string'
|
6
8
|
require 'aruba/platforms/unix_which'
|
9
|
+
require 'aruba/platforms/determine_file_size'
|
10
|
+
require 'aruba/platforms/determine_disk_usage'
|
11
|
+
require 'aruba/platforms/aruba_file_creator'
|
12
|
+
require 'aruba/platforms/aruba_fixed_size_file_creator'
|
13
|
+
require 'aruba/platforms/local_environment'
|
7
14
|
|
8
15
|
module Aruba
|
9
16
|
# This abstracts OS-specific things
|
@@ -28,6 +35,26 @@ module Aruba
|
|
28
35
|
UnixCommandString
|
29
36
|
end
|
30
37
|
|
38
|
+
def determine_file_size(*args)
|
39
|
+
DetermineFileSize.new.call(*args)
|
40
|
+
end
|
41
|
+
|
42
|
+
def determine_disk_usage(*args)
|
43
|
+
DetermineDiskUsage.new.call(*args)
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_file(*args)
|
47
|
+
ArubaFileCreator.new.call(*args)
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_fixed_size_file(*args)
|
51
|
+
ArubaFixedSizeFileCreator.new.call(*args)
|
52
|
+
end
|
53
|
+
|
54
|
+
def with_environment(env = {}, &block)
|
55
|
+
LocalEnvironment.new.call(env, &block)
|
56
|
+
end
|
57
|
+
|
31
58
|
def detect_ruby(cmd)
|
32
59
|
if cmd =~ /^ruby\s/
|
33
60
|
cmd.gsub(/^ruby\s/, "#{current_ruby} ")
|
@@ -83,19 +110,8 @@ module Aruba
|
|
83
110
|
def chdir(dir_name, &block)
|
84
111
|
dir_name = ::File.expand_path(dir_name.to_s)
|
85
112
|
|
86
|
-
|
87
|
-
if RUBY_VERSION <= '1.9.3'
|
88
|
-
old_env = ENV.to_hash.dup
|
89
|
-
else
|
90
|
-
old_env = ENV.to_h.dup
|
91
|
-
end
|
92
|
-
|
93
|
-
ENV['OLDPWD'] = getwd
|
94
|
-
ENV['PWD'] = dir_name
|
113
|
+
with_environment 'OLDPWD' => getwd, 'PWD' => dir_name do
|
95
114
|
::Dir.chdir(dir_name, &block)
|
96
|
-
ensure
|
97
|
-
ENV.clear
|
98
|
-
ENV.update old_env
|
99
115
|
end
|
100
116
|
end
|
101
117
|
|
@@ -109,6 +125,11 @@ module Aruba
|
|
109
125
|
FileUtils.cp_r(args, options)
|
110
126
|
end
|
111
127
|
|
128
|
+
# Move file/directory
|
129
|
+
def mv(args, options)
|
130
|
+
FileUtils.mv(args, options)
|
131
|
+
end
|
132
|
+
|
112
133
|
# Change mode of file/directory
|
113
134
|
def chmod(mode, args, options)
|
114
135
|
FileUtils.chmod_R(mode, args, options)
|
@@ -159,8 +180,8 @@ module Aruba
|
|
159
180
|
# * /bin/command.sh
|
160
181
|
# * command.sh
|
161
182
|
def relative_command?(path)
|
162
|
-
p =
|
163
|
-
p.relative? && p.
|
183
|
+
p = ArubaPath.new(path)
|
184
|
+
p.relative? && p.depth > 1
|
164
185
|
end
|
165
186
|
|
166
187
|
# Check if command is relative
|
@@ -12,13 +12,28 @@ module Aruba
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def last_exit_status
|
15
|
+
Aruba.platform.deprecated('The use of "#last_exit_status" is deprecated. Use "last_command_(started|stopped).exit_status" instead')
|
16
|
+
|
15
17
|
return @last_exit_status if @last_exit_status
|
16
|
-
|
18
|
+
all_commands.each { |c| stop_process(c) }
|
17
19
|
@last_exit_status
|
18
20
|
end
|
19
21
|
|
22
|
+
def last_command_stopped
|
23
|
+
return @last_command_stopped if @last_command_stopped
|
24
|
+
|
25
|
+
all_commands.each { |c| stop_process(c) }
|
26
|
+
|
27
|
+
@last_command_stopped
|
28
|
+
end
|
29
|
+
|
30
|
+
def last_command_started
|
31
|
+
processes.last[1]
|
32
|
+
end
|
33
|
+
|
20
34
|
def stop_process(process)
|
21
|
-
@
|
35
|
+
@last_command_stopped = process
|
36
|
+
@last_exit_status = process.stop(announcer)
|
22
37
|
end
|
23
38
|
|
24
39
|
def terminate_process!(process)
|
@@ -26,13 +41,19 @@ module Aruba
|
|
26
41
|
end
|
27
42
|
|
28
43
|
def stop_processes!
|
29
|
-
|
30
|
-
|
31
|
-
|
44
|
+
Aruba.platform.deprecated('The use of "#stop_processes!" is deprecated. Use "#stop_all_commands" instead')
|
45
|
+
|
46
|
+
stop_all_commands
|
47
|
+
end
|
48
|
+
|
49
|
+
def stop_all_commands
|
50
|
+
all_commands.each { |c| c.stop(announcer) }
|
32
51
|
end
|
33
52
|
|
34
53
|
# Terminate all running processes
|
35
54
|
def terminate_processes
|
55
|
+
Aruba.platform.deprecated('The use of "#terminate_processes" is deprecated. Use "#all_commands.each(&:terminate)" instead')
|
56
|
+
|
36
57
|
processes.each do |_, process|
|
37
58
|
terminate_process(process)
|
38
59
|
stop_process(process)
|
@@ -52,6 +73,8 @@ module Aruba
|
|
52
73
|
end
|
53
74
|
|
54
75
|
def only_processes
|
76
|
+
Aruba.platform.deprecated('The use of "#only_processes" is deprecated. Use "#all_commands" instead')
|
77
|
+
|
55
78
|
processes.collect{ |_, process| process }
|
56
79
|
end
|
57
80
|
|
@@ -87,7 +110,11 @@ module Aruba
|
|
87
110
|
# @return [String]
|
88
111
|
# The stdout of all process which have run before
|
89
112
|
def all_stdout
|
90
|
-
|
113
|
+
# rubocop:disable Metrics/LineLength
|
114
|
+
Aruba.platform.deprecated('The use of "#all_stdout" is deprecated. Use `all_commands.map { |c| c.stdout }.join("\n") instead. If you need to check for some output use "expect(all_commands).to have_output_on_stdout /output/" instead')
|
115
|
+
# rubocop:enable Metrics/LineLength
|
116
|
+
|
117
|
+
stop_all_commands
|
91
118
|
|
92
119
|
if RUBY_VERSION < '1.9'
|
93
120
|
out = ''
|
@@ -104,7 +131,11 @@ module Aruba
|
|
104
131
|
# @return [String]
|
105
132
|
# The stderr of all process which have run before
|
106
133
|
def all_stderr
|
107
|
-
|
134
|
+
# rubocop:disable Metrics/LineLength
|
135
|
+
Aruba.platform.deprecated('The use of "#all_stderr" is deprecated. Use `all_commands.map { |c| c.stderr }.join("\n") instead. If you need to check for some output use "expect(all_commands).to have_output_on_stderr /output/" instead')
|
136
|
+
# rubocop:enable Metrics/LineLength
|
137
|
+
|
138
|
+
stop_all_commands
|
108
139
|
|
109
140
|
if RUBY_VERSION < '1.9'
|
110
141
|
out = ''
|
@@ -121,11 +152,26 @@ module Aruba
|
|
121
152
|
# @return [String]
|
122
153
|
# The stderr and stdout of all process which have run before
|
123
154
|
def all_output
|
155
|
+
# rubocop:disable Metrics/LineLength
|
156
|
+
Aruba.platform.deprecated('The use of "#all_output" is deprecated. Use `all_commands.map { |c| c.output }.join("\n") instead. If you need to check for some output use "expect(all_commands).to have_output /output/" instead')
|
157
|
+
# rubocop:enable Metrics/LineLength
|
158
|
+
|
124
159
|
all_stdout << all_stderr
|
125
160
|
end
|
126
161
|
|
162
|
+
# Return all commands
|
163
|
+
#
|
164
|
+
# @return [Array]
|
165
|
+
# A list of all commands
|
166
|
+
def all_commands
|
167
|
+
processes.collect { |_, process| process }
|
168
|
+
end
|
169
|
+
|
170
|
+
# Clear list of processes
|
127
171
|
def clear
|
128
172
|
processes.clear
|
173
|
+
|
174
|
+
self
|
129
175
|
end
|
130
176
|
end
|
131
177
|
end
|
@@ -12,6 +12,9 @@ module Aruba
|
|
12
12
|
@environment = environment
|
13
13
|
@main_class = main_class
|
14
14
|
@exit_status = nil
|
15
|
+
|
16
|
+
@exit_timeout = exit_timeout
|
17
|
+
@io_wait = io_wait
|
15
18
|
end
|
16
19
|
|
17
20
|
# Return command line
|
@@ -20,8 +23,8 @@ module Aruba
|
|
20
23
|
end
|
21
24
|
|
22
25
|
# Output stderr and stdout
|
23
|
-
def output
|
24
|
-
stdout + stderr
|
26
|
+
def output(opts = {})
|
27
|
+
stdout(opts) + stderr(opts)
|
25
28
|
end
|
26
29
|
|
27
30
|
def write(*)
|
@@ -54,17 +57,34 @@ module Aruba
|
|
54
57
|
@timed_out == true
|
55
58
|
end
|
56
59
|
|
60
|
+
# @deprecated
|
61
|
+
# @private
|
62
|
+
def run!
|
63
|
+
Aruba.platform.deprecated('The use of "command#run!" is deprecated. You can simply use "command#start" instead.')
|
64
|
+
|
65
|
+
start
|
66
|
+
end
|
67
|
+
|
57
68
|
# Hook which is run before command is run
|
58
69
|
def before_run; end
|
59
70
|
|
60
71
|
# Hook which is run after command is run
|
61
72
|
def after_run; end
|
62
73
|
|
63
|
-
|
74
|
+
def inspect
|
75
|
+
out = stdout(:wait_for_io => 0) + stderr(:wait_for_io => 0)
|
76
|
+
|
77
|
+
out = if out.length > 76
|
78
|
+
out[0, 75] + ' ...'
|
79
|
+
else
|
80
|
+
out
|
81
|
+
end
|
64
82
|
|
65
|
-
|
66
|
-
Aruba.platform.which(program, environment['PATH'])
|
83
|
+
format '#<%s:%s commandline="%s": output="%s">', self.class, self.object_id, commandline, out
|
67
84
|
end
|
85
|
+
alias_method :to_s, :inspect
|
86
|
+
|
87
|
+
private
|
68
88
|
|
69
89
|
def command
|
70
90
|
Shellwords.split(commandline).first
|