Class: RailsIam::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RailsIam::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/rails_iam/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
45 46 47 |
# File 'lib/generators/rails_iam/install_generator.rb', line 45 def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end |
Instance Method Details
#copy_migrations ⇒ Object
12 13 14 15 |
# File 'lib/generators/rails_iam/install_generator.rb', line 12 def copy_migrations say "Copying migration file", :yellow migration_template "create_rails_iam_tables.rb.erb", "db/migrate/create_rails_iam_tables.rb" end |
#create_initializer ⇒ Object
17 18 19 20 |
# File 'lib/generators/rails_iam/install_generator.rb', line 17 def create_initializer say "Copying initializer file", :yellow template "initializer.rb", "config/initializers/rails_iam.rb" end |
#show_readme ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/rails_iam/install_generator.rb', line 22 def show_readme say "\n=======================================================", :yellow say " RailsIam installed successfully!", :green say "=======================================================", :yellow say "Next steps:", :yellow say "" say "1. Open: config/initializers/rails_iam.rb", :green say "" say "2. Configure your user model if you have an existing authentication model:", :green say " • If you have existing authentication (Devise, Auth0, custom, etc.)", :green say " - config.user_class = 'User' (or Account, Member, Admin...)", :green say " - config.current_user_method = :current_user (or :current_account)", :green say " - Add `acts_as_rails_iam_user` to your user (or Account, Member, Admin...) authentication model.", :green say "" say " • If you use RailsIam authentication", :green say " - Keep the default configuration.", :green say "" say "3. Run: bin/rails db:migrate", :green say "" say "You're ready to start using RailsIam 🚀", :green say "=======================================================\n", :yellow end |