Class: Sso::Auth::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sso::Auth::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/sso/auth/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_routes ⇒ Object
- #create_403_page ⇒ Object
- #create_controllers ⇒ Object
- #create_migrations ⇒ Object
- #create_models ⇒ Object
- #create_specs ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
11 12 13 14 |
# File 'lib/generators/sso/auth/install_generator.rb', line 11 def self.next_migration_number(dirname) @number ||= Time.now.strftime('%Y%m%d%H%M%S').to_i @number += 1 end |
Instance Method Details
#add_routes ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/generators/sso/auth/install_generator.rb', line 26 def add_routes route "devise_scope :users do delete 'sign_out' => 'sso/auth/sessions#destroy', :as => :destroy_user_session get 'sign_in' => redirect('/auth/auth/identity'), :as => :new_user_session end" route "devise_for :users, :path => 'auth', :controllers => {:omniauth_callbacks => 'sso/auth/omniauth_callbacks'}, :skip => [:sessions]" end |
#create_403_page ⇒ Object
43 44 45 |
# File 'lib/generators/sso/auth/install_generator.rb', line 43 def create_403_page copy_file 'public/403.html', 'public/403.html' end |
#create_controllers ⇒ Object
22 23 24 |
# File 'lib/generators/sso/auth/install_generator.rb', line 22 def create_controllers template 'app/controllers/manage/application_controller.rb' end |
#create_migrations ⇒ Object
38 39 40 41 |
# File 'lib/generators/sso/auth/install_generator.rb', line 38 def create_migrations migration_template 'db/migrate/create_users.rb' migration_template 'db/migrate/create_permissions.rb' end |
#create_models ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/sso/auth/install_generator.rb', line 16 def create_models template 'app/models/ability.rb' template 'app/models/user.rb' template 'app/models/permission.rb' end |
#create_specs ⇒ Object
34 35 36 |
# File 'lib/generators/sso/auth/install_generator.rb', line 34 def create_specs template 'spec/models/ability_spec.rb' end |