consult 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/consult/template.rb +13 -7
- data/lib/consult/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: 8b95340130b792146eeee73303c8a617ef7ce1a9d4748a124e3d8b46658280a5
|
4
|
+
data.tar.gz: 9103d4414a1d933a82a49f917143fb3d6d2d2f0ecd6b11f79089f0d0477c6a75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9047b28026836b804685e285839d58e29bd3b4cfc53ba9e29d207e27d26afe217a15d21d8b74557a17503fe958287e2b35cb3171cfa02382a93ae8846bbe761e
|
7
|
+
data.tar.gz: fbeacae84e7a885817ad3bc9e058ed6c83d1d27e0825466bd0dc334690a8beca29a9bc7a38e85f2136933102e3b425ff5aa70000abcd347adfb9732dfe221d0c
|
data/CHANGELOG.md
CHANGED
data/lib/consult/template.rb
CHANGED
@@ -7,6 +7,8 @@ module Consult
|
|
7
7
|
include Utilities
|
8
8
|
include TemplateFunctions
|
9
9
|
|
10
|
+
LOCATIONS = %i[path paths consul_key consul_keys]
|
11
|
+
|
10
12
|
attr_reader :name, :config
|
11
13
|
|
12
14
|
def initialize(name, config)
|
@@ -53,23 +55,27 @@ module Consult
|
|
53
55
|
dest.mtime < (Time.now - @config[:ttl].to_i)
|
54
56
|
end
|
55
57
|
|
58
|
+
def ordered_locations
|
59
|
+
@config.keys & LOCATIONS
|
60
|
+
end
|
61
|
+
|
56
62
|
private
|
57
63
|
|
58
64
|
# Concatenate all the source templates together, in the order provided
|
59
|
-
# Disk contents go first
|
60
65
|
def contents
|
61
|
-
|
66
|
+
ordered_locations.map do |location|
|
67
|
+
location.to_s.start_with?('consul') ? consul_contents(location) : disk_contents(location)
|
68
|
+
end.join
|
62
69
|
end
|
63
70
|
|
64
|
-
def consul_contents
|
65
|
-
[@config[
|
71
|
+
def consul_contents(location)
|
72
|
+
[@config[location]].compact.flatten.map do |key|
|
66
73
|
Diplomat::Kv.get(key, options: nil, not_found: :return, found: :return)
|
67
74
|
end.join
|
68
75
|
end
|
69
76
|
|
70
|
-
|
71
|
-
|
72
|
-
[path, paths].compact.flatten.map do |file_path|
|
77
|
+
def disk_contents(location)
|
78
|
+
[public_send(location)].compact.flatten.map do |file_path|
|
73
79
|
File.read file_path, encoding: 'utf-8'
|
74
80
|
end.join
|
75
81
|
end
|
data/lib/consult/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consult
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Fraser
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|