semi 0.3.2 → 0.3.3
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/semi/driver.rb +14 -10
- data/lib/semi/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: 60f7b3709ae388fbca46439b4eb751f5393c1188
|
4
|
+
data.tar.gz: 98495dcaa1f7b8d6e2b598415c0cd2da3e149b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f53f6464cb5279c899693a3329801281f677598e462237080839b184d923680d597ebd6e3011a8a4603a7f7981fddd0f24e9412a6ba9d9c612198622be3860e7
|
7
|
+
data.tar.gz: 2df03e469ef11dc22c35c314068c127c091eff7d976d106edf555770722f758bbfd75c4bcfcaa47c9fb72054aae82af0081009a3fbae8ce7184b67e25767fe5a
|
data/lib/semi/driver.rb
CHANGED
@@ -9,14 +9,16 @@ module Semi
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def start
|
12
|
-
#
|
12
|
+
# Initialize the dictionary with the defaults
|
13
13
|
@dictionary = {}
|
14
14
|
@config.defaults.each_pair do |name,val|
|
15
15
|
@dictionary[name] = Semi::Variable.import(val)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# Now manually merge in the env vars
|
19
|
+
ENV.each_pair do |name, val|
|
20
|
+
@dictionary[name] = Semi::Variable.import(val)
|
21
|
+
end
|
20
22
|
|
21
23
|
# Check any validations being asserted
|
22
24
|
@config.validators.each_key { |key|
|
@@ -38,14 +40,16 @@ module Semi
|
|
38
40
|
# Process the config files and generate final versions
|
39
41
|
@config.files.each do |file|
|
40
42
|
# Read the template file and render
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
if File.exist? file
|
44
|
+
contents = File.open(file, 'r') do |fp|
|
45
|
+
renderer = ERB.new(fp.readlines.join)
|
46
|
+
renderer.result(@dictionary.instance_eval {binding})
|
47
|
+
end
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
+
# Reopen the file and write the rendered contents
|
50
|
+
File.open(file, 'w') do |fp|
|
51
|
+
fp.write(contents)
|
52
|
+
end
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
data/lib/semi/version.rb
CHANGED