Class: FeatherCmsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- FeatherCmsGenerator
- Defined in:
- lib/generators/feather_cms/feather_cms_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_routes ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/feather_cms/feather_cms_generator.rb', line 17 def add_routes feather_routes = <<-ROUTES mount FeatherCms::Engine => "/feathers" get 'pages/:name' => 'feather_cms/pages#published', :as => 'feather_published_page' ROUTES route feather_routes end |
#create_cms_files ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/feather_cms/feather_cms_generator.rb', line 4 def create_cms_files template 'initializer.rb', 'config/initializers/feather_cms.rb' migration_file = Dir.glob("db/migrate/[0-9]*_*.rb").grep(/\d+_create_feather_pages.rb$/).first migration_number = if migration_file migration_file.gsub(/_create_feather_pages.rb|db|migrate|\//, '') else Time.now.utc.to_s.gsub(/[- :UTC]/, '') end template 'migration.rb', "db/migrate/#{migration_number}_create_feather_pages.rb" end |