module AppArchetype

AppArchetype is the namespace for app_archetype

Constants

VERSION

AppArchetype version

Public Class Methods

render( name, templates_dir, destination_path: Dir.pwd, overwrite: true, variables: [] ) click to toggle source
# File lib/app_archetype.rb, line 16
def self.render(
  name,
  templates_dir,
  destination_path: Dir.pwd,
  overwrite: true,
  variables: []
)
  manifest_file = File.join(templates_dir, name, 'manifest.json')

  manifest = AppArchetype::Template::Manifest.new_from_file(manifest_file)

  template = manifest.template
  template.load

  variables.each { |var| manifest.variables.add(var) }

  manifest.variables.all.each do |var|
    value = AppArchetype::CLI::Prompts.variable_prompt_for(var)
    var.set!(value)
  end

  plan = AppArchetype::Template::Plan.new(
    template,
    manifest.variables,
    destination_path: destination_path,
    overwrite: overwrite
  )

  plan.devise
  plan.execute
end