Class: Lono::Seed::Base
Instance Method Summary
collapse
#create_service_linked_role
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
#rollback_complete?, #testing_update?
#find_stack_set, #stack_set_exists?
#find_stack, #stack_exists?
#reinitialize, #template_path
#find_blueprint_root, #set_blueprint_root
Constructor Details
#initialize(options = {}) ⇒ Base
Override Thor::Base initialize
24
25
26
|
# File 'lib/lono/seed/base.rb', line 24
def initialize(options={})
reinitialize(options)
end
|
Instance Method Details
#create_param_file ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/lono/seed/base.rb', line 48
def create_param_file
@output_template = Lono::Output::Template.new(@blueprint, @template)
if @output_template.parameters.empty?
puts "Template has no parameters."
return
end
lines, shown = [], []
@output_template.parameter_groups.each do |label, parameters|
lines << "# Parameter Group: #{label}"
parameters.each do |name|
parameter_line = parameter_line(name)
lines << parameter_line unless lines.include?(parameter_line)
shown << name
end
lines << ""
end if @output_template.parameter_groups
@output_template.parameters.each do |name, data|
lines << parameter_line(name) unless shown.include?(name)
end
content = lines.join("\n")
dest_path = "configs/#{@blueprint}/params/#{Lono.env}.txt" create_file(dest_path, content) end
|
#create_params ⇒ Object
43
44
45
46
|
# File 'lib/lono/seed/base.rb', line 43
def create_params
return unless params
create_param_file
end
|
#create_variables ⇒ Object
101
102
103
104
105
|
# File 'lib/lono/seed/base.rb', line 101
def create_variables
return unless variables
dest_path = "configs/#{@blueprint}/variables/#{Lono.env}.rb"
create_file(dest_path, variables) end
|
#description_example(description) ⇒ Object
90
91
92
93
94
95
|
# File 'lib/lono/seed/base.rb', line 90
def description_example(description)
return unless description
md = description.match(/(Example|IE): (.*)/)
return unless md
md[2]
end
|
#finish ⇒ Object
108
|
# File 'lib/lono/seed/base.rb', line 108
def finish; end
|
#generate_template ⇒ Object
#parameter_line(name) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/lono/seed/base.rb', line 77
def parameter_line(name)
data = @output_template.parameters[name]
example = description_example(data["Description"])
if data["Default"].nil?
line = "#{name}=#{example} # (required)"
else
default = data["Default"]
line = "# #{name}=#{default}"
line = "#{line} # #{example}" if example
end
line
end
|
#params ⇒ Object
97
98
99
|
# File 'lib/lono/seed/base.rb', line 97
def params
true
end
|
#run ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/lono/seed/base.rb', line 30
def run
generate_template
setup
self.destination_root = Dir.pwd create_params
create_variables
finish
end
|
#setup ⇒ Object
107
|
# File 'lib/lono/seed/base.rb', line 107
def setup; end
|
#variables ⇒ Object
Meant to be overriden by subclass Return String with contents of variables file.
112
113
114
|
# File 'lib/lono/seed/base.rb', line 112
def variables
false
end
|