cfhighlander 0.3.0.alpha.1531270316 → 0.3.0.alpha.1531277099
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/hl_ext/common_helper.rb +2 -2
- data/lib/cfhighlander.dsl.template.rb +12 -0
- data/lib/cfhighlander.model.component.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee93dab3e190066e620443ca9283b26a72ebbd43ea25867eb6e5383195a58e83
|
4
|
+
data.tar.gz: ada2b580e00179870e19f2454b56cba23609901150841fd74cba8b5df6785b48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: facbcc57178f8c1f30383acc6b31ced2c26a6f1fd171d204509e158983f2374a792e5d3cba8241f669c4c449816ae6db2827c93d4c989ff4c1cd7b77b5c14dfa
|
7
|
+
data.tar.gz: 062d0cd9f4f62331ae4161812bb7637aa8ad36645efda66d9a636f21b38de85ae69135d910394a06af8fed4999630dcb7e7438f78b77e8eae5b137d30e16ec3b
|
data/hl_ext/common_helper.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
class ::Hash
|
2
2
|
def deep_merge(second)
|
3
|
-
merger = proc {
|
3
|
+
merger = proc {|key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : Array === v1 && Array === v2 ? v1 | v2 : [:undefined, nil, :nil].include?(v2) ? v1 : v2}
|
4
4
|
self.merge(second.to_h, &merger)
|
5
5
|
end
|
6
6
|
|
7
7
|
|
8
8
|
def extend(second)
|
9
|
-
second.each {
|
9
|
+
second.each {|k, v|
|
10
10
|
|
11
11
|
if ((self.key? k) and (v.is_a? Hash and self[k].is_a? Hash))
|
12
12
|
self[k].extend(v)
|
@@ -475,10 +475,22 @@ def CfhighlanderTemplate(&block)
|
|
475
475
|
|
476
476
|
# process convention over configuration componentname.config.yaml files
|
477
477
|
@potential_subcomponent_overrides.each do |name, config|
|
478
|
+
|
479
|
+
# if there is component with given file name
|
478
480
|
if (not instance.subcomponents.find{|s|s.name == name}.nil?)
|
479
481
|
instance.config['components'] = {} unless instance.config.key? 'components'
|
480
482
|
instance.config['components'][name] = {} unless instance.config['components'].key? name
|
481
483
|
instance.config['components'][name]['config'] = {} unless instance.config['components'][name].key? 'config'
|
484
|
+
|
485
|
+
# prevention of infinite recursion when applied to legacy configurations
|
486
|
+
if config.key? 'components'
|
487
|
+
if config['components'].key? name
|
488
|
+
if config['components'][name].key? 'config'
|
489
|
+
config = config['components'][name]['config']
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
482
494
|
instance.config['components'][name]['config'].extend config
|
483
495
|
end
|
484
496
|
end
|
@@ -72,6 +72,10 @@ module Cfhighlander
|
|
72
72
|
Dir["#{@component_dir}/*.config.yaml"].each do |config_file|
|
73
73
|
puts "INFO Loading config for #{@name}: read file:#{config_file} "
|
74
74
|
partial_config = YAML.load(File.read(config_file))
|
75
|
+
if (not partial_config)
|
76
|
+
STDERR.puts "WARNING: Configuration file #{config_file} could not be loaded"
|
77
|
+
next
|
78
|
+
end
|
75
79
|
unless (partial_config.nil? or partial_config.key? 'subcomponent_config_file')
|
76
80
|
@config.extend(partial_config)
|
77
81
|
@component_files << config_file
|