Sha256: f37d745ae0597ba9b7bfe7f9af6fa4198fd8d6ffd5bdfa3d1535a232e56a61bd

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

module Lono::Inspector
  class Base
    delegate :required_parameters, :optional_parameters, :parameters, :data,
             to: :output_template

    extend Memoist
    include Lono::Blueprint::Root

    def initialize(blueprint, template, options)
      @blueprint, @template, @options = blueprint, template, options
    end

    def run
      blueprints = Lono::Blueprint::Find.one_or_all(@blueprint)
      blueprints.each do |blueprint|
        @blueprint = blueprint # intentional overwrite
        generate_templates
        set_blueprint_root(blueprint)
        templates = @template_name ? [@template_name] : all_templates
        templates.each do |template_name|
          perform(template_name)
        end
      end
    end

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

    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

    def output_template
      Lono::OutputTemplate.new(@blueprint, @template)
    end
    memoize :output_template
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
lono-6.1.11 lib/lono/inspector/base.rb
lono-6.1.10 lib/lono/inspector/base.rb
lono-6.1.9 lib/lono/inspector/base.rb
lono-6.1.8 lib/lono/inspector/base.rb
lono-6.1.7 lib/lono/inspector/base.rb
lono-6.1.6 lib/lono/inspector/base.rb
lono-6.1.5 lib/lono/inspector/base.rb
lono-6.1.4 lib/lono/inspector/base.rb
lono-6.1.3 lib/lono/inspector/base.rb
lono-6.1.2 lib/lono/inspector/base.rb
lono-6.1.1 lib/lono/inspector/base.rb
lono-6.1.0 lib/lono/inspector/base.rb
lono-6.0.1 lib/lono/inspector/base.rb
lono-6.0.0 lib/lono/inspector/base.rb
lono-5.3.4 lib/lono/inspector/base.rb
lono-5.3.3 lib/lono/inspector/base.rb
lono-5.3.2 lib/lono/inspector/base.rb
lono-5.3.1 lib/lono/inspector/base.rb
lono-5.3.0 lib/lono/inspector/base.rb