yaml-exec 0.1.2 → 0.2.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: c1018775903e4dee2f5a3070a8e533dc1eefada5
4
- data.tar.gz: daf3595925af6b05be097e38e74e53fb240c8d6b
3
+ metadata.gz: 81067e6fc5de2d5864b468f5b286733acf632402
4
+ data.tar.gz: 43abf329816987625660db3c6af588a33502b502
5
5
  SHA512:
6
- metadata.gz: efffa1aa24df4ecd34f27f995c5e26d8a62fd12a9db7620944b3e6cd959150dba52c5ba09d59cbc2b0da3b51b84c36ca282d3f1dc7a2edcb1db37f7e631848fe
7
- data.tar.gz: dcba1eeac753efa3a7e4202e936fb60b1466c2a5dcf4a92ddb197e4267a792099db06e9413b1f28084f01958fab81a842ea3929af54468ddf164f164ede0ad7a
6
+ metadata.gz: 5538cc3e98f13f8058809b81bc82b9bb89f8a076261c860230b23596835b9e3a4b8811ea56127bf45ee932ca8f493c8520cc9560919465652573eb2232baa930
7
+ data.tar.gz: 0a6e4e52f5589286634f6428f30e9592d4c31647f50bd49c50fb7f9cfd709d574fc588ca78c47938b3ddf76e8c0324b05ac2a4651587d5bc77bb9f166ce1a18d
@@ -1,5 +1,6 @@
1
1
  require "yaml/exec/version"
2
2
  require 'yaml'
3
+ require 'shellwords'
3
4
 
4
5
  module Yaml
5
6
  module Exec
@@ -21,9 +22,9 @@ module Yaml
21
22
  out = @cmd.dup
22
23
  hash.each do |value, args|
23
24
  cmd_args args, out
24
- out.concat " #{value}"
25
+ out.concat " #{_ value}"
25
26
  end
26
- system out
27
+ spawn out
27
28
  end
28
29
 
29
30
  def cmd_args(args, out)
@@ -31,16 +32,18 @@ module Yaml
31
32
  case v
32
33
  when Hash; cmd_arg_hash(k, v, out)
33
34
  when Array
34
- else out.concat " --#{k} #{v}"
35
+ else out.concat " --#{_ k} #{_ v}"
35
36
  end
36
37
  end
37
38
  end
38
39
 
39
40
  def cmd_arg_hash(key, hash, out)
40
41
  hash.each do |k,v|
41
- out.concat " --#{key} #{k}=#{v}"
42
+ out.concat " --#{_ key} #{_ k}=#{_ v}"
42
43
  end
43
44
  end
45
+
46
+ def _(text) Shellwords.escape text end
44
47
  end
45
48
  end
46
49
  end
@@ -1,5 +1,5 @@
1
1
  module Yaml
2
2
  module Exec
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Takiuchi