aggkit 0.4.8.16040 → 0.4.8.19389

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0b5783e207fda2b96ba07e3983f98c779c1413335a491f30deb068515174a83
4
- data.tar.gz: 7f1fc6285238dc03b8087be967dd4a1a0259ebba53036612b08bd7a585cd3e3c
3
+ metadata.gz: 3e05fab4034523d27a1f4f391ba270cc7ae32ab4b03f0ec3ef0bb5cda97aa9fb
4
+ data.tar.gz: 0dcadea42472126b0ae32c3a59a8f06bb03f02e13d9a5583b7f72efeb6e091de
5
5
  SHA512:
6
- metadata.gz: 010ab63311a341609cf1271faece56e75168a61010d46c6b2e14df1cdd9973d76da90e70d0a04b930b17fa23460de432e966a2e79f4bd58320154746d12eaaf8
7
- data.tar.gz: 7045638dc72fcdc61dca651596b41208598e7717f94a090e59d20145f39430fe8065805f190a4be9f7ff3a439068e19a59ead4c05fe5d62830138d5d0333be22
6
+ metadata.gz: 5f0b421bc88b03ba308478bcb254bedeca5e05dec63cfaac6b0c0639ebc02ec83bf65137270099ca7f01adc1ddc9c92b841cc833ec30a4943faa331246b13ef9
7
+ data.tar.gz: 23d995a369826fe9dcc05a94eb32eeb437cebc9597d2af176df15693dab6211bde50f5d98c17e5660355322846e75419172d6e8dd6974907a94fda855ecedb1f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aggkit (0.4.8.16040)
4
+ aggkit (0.4.8.19389)
5
5
  diplomat
6
6
  dotenv
7
7
  json
@@ -19,7 +19,7 @@ GEM
19
19
  faraday (~> 0.9)
20
20
  docile (1.3.1)
21
21
  dotenv (2.7.5)
22
- faraday (0.15.4)
22
+ faraday (0.17.0)
23
23
  multipart-post (>= 1.2, < 3)
24
24
  json (2.2.0)
25
25
  multipart-post (2.1.1)
@@ -97,6 +97,7 @@ if @opts[:depends].any? || @opts[:prefixes].any?
97
97
  end
98
98
 
99
99
  # Preprocess template files
100
+ Aggkit::Consul.erb(*@opts[:templates])
100
101
  Aggkit::Consul.envsubst(*@opts[:templates])
101
102
 
102
103
  exec(*@opts[:exec]) unless @opts[:noexec]
@@ -72,6 +72,22 @@ module Aggkit
72
72
  Aggkit::Exec.execute!(cmd, "envsubst failed: #{cmd}")
73
73
  end
74
74
 
75
+ def erb(*paths)
76
+ paths = paths.flatten.map{|c| c.to_s.strip }.reject(&:empty?)
77
+ paths.each do |path|
78
+ Dir.glob("#{path}/**/*.erb") do |templ|
79
+ erb_file(templ, templ.sub(/\.erb$/, ''))
80
+ end
81
+ end
82
+ end
83
+
84
+ def erb_file(templ, output=nil)
85
+ output ||= templ.sub(/\.erb$/, '')
86
+ Aggkit::Exec.die('filename must ends with .erb or output must be provided') if output.strip == templ.strip
87
+ cmd = "erb '#{templ}' > '#{output}'"
88
+ Aggkit::Exec.execute!(cmd, "erb failed: #{cmd}")
89
+ end
90
+
75
91
  extend ::Aggkit::Consul
76
92
 
77
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8.16040
4
+ version: 0.4.8.19389
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-12 00:00:00.000000000 Z
12
+ date: 2019-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diplomat