Class: MaquinaComponents::Generators::ScaffoldTemplatesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/maquina_components/scaffold_templates/scaffold_templates_generator.rb

Constant Summary collapse

TEMPLATE_FILES =
%w[
  _form.html.erb.tt
  edit.html.erb.tt
  index.html.erb.tt
  new.html.erb.tt
  partial.html.erb.tt
  show.html.erb.tt
].freeze

Instance Method Summary collapse

Instance Method Details

#copy_templatesObject



21
22
23
24
25
# File 'lib/generators/maquina_components/scaffold_templates/scaffold_templates_generator.rb', line 21

def copy_templates
  TEMPLATE_FILES.each do |filename|
    copy_file filename, "lib/templates/erb/scaffold/#{filename}"
  end
end

#show_post_install_messageObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/maquina_components/scaffold_templates/scaffold_templates_generator.rb', line 27

def show_post_install_message
  say ""
  say "Scaffold templates installed!", :green
  say ""
  say "Rails will now use maquina_components when you run:"
  say "  rails generate scaffold ModelName field:type"
  say ""
  say "Templates are in lib/templates/erb/scaffold/"
  say "Feel free to customize them for your application."
  say ""
end