command_utils 0.4.6 → 0.5.0
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.
- checksums.yaml +4 -4
- data/lib/command_utils.rb +12 -4
- data/lib/command_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d115f4d2c639bbf1dbb5cea5d3a316cfa00bf585
|
4
|
+
data.tar.gz: 77427273ba959a2fb15cbb47dd55a2fbfdd8623b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b18b3c0307735ec80c27c13065929f781ee2e6e52000e45c2908f40467097058efbe41f5eceea0a29b8a81ac109a6169b1a1345ec1b3a93984b63928d2bcdccd
|
7
|
+
data.tar.gz: 757bcf2eac4b110aa7a950716c9e7e6ad64dec1aaf13ca465df59888a56235ec3b4fd59d812e03eba90d7e17e372c4ab87be04b2ab2ed6f1b827bfcf94313585
|
data/lib/command_utils.rb
CHANGED
@@ -9,7 +9,7 @@ class CommandUtils
|
|
9
9
|
# call-seq:
|
10
10
|
# new([env,] command...)
|
11
11
|
#
|
12
|
-
# Takes command in same format supported by Process
|
12
|
+
# Takes command in same format supported by Process.spawn.
|
13
13
|
def initialize *args
|
14
14
|
first = args.first
|
15
15
|
if first.respond_to? :to_hash
|
@@ -54,6 +54,7 @@ class CommandUtils
|
|
54
54
|
break
|
55
55
|
end
|
56
56
|
end
|
57
|
+
STDERR.puts "#{label}: '#{buffer}'" if self.class.debug
|
57
58
|
yield label, buffer
|
58
59
|
end
|
59
60
|
end
|
@@ -129,6 +130,12 @@ class CommandUtils
|
|
129
130
|
self.new(*args).logger_exec(options)
|
130
131
|
end
|
131
132
|
|
133
|
+
class << self
|
134
|
+
# Output command and its output to STDERR.
|
135
|
+
attr_accessor :debug
|
136
|
+
debug = false
|
137
|
+
end
|
138
|
+
|
132
139
|
private
|
133
140
|
|
134
141
|
# Process.spawn a new process with @env and @command.
|
@@ -142,11 +149,12 @@ class CommandUtils
|
|
142
149
|
else
|
143
150
|
@command
|
144
151
|
end
|
152
|
+
STDERR.puts "Executing: '#{@command.first}'" if self.class.debug
|
145
153
|
@pid = Process.spawn(
|
146
154
|
*spawn_args,
|
147
|
-
in:
|
148
|
-
out:
|
149
|
-
err:
|
155
|
+
in: :close,
|
156
|
+
out: @stdout_write.fileno,
|
157
|
+
err: @stderr_write.fileno,
|
150
158
|
close_others: true,
|
151
159
|
)
|
152
160
|
@stdout_write.close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Pugliese Ornellas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_polisher
|