eac_ruby_utils 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_ruby_utils/envs/command.rb +24 -5
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fbe0a23a64fda20b9d611c418b3162e45a3f94efab0ab60f9e54d82c7c55d17
|
4
|
+
data.tar.gz: a48d1f5c6dad95964ada07635cc77f54df5dd681ca65bfdb44c7ca280231e665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a1552f7e33250db1f919be80116f186f6f8aa24df98a05a37f34189992b7930b1d37eb35a5e2d9948d38dce83b2e303ea32919b1916a8e3a6b7d717d5e50b0e
|
7
|
+
data.tar.gz: 53adc2c3785559368608d92e17b28d78174653f9c86629f697f46756c4630f6d636943cd814d9a6a09de2ec526dc9dc2e82f7cf80f30d2bb2d785ad363ca450a
|
@@ -37,11 +37,17 @@ module EacRubyUtils
|
|
37
37
|
def command(options = {})
|
38
38
|
c = @command
|
39
39
|
c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
append_command_options(
|
41
|
+
@env.command_line(
|
42
|
+
append_chdir(append_pipe(append_envvars(c)))
|
43
|
+
),
|
44
|
+
options
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def chdir(dir)
|
49
|
+
@chdir = dir
|
50
|
+
self
|
45
51
|
end
|
46
52
|
|
47
53
|
def execute!(options = {})
|
@@ -84,6 +90,19 @@ module EacRubyUtils
|
|
84
90
|
ENV['DEBUG'].to_s.strip != ''
|
85
91
|
end
|
86
92
|
|
93
|
+
def append_envvars(command)
|
94
|
+
e = @envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
|
95
|
+
e.present? ? "#{e} #{command}" : command
|
96
|
+
end
|
97
|
+
|
98
|
+
def append_pipe(command)
|
99
|
+
@pipe.present? ? "#{command} | #{@pipe.command}" : command
|
100
|
+
end
|
101
|
+
|
102
|
+
def append_chdir(command)
|
103
|
+
@chdir.present? ? "(cd '#{@chdir}' ; #{command} )" : command
|
104
|
+
end
|
105
|
+
|
87
106
|
def append_command_options(command, options)
|
88
107
|
command = options[:input].command + ' | ' + command if options[:input]
|
89
108
|
if options[:input_file]
|
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.
|
4
|
+
version: 0.5.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: 2019-04-
|
11
|
+
date: 2019-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|