precursor 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/config_root.rb +18 -0
- data/lib/hash_vault.rb +15 -0
- data/lib/precursor.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bba5bce81c5c7e1d955c9f5c0acb4cf3898a5512f8fd66c1378469e6afe38081
|
4
|
+
data.tar.gz: 41f71f5e7a582aa678c1a62c5e453c31416de9d10706270b69cbae031ba98299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14d9ed609d3b9d5322fa42da86698b5e6e7eab865c8c190aafc69a10d76f2c47f6be3667281dd9847a1549ec7cb5c41dbaebd3ede2de5e095d3c47e69394c997
|
7
|
+
data.tar.gz: 4b6ec72589f67c6f701e49ec026a7dfc14208ee0632c5d23d25adff565502e3decd51b98ff37db6cd12544bd039441e532b776f42795ef9f19e04330feafe23e
|
data/lib/config_root.rb
CHANGED
@@ -24,7 +24,25 @@ module Precursor
|
|
24
24
|
end
|
25
25
|
|
26
26
|
raise KeyError, "key #{key} not found" unless found
|
27
|
+
|
28
|
+
value = resolve_variables(value) if value.is_a? String
|
29
|
+
|
27
30
|
value
|
28
31
|
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
VAR_PATTERN = /\$\{(?<var_name>[a-zA-Z]+[\w.]+)\}/
|
36
|
+
MAX_DEPTH = 16
|
37
|
+
|
38
|
+
def resolve_variables(str)
|
39
|
+
res = str
|
40
|
+
until (m = res.match(VAR_PATTERN)).nil?
|
41
|
+
k = m[1]
|
42
|
+
v = self[k.to_sym]
|
43
|
+
res = res.sub("${#{k}}", v.to_s)
|
44
|
+
end
|
45
|
+
res
|
46
|
+
end
|
29
47
|
end
|
30
48
|
end
|
data/lib/hash_vault.rb
ADDED
data/lib/precursor.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: precursor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Maraev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: optparse
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/config_root.rb
|
51
51
|
- lib/config_root_builder.rb
|
52
52
|
- lib/env_vault.rb
|
53
|
+
- lib/hash_vault.rb
|
53
54
|
- lib/override_vault.rb
|
54
55
|
- lib/precursor.rb
|
55
56
|
- lib/thread_local_override_vault.rb
|