class Xfabricator::TemplateDefinition

Attributes

template_files[R]
variable_prompts[R]

Public Class Methods

create_definition(definition) click to toggle source
# File lib/xfabricator/template_definition.rb, line 35
def TemplateDefinition.create_definition(definition)
  options = {}
  definition.call(options)
  TemplateDefinition.new options[:template_files], options[:variable_prompts]
end
load_definition(template_def_file) click to toggle source
# File lib/xfabricator/template_definition.rb, line 8
def TemplateDefinition.load_definition(template_def_file)
  unless template_def_file
    raise ArgumentError, 'config file not specified'
  end

  unless template_def_file.exist?
    raise ArgumentError, "template definition file doesn't exist: #{template_def_file}"
  end

 template_def = eval(File.read(template_def_file.to_s), binding)

  unless template_def
    raise RuntimeError, "template definition was not loaded"
  end

  unless template_def.is_a? TemplateDefinition
    raise RuntimeError, "Valid template definition not loaded"
  end

  return template_def
end
new(files, variable_prompts) click to toggle source
# File lib/xfabricator/template_definition.rb, line 30
def initialize(files, variable_prompts)
  @template_files = files
  @variable_prompts = variable_prompts
end