cfhighlander 0.8.1 → 0.8.2.alpha.1551064496
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfhighlander.config.loader.rb +34 -0
- data/lib/cfhighlander.dsl.template.rb +6 -3
- data/lib/cfhighlander.version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce94745ecdb8897540bd384b79990b1ababcdea8667a2ae3d58f62487ba4716
|
4
|
+
data.tar.gz: 74596ee2a94bcdb39bf42f2f38862cb3b7559a0d6c323c723e637bcbbac60f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb58ace4d06a009ef0e12d6d2236d36870fecfedeef2afca72420be783d3d4fdd50feba6d3180ab182663122204c1f5afd59e623b3d5bea7e26504bdaa54d232
|
7
|
+
data.tar.gz: c79f3f89b9988b7f674d32c578d8173f551126724df2e3419e4176f58dc1a664a7cf49b7c5f46689d272ecb1675b07b47769221461fa7d33c6cd0a9d3f53227d
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative '../hl_ext/common_helper'
|
2
|
+
|
3
|
+
module Cfhighlander
|
4
|
+
|
5
|
+
module Config
|
6
|
+
|
7
|
+
class Loader
|
8
|
+
# creates top-level component configuration
|
9
|
+
# for component.subcomponent.subsubcomponent.....config.yaml
|
10
|
+
# configuration file
|
11
|
+
# method allows for N-level configuration (no limitation on level)
|
12
|
+
# parameters
|
13
|
+
# component_location: component in hierarchy e.g. app.db.rds
|
14
|
+
# config: actual component configuration
|
15
|
+
def get_nested_config(component_location, config)
|
16
|
+
parts = component_location.split('.')
|
17
|
+
i = 0
|
18
|
+
current_config = Hash.new
|
19
|
+
rval = current_config
|
20
|
+
while i < parts.size
|
21
|
+
current_config['components'] = Hash.new
|
22
|
+
component_name = parts[i]
|
23
|
+
current_config['components'][component_name] = { 'config' => Hash.new }
|
24
|
+
current_config = current_config['components'][component_name]['config']
|
25
|
+
i = i+1
|
26
|
+
end
|
27
|
+
current_config.extend config
|
28
|
+
return rval
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -11,6 +11,7 @@ Dir["#{extensions_folder}/*.rb"].each {|f|
|
|
11
11
|
require_relative './cfhighlander.dsl.base'
|
12
12
|
require_relative './cfhighlander.dsl.params'
|
13
13
|
require_relative './cfhighlander.dsl.subcomponent'
|
14
|
+
require_relative './cfhighlander.config.loader'
|
14
15
|
|
15
16
|
module Cfhighlander
|
16
17
|
|
@@ -486,10 +487,13 @@ def CfhighlanderTemplate(&block)
|
|
486
487
|
end
|
487
488
|
|
488
489
|
# process convention over configuration componentname.config.yaml files
|
490
|
+
config_loader = Cfhighlander::Config::Loader.new
|
491
|
+
|
489
492
|
@potential_subcomponent_overrides.each do |name, config|
|
490
493
|
|
491
494
|
# if there is component with given file name
|
492
|
-
|
495
|
+
first_component = name.split('.').first
|
496
|
+
if (not instance.subcomponents.find { |s| s.name == first_component }.nil?)
|
493
497
|
instance.config['components'] = {} unless instance.config.key? 'components'
|
494
498
|
instance.config['components'][name] = {} unless instance.config['components'].key? name
|
495
499
|
instance.config['components'][name]['config'] = {} unless instance.config['components'][name].key? 'config'
|
@@ -503,8 +507,7 @@ def CfhighlanderTemplate(&block)
|
|
503
507
|
end
|
504
508
|
end
|
505
509
|
end
|
506
|
-
|
507
|
-
instance.config['components'][name]['config'].extend config
|
510
|
+
instance.config.extend(config_loader.get_nested_config(name, config))
|
508
511
|
end
|
509
512
|
end
|
510
513
|
|
data/lib/cfhighlander.version.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.2.alpha.1551064496
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Tosic
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- hl_ext/mapping_helper.rb
|
263
263
|
- hl_ext/vpc.rb
|
264
264
|
- lib/cfhighlander.compiler.rb
|
265
|
+
- lib/cfhighlander.config.loader.rb
|
265
266
|
- lib/cfhighlander.dsl.base.rb
|
266
267
|
- lib/cfhighlander.dsl.params.rb
|
267
268
|
- lib/cfhighlander.dsl.subcomponent.rb
|
@@ -296,9 +297,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
296
297
|
version: '0'
|
297
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
299
|
requirements:
|
299
|
-
- - "
|
300
|
+
- - ">"
|
300
301
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
302
|
+
version: 1.3.1
|
302
303
|
requirements: []
|
303
304
|
rubygems_version: 3.0.2
|
304
305
|
signing_key:
|