Class: ScimitarRbac::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ScimitarRbac::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/scimitar_rbac/install_generator.rb
Overview
Generates migrations, models, and controllers for RBAC SCIM resources.
Usage:
rails generate scimitar_rbac:install
Instance Method Summary collapse
- #create_controller_files ⇒ Object
- #create_migration_file ⇒ Object
- #create_model_files ⇒ Object
- #display_post_install_message ⇒ Object
Instance Method Details
#create_controller_files ⇒ Object
29 30 31 32 33 |
# File 'lib/generators/scimitar_rbac/install_generator.rb', line 29 def create_controller_files template "roles_controller.rb.erb", "app/controllers/scim_v2/roles_controller.rb" template "entitlements_controller.rb.erb", "app/controllers/scim_v2/entitlements_controller.rb" template "applications_controller.rb.erb", "app/controllers/scim_v2/applications_controller.rb" end |
#create_migration_file ⇒ Object
19 20 21 |
# File 'lib/generators/scimitar_rbac/install_generator.rb', line 19 def create_migration_file migration_template "migration.rb.erb", "db/migrate/create_scimitar_rbac_tables.rb" end |
#create_model_files ⇒ Object
23 24 25 26 27 |
# File 'lib/generators/scimitar_rbac/install_generator.rb', line 23 def create_model_files template "role_model.rb.erb", "app/models/rbac_role.rb" template "entitlement_model.rb.erb", "app/models/rbac_entitlement.rb" template "application_model.rb.erb", "app/models/rbac_application.rb" end |
#display_post_install_message ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/generators/scimitar_rbac/install_generator.rb', line 35 def say "" say "SCIM RBAC resources have been generated!", :green say "" say "Next steps:" say " 1. Run migrations: rails db:migrate" say " 2. Add routes to config/routes.rb:" say "" say " namespace :scim_v2, path: 'scim/v2' do" say " mount Scimitar::Engine, at: '/'" say " Scimitar::Rbac::RouteHelper.mount_rbac_routes(self," say " roles_controller: 'scim_v2/roles'," say " entitlements_controller: 'scim_v2/entitlements'," say " applications_controller: 'scim_v2/applications'" say " )" say " end" say "" end |