Class: Lono::Inspector::Base

Inherits:
AbstractBase show all
Extended by:
Memoist
Defined in:
lib/lono/inspector/base.rb

Direct Known Subclasses

Graph, Summary

Instance Method Summary collapse

Methods inherited from AbstractBase

#initialize, #reinitialize, #template_path

Methods included from Blueprint::Root

#find_blueprint_root, #set_blueprint_root

Constructor Details

This class inherits a constructor from Lono::AbstractBase

Instance Method Details

#all_templatesObject



25
26
27
28
29
30
# File 'lib/lono/inspector/base.rb', line 25

def all_templates
  templates_path = "#{Lono.config.output_path}/#{@blueprint}/templates"
  Dir.glob("#{templates_path}/**").map do |path|
    path.sub("#{templates_path}/", '').sub('.yml','') # template_name
  end
end

#generateObject



13
14
15
16
17
18
19
# File 'lib/lono/inspector/base.rb', line 13

def generate
  if @options[:source]
    Lono::Cfn::Download.new(@options).run
  else
    generate_templates
  end
end

#generate_templatesObject



21
22
23
# File 'lib/lono/inspector/base.rb', line 21

def generate_templates
  Lono::Template::Generator.new(@options.merge(quiet: false)).run
end

#runObject



5
6
7
8
9
10
11
# File 'lib/lono/inspector/base.rb', line 5

def run
  generate
  templates = @template_name ? [@template_name] : all_templates
  templates.each do |template_name|
    perform(template_name)
  end
end