Class: Lono::Template::ConfigsetInjector
Instance Method Summary
collapse
#reinitialize
#find_blueprint_root, #set_blueprint_root
Constructor Details
Returns a new instance of ConfigsetInjector.
3
4
5
|
# File 'lib/lono/template/configset_injector.rb', line 3
def initialize(options={})
super
end
|
Instance Method Details
#inject ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/lono/template/configset_injector.rb', line 14
def inject
metadata_map.each do |logical_id, metadata_configset|
resource = @cfn["Resources"][logical_id]
unless resource
puts "WARN: Resources.#{logical_id} not found in the template. Are you sure you are specifying the correct resource id in your configsets configs?".color(:yellow)
next
end
resource["Metadata"] ||= metadata_configset["Metadata"]
end
@cfn
end
|
#load_template ⇒ Object
44
45
46
|
# File 'lib/lono/template/configset_injector.rb', line 44
def load_template
YAML.load_file(template_path)
end
|
34
35
36
37
|
# File 'lib/lono/template/configset_injector.rb', line 34
def metadata_map
combiner = Lono::Configset::Combiner.new(@cfn, @options)
combiner.metadata_map
end
|
#run ⇒ Object
7
8
9
10
11
12
|
# File 'lib/lono/template/configset_injector.rb', line 7
def run
@cfn = load_template
@cfn = inject
write(@cfn)
@cfn
end
|
#template_path ⇒ Object
48
49
50
|
# File 'lib/lono/template/configset_injector.rb', line 48
def template_path
"#{Lono.config.output_path}/#{@blueprint}/templates/#{@template}.yml"
end
|
#write(cfn) ⇒ Object
40
41
42
|
# File 'lib/lono/template/configset_injector.rb', line 40
def write(cfn)
IO.write(template_path, YAML.dump(cfn))
end
|