class Katapult::TemplatesGenerator

Public Instance Methods

copy_controller_template() click to toggle source
# File lib/generators/katapult/templates/templates_generator.rb, line 17
def copy_controller_template
  copy_generator_templates 'web_ui', 'controller.rb'
end
copy_view_templates() click to toggle source
# File lib/generators/katapult/templates/templates_generator.rb, line 7
def copy_view_templates
  copy_generator_templates 'views', %w[
    _form.html.haml
    edit.html.haml
    index.html.haml
    new.html.haml
    show.html.haml
  ]
end

Private Instance Methods

copy_generator_templates(generator_name, file_list) click to toggle source

file_list should contain paths relative the the respective generator template root

# File lib/generators/katapult/templates/templates_generator.rb, line 25
def copy_generator_templates(generator_name, file_list)
  Array(file_list).each do |filename|
    source = File.join generator_name, 'templates', filename
    destination = File.join 'lib/templates/katapult', generator_name, filename

    copy_file source, destination
  end
end