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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e24583ffb52dd7b67178ec79684808d14fd0219a9ca6a03aa3a42fc249971fe7
4
- data.tar.gz: 7f42b19cb4f05b087bdcf31593a53c04db7008d5c2670273d4b00134aa2007ce
3
+ metadata.gz: ee93dab3e190066e620443ca9283b26a72ebbd43ea25867eb6e5383195a58e83
4
+ data.tar.gz: ada2b580e00179870e19f2454b56cba23609901150841fd74cba8b5df6785b48
5
5
  SHA512:
6
- metadata.gz: b237aebd3bbd2084945f494d41ef9599f73e5d91f18263fc8434fb061ebc65c61ebde430c9de0fa76833fa7324fcbc12efa308ebcbc8ae8c9427a4a4480b356b
7
- data.tar.gz: 64712d1386bf517399b47aadb51f53fc11177737386201e7c2e25ed26888039ab59dc056c2c48fe2e41b94d9d5aff72a19c11cbc104e7632dc62ceefa07049f8
6
+ metadata.gz: facbcc57178f8c1f30383acc6b31ced2c26a6f1fd171d204509e158983f2374a792e5d3cba8241f669c4c449816ae6db2827c93d4c989ff4c1cd7b77b5c14dfa
7
+ data.tar.gz: 062d0cd9f4f62331ae4161812bb7637aa8ad36645efda66d9a636f21b38de85ae69135d910394a06af8fed4999630dcb7e7438f78b77e8eae5b137d30e16ec3b
@@ -1,12 +1,12 @@
1
1
  class ::Hash
2
2
  def deep_merge(second)
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 }
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 { |k, v|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfhighlander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.alpha.1531270316
4
+ version: 0.3.0.alpha.1531277099
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Tosic