Class: RailsJwtApi::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/rails_jwt_api/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_jwt_modelObject



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_migrationsObject



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_modelObject



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_fileObject



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_routeObject



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