Class: ActiveAdmin::Cms::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActiveAdmin::Cms::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/active_admin/cms/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
8 9 10 |
# File 'lib/generators/active_admin/cms/install/install_generator.rb', line 8 def self.next_migration_number(dirname) Time.now.strftime("%Y%m%d%H%M%S") end |
.source_root ⇒ Object
12 13 14 |
# File 'lib/generators/active_admin/cms/install/install_generator.rb', line 12 def self.source_root @_active_admin_cms_source_root ||= File.("../templates", __FILE__) end |
Instance Method Details
#create_initializer ⇒ Object
end
24 25 26 |
# File 'lib/generators/active_admin/cms/install/install_generator.rb', line 24 def create_initializer template 'initializer.rb', "config/initializers/active_admin-cms.rb" end |
#create_migrations ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/generators/active_admin/cms/install/install_generator.rb', line 28 def create_migrations Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath| name = File.basename(filepath) migration_template "migrations/#{name}", "db/migrate/#{name.gsub(/^\d+_/,'')}" sleep 1 end end |