class Generamba::ModuleTemplate

Represents a single Generamba module template

Attributes

code_files[R]
dependencies[R]
template_name[R]
template_path[R]
test_files[R]

Public Class Methods

new(name, options = nil) click to toggle source
# File lib/generamba/code_generation/module_template.rb, line 9
def initialize(name, options = nil)
  spec_path = TemplateHelper.obtain_spec(name)

  unless options
    spec = YAML.load_file(spec_path)
  else
    spec_source = IO.read(spec_path)
    spec_template = Liquid::Template.parse(spec_source)
    spec_content = spec_template.render(options)
    spec = YAML.load(spec_content)
  end

  @code_files = spec[TEMPLATE_CODE_FILES_KEY]
  @test_files = spec[TEMPLATE_TEST_FILES_KEY]
  @template_name = spec[TEMPLATE_NAME_KEY]
  @template_path = TemplateHelper.obtain_path(name)
  @dependencies = spec[TEMPLATE_DEPENDENCIES_KEY]
end