Class: Lono::Template::Generator
- Inherits:
-
Object
- Object
- Lono::Template::Generator
- Includes:
- Blueprint::Root
- Defined in:
- lib/lono/template/generator.rb
Instance Method Summary collapse
-
#initialize(blueprint, options = {}) ⇒ Generator
constructor
A new instance of Generator.
- #run ⇒ Object
- #template_type ⇒ Object
Methods included from Blueprint::Root
#bundler_groups, #find_blueprint_root, #require_bundle_gems, #set_blueprint_root
Constructor Details
#initialize(blueprint, options = {}) ⇒ Generator
Returns a new instance of Generator.
7 8 9 10 11 12 |
# File 'lib/lono/template/generator.rb', line 7 def initialize(blueprint, ={}) @blueprint, @options = blueprint, @template = @options[:template] || @blueprint Lono::ProjectChecker.check set_blueprint_root(@blueprint) end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/lono/template/generator.rb', line 14 def run # Examples: # Erb.new(b, options.clone).run # Dsl.new(b, options.clone).run generator_class = "Lono::Template::#{template_type.classify}" generator_class = Object.const_get(generator_class) generator_class.new(@blueprint, @options.clone).run end |
#template_type ⇒ Object
23 24 25 26 27 |
# File 'lib/lono/template/generator.rb', line 23 def template_type = "#{Lono.blueprint_root}/.meta/config.yml" data = YAML.load_file() data["template_type"] || "dsl" end |