Class: Lono::Inspector::Base
- Inherits:
-
Object
- Object
- Lono::Inspector::Base
- Defined in:
- lib/lono/inspector/base.rb
Instance Method Summary collapse
-
#check_template_exists(template_path) ⇒ Object
Check if the template exists and print friendly error message.
- #data ⇒ Object
- #generate_templates ⇒ Object
-
#initialize(stack_name, options) ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
Constructor Details
#initialize(stack_name, options) ⇒ Base
Returns a new instance of Base.
2 3 4 5 |
# File 'lib/lono/inspector/base.rb', line 2 def initialize(stack_name, ) @stack_name = stack_name @options = end |
Instance Method Details
#check_template_exists(template_path) ⇒ Object
Check if the template exists and print friendly error message. Exits if it does not exist.
25 26 27 28 29 30 |
# File 'lib/lono/inspector/base.rb', line 25 def check_template_exists(template_path) unless File.exist?(template_path) puts "The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.".colorize(:red) exit 1 end end |
#data ⇒ Object
16 17 18 19 20 21 |
# File 'lib/lono/inspector/base.rb', line 16 def data return @data if @data template_path = "#{Lono.config.output_path}/templates/#{@stack_name}.yml" check_template_exists(template_path) @data = YAML.load(IO.read(template_path)) end |
#generate_templates ⇒ Object
7 8 9 |
# File 'lib/lono/inspector/base.rb', line 7 def generate_templates Lono::Template::DSL.new(@options.clone.merge(quiet: true)).run end |
#run ⇒ Object
11 12 13 14 |
# File 'lib/lono/inspector/base.rb', line 11 def run generate_templates perform end |