itamae-node_env 0.0.3 → 0.0.4
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 +4 -4
- data/lib/itamae/node_env.rb +18 -6
- data/lib/itamae/node_env/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32f262a5b50b2917c267347f115164a015f8ab90
|
4
|
+
data.tar.gz: 3176500e2eaf820e855256173727063531f0493f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dcb2bb6c76f0d5f64e01136e7f9fbafe7adb9df73ce7d258b51c7c1edfbac53841901a64ca343ea27c89e4c645e0049d414043bde12e313feed28d13a813acd
|
7
|
+
data.tar.gz: 0c36d26a6aa4cf1b630edead68021db0fd8d69071a3c650cef110cb8a78874d7473e2f0d063ffc35868866ea4ef0b245f92e21b502bdd08a85b1f631eb4036a8
|
data/lib/itamae/node_env.rb
CHANGED
@@ -3,13 +3,25 @@ require "itamae/node_env/version"
|
|
3
3
|
|
4
4
|
module Itamae
|
5
5
|
module NodeEnv
|
6
|
-
def
|
7
|
-
val
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def convert_env(val)
|
7
|
+
case val
|
8
|
+
when String then
|
9
|
+
if /\Aenv\[([^\]]+)\]\z/ =~ val
|
10
|
+
return ENV[$1]
|
11
|
+
end
|
12
|
+
when Array then
|
13
|
+
return val.map {|v| convert_env(v)}
|
14
|
+
when Hash then
|
15
|
+
hash = Hash.new
|
16
|
+
val.each {|k,v| hash[k] = convert_env(v)}
|
17
|
+
return hash
|
12
18
|
end
|
19
|
+
return val
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(source_hash = nil, default = nil, &blk)
|
23
|
+
source_hash = convert_env(source_hash)
|
24
|
+
super(source_hash, default, &blk)
|
13
25
|
end
|
14
26
|
end
|
15
27
|
end
|