Class: ActiveAdmin::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActiveAdmin::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/active_admin/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #copy_initializer ⇒ Object
- #create_assets ⇒ Object
- #create_migrations ⇒ Object
- #setup_directory ⇒ Object
- #setup_routes ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
14 15 16 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 14 def self.next_migration_number(dirname) Time.now.strftime("%Y%m%d%H%M%S") end |
.source_root ⇒ Object
10 11 12 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 10 def self.source_root @_active_admin_source_root ||= File.("../templates", __FILE__) end |
Instance Method Details
#copy_initializer ⇒ Object
18 19 20 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 18 def copy_initializer template 'active_admin.rb.erb', 'config/initializers/active_admin.rb' end |
#create_assets ⇒ Object
31 32 33 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 31 def create_assets generate "active_admin:assets" end |
#create_migrations ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 35 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 |
#setup_directory ⇒ Object
22 23 24 25 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 22 def setup_directory empty_directory "app/admin" template 'dashboards.rb', 'app/admin/dashboards.rb' end |
#setup_routes ⇒ Object
27 28 29 |
# File 'lib/generators/active_admin/install/install_generator.rb', line 27 def setup_routes route "ActiveAdmin.routes(self)" end |