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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9312ef766f2c76e235f72677fcf2b6610c3ca68
4
- data.tar.gz: 8b19bb027c0380d2fd8f368b854e98c02104fb06
3
+ metadata.gz: d115f4d2c639bbf1dbb5cea5d3a316cfa00bf585
4
+ data.tar.gz: 77427273ba959a2fb15cbb47dd55a2fbfdd8623b
5
5
  SHA512:
6
- metadata.gz: b2c1bf70020885d1698f22659e4db38b0a0da2da4837f7b42da8e19595e6ba90047babec8cc21193b21d83fb93af9dd06c28c53347b59f94f7adde499bf2f186
7
- data.tar.gz: 134f86c9f2cf97f8d445fb9d4e65fa8e2453e8509955f64636cab81b9ab84a589d4dfa5978d10017941d2c937e20794ff3d203ce87d9b2dcd39fcbbbb4e89cbb
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#spawn.
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: :close,
148
- out: @stdout_write.fileno,
149
- err: @stderr_write.fileno,
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
@@ -1,3 +1,3 @@
1
1
  class CommandUtils
2
- VERSION = '0.4.6'
2
+ VERSION = '0.5.0'
3
3
  end
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.6
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-24 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_polisher