Class: Merrycms::InstallPagesGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Merrycms::InstallPagesGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/merrycms/install_pages_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_page_and_category_migration_files ⇒ Object
-
#generate_slugs_table ⇒ Object
pages and categories.
Class Method Details
.next_migration_number(dirname) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/generators/merrycms/install_pages_generator.rb', line 12 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
8 9 10 |
# File 'lib/generators/merrycms/install_pages_generator.rb', line 8 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#create_page_and_category_migration_files ⇒ Object
20 21 22 23 |
# File 'lib/generators/merrycms/install_pages_generator.rb', line 20 def create_page_and_category_migration_files migration_template 'create_pages_and_categories_migration.rb', 'db/migrate/create_pages_and_categories.rb' sleep 1 end |
#generate_slugs_table ⇒ Object
pages and categories
26 27 28 29 |
# File 'lib/generators/merrycms/install_pages_generator.rb', line 26 def generate_slugs_table invoke 'friendly_id' sleep 1 end |