Class: HanamiId::Generate::Auth
- Inherits:
-
Hanami::CLI::Commands::Command
- Object
- Hanami::CLI::Commands::Command
- HanamiId::Generate::Auth
- Defined in:
- lib/hanami_id-generators/generate/auth.rb
Constant Summary collapse
- CONTROLLER_ACTIONS =
{ "sessions" => { "new" => "GET", "create" => "POST", "delete" => "DELETE" }, "registrations" => { "index" => "GET", "new" => "GET", "create" => "POST", "edit" => "GET", "show" => "GET", "update" => "PUT", "delete" => "DELETE" } }.freeze
Instance Attribute Summary collapse
-
#auth_templates ⇒ Object
Returns the value of attribute auth_templates.
-
#context ⇒ Object
Returns the value of attribute context.
Instance Method Summary collapse
-
#call(app:, model:, modules:, login_column:, password_column:, id_type:, mode:, **options) ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(*args) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(*args) ⇒ Auth
Returns a new instance of Auth.
49 50 51 52 |
# File 'lib/hanami_id-generators/generate/auth.rb', line 49 def initialize(*args) super @auth_templates = HanamiId::Generators.templates end |
Instance Attribute Details
#auth_templates ⇒ Object
Returns the value of attribute auth_templates.
46 47 48 |
# File 'lib/hanami_id-generators/generate/auth.rb', line 46 def auth_templates @auth_templates end |
#context ⇒ Object
Returns the value of attribute context.
47 48 49 |
# File 'lib/hanami_id-generators/generate/auth.rb', line 47 def context @context end |
Instance Method Details
#call(app:, model:, modules:, login_column:, password_column:, id_type:, mode:, **options) ⇒ Object
rubocop:disable Metrics/AbcSize
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/hanami_id-generators/generate/auth.rb', line 55 def call( app:, model:, modules:, login_column:, password_column:, id_type:, mode:, ** ) HanamiId.logger.info "Generating #{app} app!" HanamiId.model_name = model @context = Hanami::CLI::Commands::Context.new( app: app, model: HanamiId.model_name, repository: HanamiId.repository_name, modules: modules, id_type: id_type, login_column: login_column, password_column: password_column, options: .merge(project: app) ) generate_default_app generate_default_entity generate_default_repository generate_default_migration generate_default_actions(modules) generate_default_routes add_initializer(mode) add_config if mode == "project" inject_authentication_require inject_warden_helper end |