Class: Buildybuild::CmsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Buildybuild::CmsGenerator
- Defined in:
- lib/generators/buildybuild/cms/cms_generator.rb
Instance Method Summary collapse
- #add_routes ⇒ Object
- #generate_controller ⇒ Object
- #generate_migration ⇒ Object
- #generate_model ⇒ Object
- #generate_views ⇒ Object
Instance Method Details
#add_routes ⇒ Object
28 29 30 |
# File 'lib/generators/buildybuild/cms/cms_generator.rb', line 28 def add_routes insert_into_file "config/routes.rb", generated_routes, before: /^end\n*$/ end |
#generate_controller ⇒ Object
17 18 19 |
# File 'lib/generators/buildybuild/cms/cms_generator.rb', line 17 def generate_controller template("cms_controller.rb", "app/controllers/#{file_names}_controller.rb") end |
#generate_migration ⇒ Object
12 13 14 15 |
# File 'lib/generators/buildybuild/cms/cms_generator.rb', line 12 def generate_migration time_stamp = Time.now.strftime('%Y%m%d%I%M%S') template("cms_migration.rb", "db/migrate/#{time_stamp}_create_#{file_names}.rb") end |
#generate_model ⇒ Object
8 9 10 |
# File 'lib/generators/buildybuild/cms/cms_generator.rb', line 8 def generate_model template("cms_model.rb", "app/models/#{file_name}.rb") end |
#generate_views ⇒ Object
21 22 23 24 25 26 |
# File 'lib/generators/buildybuild/cms/cms_generator.rb', line 21 def generate_views template("cms_new_view.html.haml", "app/views/#{file_names}/new.html.haml") template("cms_edit_view.html.haml", "app/views/#{file_names}/edit.html.haml") template("cms_show_view.html.haml", "app/views/#{file_names}/show.html.haml") template("cms_form_partial.html.haml", "app/views/#{file_names}/_form.html.haml") end |