Class: Merrycms::InstallAuthGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Merrycms::InstallAuthGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/merrycms/install_auth_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_devise_routes ⇒ Object
- #add_merrycms_routes ⇒ Object
-
#copy_devise_initializer ⇒ Object
Authentication (Devise).
- #create_devise_migration_files ⇒ Object
- #create_user_management_migration_files ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/generators/merrycms/install_auth_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_auth_generator.rb', line 8 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#add_devise_routes ⇒ Object
25 26 27 |
# File 'lib/generators/merrycms/install_auth_generator.rb', line 25 def add_devise_routes route 'devise_for :users' end |
#add_merrycms_routes ⇒ Object
34 35 36 |
# File 'lib/generators/merrycms/install_auth_generator.rb', line 34 def add_merrycms_routes route 'merrycms_routes' end |
#copy_devise_initializer ⇒ Object
Authentication (Devise)
21 22 23 |
# File 'lib/generators/merrycms/install_auth_generator.rb', line 21 def copy_devise_initializer copy_file 'devise_initializer.rb', 'config/initializers/devise.rb' end |
#create_devise_migration_files ⇒ Object
29 30 31 32 |
# File 'lib/generators/merrycms/install_auth_generator.rb', line 29 def create_devise_migration_files migration_template 'devise_create_users_migration.rb', 'db/migrate/devise_create_users.rb' sleep 1 end |
#create_user_management_migration_files ⇒ Object
38 39 40 41 42 43 |
# File 'lib/generators/merrycms/install_auth_generator.rb', line 38 def create_user_management_migration_files migration_template 'create_roles_migration.rb', 'db/migrate/create_roles.rb' sleep 1 migration_template 'roles_users_migration.rb', 'db/migrate/roles_users.rb' sleep 1 end |