eac_ruby_utils 0.3.0 → 0.4.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
  SHA256:
3
- metadata.gz: c8b6e4d5bfab257e81419c888fb9463ec1e7766dde3cda6b9e36fa9fd741a35c
4
- data.tar.gz: c5fdbab98b1e9b659c16ec8919995ba824380a140fee28697600ddee97a0cd4c
3
+ metadata.gz: 577ff3a1a8cfb859db63e0424fb7cfc6ea82ce8c3a768d8e751c4e819702cd60
4
+ data.tar.gz: c4966b952f63dbbccd37166a9652337ffca716858621629f342631b3ef6431e3
5
5
  SHA512:
6
- metadata.gz: 5c7279d045fdb2e6af2d3cc90f87605e562c9765a85c7b7988a57fd9da1aca598c14db699fc7af6d0256363352b0ffbebb60cd6ed9fbefe8c473941cee2004f4
7
- data.tar.gz: 1e91ea3a626b6b0d2a439f30db473fef869a708d795e0a48341b2b7b66146813ae38530d8b029ecb6436f55c1c8927884ad8af0cc72bee3f34bcc4a9c42b139a
6
+ metadata.gz: 0421367b017f22db98c807b54ea47dfae0b8185918523507b612ea428c9f2c16306f6a68896bcddcc80f2653d550df85143ed0998537be6a219bd16df3e0116a
7
+ data.tar.gz: ab05a9f30c8445bd88455e8e3920e774902842d2956cc446bd406c60b73d1c44355950a3f624a16de5ac484e090f02662f8405fd9422dd11a8977d46ba54f39a
@@ -5,7 +5,7 @@ module EacRubyUtils
5
5
  # https://github.com/fazibear/colorize
6
6
  module Speaker
7
7
  def puts(string = '')
8
- STDERR.puts(string)
8
+ STDERR.puts(string) # rubocop:disable Style/StderrPuts
9
9
  end
10
10
 
11
11
  def out(string = '')
@@ -14,6 +14,7 @@ module EacRubyUtils
14
14
  else
15
15
  raise "Invalid argument command: #{command}|#{command.class}"
16
16
  end
17
+ @envvars = {}
17
18
  end
18
19
 
19
20
  def append(args)
@@ -28,9 +29,17 @@ module EacRubyUtils
28
29
  "#{@command} [ENV: #{@env}]"
29
30
  end
30
31
 
32
+ def envvar(name, value)
33
+ @envvars[name] = value
34
+ self
35
+ end
36
+
31
37
  def command(options = {})
32
38
  c = @command
33
39
  c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
40
+ e = @envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
41
+ c = "#{e} #{c}" if e.present?
42
+ c = "#{c} | #{@pipe.command}" if @pipe.present?
34
43
  c = @env.command_line(c)
35
44
  append_command_options(c, options)
36
45
  end
@@ -52,6 +61,11 @@ module EacRubyUtils
52
61
  r
53
62
  end
54
63
 
64
+ def pipe(other_command)
65
+ @pipe = other_command
66
+ self
67
+ end
68
+
55
69
  def system!(options = {})
56
70
  return if system(options)
57
71
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-14 00:00:00.000000000 Z
11
+ date: 2019-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport