Class: Lono::Inspector::Base
- Inherits:
-
Object
- Object
- Lono::Inspector::Base
show all
- Extended by:
- Memoist
- Includes:
- Blueprint::Root
- Defined in:
- lib/lono/inspector/base.rb
Instance Method Summary
collapse
#bundler_groups, #find_blueprint_root, #require_bundle_gems, #set_blueprint_root
Constructor Details
#initialize(blueprint, template, options) ⇒ Base
Returns a new instance of Base.
9
10
11
|
# File 'lib/lono/inspector/base.rb', line 9
def initialize(blueprint, template, options)
@blueprint, @template, @options = blueprint, template, options
end
|
Instance Method Details
#all_templates ⇒ Object
30
31
32
33
34
35
|
# File 'lib/lono/inspector/base.rb', line 30
def all_templates
templates_path = "#{Lono.config.output_path}/#{@blueprint}/templates"
Dir.glob("#{templates_path}/**").map do |path|
path.sub("#{templates_path}/", '').sub('.yml','') end
end
|
#generate_templates ⇒ Object
26
27
28
|
# File 'lib/lono/inspector/base.rb', line 26
def generate_templates
Lono::Template::Generator.new(@blueprint, @options.clone.merge(quiet: false)).run
end
|
#output_template ⇒ Object
37
38
39
|
# File 'lib/lono/inspector/base.rb', line 37
def output_template
Lono::OutputTemplate.new(@blueprint, @template)
end
|
#run ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/lono/inspector/base.rb', line 13
def run
blueprints = Lono::Blueprint::Find.one_or_all(@blueprint)
blueprints.each do |blueprint|
@blueprint = blueprint generate_templates
set_blueprint_root(blueprint)
templates = @template_name ? [@template_name] : all_templates
templates.each do |template_name|
perform(template_name)
end
end
end
|