Class: RailsJwtApi::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RailsJwtApi::InstallGenerator
- Defined in:
- lib/generators/rails_jwt_api/install_generator.rb
Instance Method Summary collapse
- #copy_jwt_model ⇒ Object
- #copy_migrations ⇒ Object
- #copy_user_model ⇒ Object
- #generate_config_file ⇒ Object
- #install_route ⇒ Object
Instance Method Details
#copy_jwt_model ⇒ Object
17 18 19 |
# File 'lib/generators/rails_jwt_api/install_generator.rb', line 17 def copy_jwt_model copy_file "jwt.rb", "app/models/jwt.rb" end |
#copy_migrations ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/rails_jwt_api/install_generator.rb', line 21 def copy_migrations # migration_template 'create_users.rb', 'db/migrate/rails_jtw_create_user.rb', migration_version # migration_template 'create_jwts.rb', 'db/migrate/rails_jtw_create_jwts.rb', migration_version copy_file "20211007002206_create_users.rb", "db/migrate/20211007002206_create_users.rb" copy_file "20211007002344_create_jwts.rb", "db/migrate/20211007002344_create_jwts.rb" end |
#copy_user_model ⇒ Object
13 14 15 |
# File 'lib/generators/rails_jwt_api/install_generator.rb', line 13 def copy_user_model copy_file "user.rb", "app/models/user.rb" end |
#generate_config_file ⇒ Object
9 10 11 |
# File 'lib/generators/rails_jwt_api/install_generator.rb', line 9 def generate_config_file copy_file "rails_jwt_api.rb", "config/initializers/rails_jwt_api.rb" end |
#install_route ⇒ Object
5 6 7 |
# File 'lib/generators/rails_jwt_api/install_generator.rb', line 5 def install_route route 'mount RailsJwtApi::Engine => "/rails_jwt_api", as: :rails_jwt_api' end |