propel_authentication 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +128 -0
  3. data/README.md +254 -116
  4. data/lib/generators/{propel_auth → propel_authentication}/install_generator.rb +152 -170
  5. data/lib/generators/propel_authentication/templates/application_mailer.rb +6 -0
  6. data/lib/generators/propel_authentication/templates/auth/passwords_controller.rb.tt +132 -0
  7. data/lib/generators/propel_authentication/templates/auth/signup_controller.rb.tt +242 -0
  8. data/lib/generators/{propel_auth/templates → propel_authentication/templates/auth}/tokens_controller.rb.tt +39 -22
  9. data/lib/generators/{propel_auth → propel_authentication}/templates/auth_mailer.rb +3 -1
  10. data/lib/generators/{propel_auth → propel_authentication}/templates/authenticatable.rb +10 -4
  11. data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/confirmable.rb +3 -3
  12. data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/lockable.rb +10 -8
  13. data/lib/generators/{propel_auth/templates/concerns/propel_authentication.rb → propel_authentication/templates/concerns/propel_authentication_concern.rb} +33 -3
  14. data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/recoverable.rb +21 -11
  15. data/lib/generators/propel_authentication/templates/core/configuration_methods.rb +191 -0
  16. data/lib/generators/propel_authentication/templates/db/seeds.rb +75 -0
  17. data/lib/generators/propel_authentication/templates/doc/signup_flow.md +315 -0
  18. data/lib/generators/propel_authentication/templates/models/agency.rb.tt +13 -0
  19. data/lib/generators/propel_authentication/templates/models/agent.rb.tt +13 -0
  20. data/lib/generators/{propel_auth/templates/invitation.rb → propel_authentication/templates/models/invitation.rb.tt} +8 -2
  21. data/lib/generators/propel_authentication/templates/models/organization.rb.tt +12 -0
  22. data/lib/generators/{propel_auth/templates/user.rb → propel_authentication/templates/models/user.rb.tt} +5 -0
  23. data/lib/generators/propel_authentication/templates/propel_authentication.rb.tt +218 -0
  24. data/lib/generators/propel_authentication/templates/routes/auth_routes.rb.tt +55 -0
  25. data/lib/generators/{propel_auth → propel_authentication}/templates/services/auth_notification_service.rb +3 -3
  26. data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/confirmable_test.rb.tt +34 -10
  27. data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/lockable_test.rb.tt +12 -12
  28. data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/propel_authentication_test.rb.tt +2 -2
  29. data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/recoverable_test.rb.tt +11 -11
  30. data/lib/generators/{propel_auth → propel_authentication}/templates/test/controllers/auth/lockable_integration_test.rb.tt +18 -15
  31. data/lib/generators/{propel_auth → propel_authentication}/templates/test/controllers/auth/password_reset_integration_test.rb.tt +38 -40
  32. data/lib/generators/propel_authentication/templates/test/controllers/auth/signup_controller_test.rb.tt +201 -0
  33. data/lib/generators/{propel_auth → propel_authentication}/templates/test/controllers/auth/tokens_controller_test.rb.tt +33 -25
  34. data/lib/generators/{propel_auth → propel_authentication}/templates/test/mailers/auth_mailer_test.rb.tt +51 -36
  35. data/lib/generators/{propel_auth → propel_authentication}/templates/user_test.rb.tt +1 -1
  36. data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/email_confirmation.html.erb +2 -2
  37. data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/email_confirmation.text.erb +1 -1
  38. data/lib/generators/{propel_auth → propel_authentication}/test/generators/authentication/install_generator_test.rb +4 -4
  39. data/lib/generators/{propel_auth → propel_authentication}/test/generators/authentication/uninstall_generator_test.rb +1 -1
  40. data/lib/generators/{propel_auth → propel_authentication}/test/integration/generator_integration_test.rb +1 -1
  41. data/lib/generators/{propel_auth → propel_authentication}/test/integration/multi_version_generator_test.rb +13 -12
  42. data/lib/generators/{propel_auth → propel_authentication}/unpack_generator.rb +55 -38
  43. data/lib/propel_authentication.rb +3 -0
  44. metadata +101 -98
  45. data/lib/generators/propel_auth/core/configuration_methods.rb +0 -134
  46. data/lib/generators/propel_auth/pack_generator.rb +0 -277
  47. data/lib/generators/propel_auth/templates/agency.rb +0 -7
  48. data/lib/generators/propel_auth/templates/agent.rb +0 -7
  49. data/lib/generators/propel_auth/templates/auth/base_passwords_controller.rb.tt +0 -99
  50. data/lib/generators/propel_auth/templates/auth/base_tokens_controller.rb.tt +0 -90
  51. data/lib/generators/propel_auth/templates/auth/passwords_controller.rb.tt +0 -126
  52. data/lib/generators/propel_auth/templates/db/seeds.rb +0 -29
  53. data/lib/generators/propel_auth/templates/organization.rb +0 -7
  54. data/lib/generators/propel_auth/templates/propel_auth.rb.tt +0 -141
  55. data/lib/propel_auth.rb +0 -3
  56. /data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/rack_session_disable.rb +0 -0
  57. /data/lib/generators/{propel_auth → propel_authentication}/templates/config/environments/development_email.rb +0 -0
  58. /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_agencies.rb +0 -0
  59. /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_agents.rb +0 -0
  60. /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_invitations.rb +0 -0
  61. /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_organizations.rb +0 -0
  62. /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_users.rb +0 -0
  63. /data/lib/generators/{propel_auth → propel_authentication}/templates/test/mailers/previews/auth_mailer_preview.rb +0 -0
  64. /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/account_unlock.html.erb +0 -0
  65. /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/account_unlock.text.erb +0 -0
  66. /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/password_reset.html.erb +0 -0
  67. /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/password_reset.text.erb +0 -0
  68. /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/user_invitation.html.erb +0 -0
  69. /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/user_invitation.text.erb +0 -0
  70. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/Dockerfile +0 -0
  71. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/Gemfile +0 -0
  72. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/README.md +0 -0
  73. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/Rakefile +0 -0
  74. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/assets/stylesheets/application.css +0 -0
  75. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/controllers/application_controller.rb +0 -0
  76. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/helpers/application_helper.rb +0 -0
  77. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/jobs/application_job.rb +0 -0
  78. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/mailers/application_mailer.rb +0 -0
  79. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/models/application_record.rb +0 -0
  80. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/layouts/application.html.erb +0 -0
  81. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/layouts/mailer.html.erb +0 -0
  82. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/layouts/mailer.text.erb +0 -0
  83. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/pwa/manifest.json.erb +0 -0
  84. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/pwa/service-worker.js +0 -0
  85. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/brakeman +0 -0
  86. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/dev +0 -0
  87. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/docker-entrypoint +0 -0
  88. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/rails +0 -0
  89. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/rake +0 -0
  90. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/rubocop +0 -0
  91. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/setup +0 -0
  92. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/thrust +0 -0
  93. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/application.rb +0 -0
  94. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/boot.rb +0 -0
  95. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/cable.yml +0 -0
  96. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/credentials.yml.enc +0 -0
  97. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/database.yml +0 -0
  98. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environment.rb +0 -0
  99. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/development.rb +0 -0
  100. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/production.rb +0 -0
  101. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/test.rb +0 -0
  102. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/assets.rb +0 -0
  103. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/content_security_policy.rb +0 -0
  104. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  105. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/inflections.rb +0 -0
  106. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/locales/en.yml +0 -0
  107. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/master.key +0 -0
  108. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/puma.rb +0 -0
  109. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/routes.rb +0 -0
  110. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/storage.yml +0 -0
  111. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config.ru +0 -0
  112. /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/db/schema.rb +0 -0
  113. /data/lib/generators/{propel_auth → propel_authentication}/test/generators/authentication/controllers/tokens_controller_test.rb +0 -0
@@ -4,19 +4,19 @@
4
4
  # PropelAuth unpacker that extracts the authentication GENERATOR into the host application
5
5
  #
6
6
  # Usage:
7
- # rails generate propel_auth:unpack # Unpack entire generator (code + templates)
8
- # rails generate propel_auth:unpack --force # Overwrite existing generator files
9
- # rails generate propel_auth:unpack --templates-only # Only copy templates, not generator logic
10
- # rails generate propel_auth:unpack --models-only # Only copy model templates
11
- # rails generate propel_auth:unpack --controllers-only # Only copy controller templates
7
+ # rails generate propel_authentication:unpack # Unpack entire generator (code + templates)
8
+ # rails generate propel_authentication:unpack --force # Overwrite existing generator files
9
+ # rails generate propel_authentication:unpack --templates-only # Only copy templates, not generator logic
10
+ # rails generate propel_authentication:unpack --models-only # Only copy model templates
11
+ # rails generate propel_authentication:unpack --controllers-only # Only copy controller templates
12
12
  #
13
- # This extracts the PropelAuth generator from the gem into lib/generators/propel_auth/
13
+ # This extracts the PropelAuthentication generator from the gem into lib/generators/propel_authentication/
14
14
  # so you can customize the generator logic and templates for your specific needs.
15
15
  #
16
- class PropelAuth::UnpackGenerator < Rails::Generators::Base
16
+ class PropelAuthentication::UnpackGenerator < Rails::Generators::Base
17
17
  source_root File.expand_path("templates", __dir__)
18
18
 
19
- desc "Extract PropelAuth generator code from gem to lib/generators/propel_auth/ for full customization"
19
+ desc "Extract PropelAuthentication generator code from gem to lib/generators/propel_authentication/ for full customization"
20
20
 
21
21
  class_option :force,
22
22
  type: :boolean,
@@ -47,7 +47,7 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
47
47
  show_welcome_message
48
48
 
49
49
  components_to_unpack = determine_components
50
- destination_path = "lib/generators/propel_auth"
50
+ destination_path = "lib/generators/propel_authentication"
51
51
 
52
52
  if File.exist?(destination_path) && !options[:force]
53
53
  say "⚠️ #{destination_path} already exists (use --force to overwrite)", :yellow
@@ -69,11 +69,11 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
69
69
  say "║ UNPACK PROPEL AUTH GENERATOR ║", :cyan
70
70
  say "╚══════════════════════════════════════╝", :cyan
71
71
  say ""
72
- say "This extracts the PropelAuth generator from the gem into your app", :blue
73
- say "at lib/generators/propel_auth/ so you can customize generator logic and templates.", :blue
72
+ say "This extracts the PropelAuthentication generator from the gem into your app", :blue
73
+ say "at lib/generators/propel_authentication/ so you can customize generator logic and templates.", :blue
74
74
  say ""
75
75
  say "📦 FROM: Gem-based generator (black box)", :yellow
76
- say "📁 TO: Local generator in lib/generators/propel_auth/ (fully customizable)", :green
76
+ say "📁 TO: Local generator in lib/generators/propel_authentication/ (fully customizable)", :green
77
77
  say ""
78
78
  end
79
79
 
@@ -85,10 +85,10 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
85
85
  elsif options[:tests_only]
86
86
  return %w[tests]
87
87
  elsif options[:templates_only]
88
- return %w[models controllers tests views concerns services config db]
88
+ return %w[models controllers tests views concerns services config db core doc]
89
89
  else
90
90
  # Default: everything including generator logic
91
- return %w[models controllers tests views concerns services config db generator]
91
+ return %w[models controllers tests views concerns services config db core doc generator]
92
92
  end
93
93
  end
94
94
 
@@ -118,6 +118,10 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
118
118
  copy_config_templates(destination_path)
119
119
  when 'db'
120
120
  copy_db_templates(destination_path)
121
+ when 'core'
122
+ copy_core_templates(destination_path)
123
+ when 'doc'
124
+ copy_doc_templates(destination_path)
121
125
  when 'generator'
122
126
  copy_generator_logic(destination_path)
123
127
  else
@@ -128,26 +132,27 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
128
132
  def copy_model_templates(destination_path)
129
133
  say "📂 Extracting model generator templates...", :blue
130
134
 
131
- model_files = %w[
132
- user.rb
133
- organization.rb
134
- agency.rb
135
- agent.rb
136
- invitation.rb
137
- authenticatable.rb
138
- ]
139
-
140
- model_files.each do |file|
141
- copy_template_file(file, destination_path)
142
- end
135
+ # Copy the models directory with all .rb.tt templates
136
+ copy_directory_templates("models", destination_path)
137
+
138
+ # Also copy the authenticatable concern from root
139
+ copy_template_file("authenticatable.rb", destination_path)
143
140
 
144
141
  say " ✅ Model generator templates extracted", :green
145
142
  end
146
143
 
144
+ def copy_core_templates(destination_path)
145
+ say "📂 Extracting core generator templates...", :blue
146
+
147
+ copy_template_file("core/configuration_methods.rb", destination_path)
148
+
149
+ say " ✅ Core generator templates extracted", :green
150
+ end
151
+
147
152
  def copy_controller_templates(destination_path)
148
153
  say "📂 Extracting controller generator templates...", :blue
149
154
 
150
- copy_template_file("tokens_controller.rb.tt", destination_path)
155
+ # All controller templates are now in the auth directory for better organization
151
156
  copy_directory_templates("auth", destination_path)
152
157
 
153
158
  say " ✅ Controller generator templates extracted", :green
@@ -190,8 +195,7 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
190
195
  def copy_config_templates(destination_path)
191
196
  say "📂 Extracting config generator templates...", :blue
192
197
 
193
- copy_template_file("propel_auth.rb", destination_path)
194
- copy_template_file("propel_auth_configuration.rb.tt", destination_path)
198
+ copy_template_file("propel_authentication.rb.tt", destination_path)
195
199
  copy_directory_templates("config", destination_path)
196
200
 
197
201
  say " ✅ Config generator templates extracted", :green
@@ -205,6 +209,14 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
205
209
  say " ✅ Database generator templates extracted", :green
206
210
  end
207
211
 
212
+ def copy_doc_templates(destination_path)
213
+ say "📂 Extracting documentation generator templates...", :blue
214
+
215
+ copy_directory_templates("doc", destination_path)
216
+
217
+ say " ✅ Documentation generator templates extracted", :green
218
+ end
219
+
208
220
  def copy_generator_logic(destination_path)
209
221
  say "📂 Extracting generator logic code...", :blue
210
222
 
@@ -217,12 +229,16 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
217
229
  source_content = File.read(source_generator)
218
230
 
219
231
  # Update module declaration to be properly namespaced in host app
232
+ # AND fix the require_relative path to point to templates/core
220
233
  modified_content = source_content.gsub(
221
- /^module PropelAuth$/,
222
- "module PropelAuth"
234
+ /^module PropelAuthentication$/,
235
+ "module PropelAuthentication"
223
236
  ).gsub(
224
237
  /^ class InstallGenerator/,
225
238
  " class InstallGenerator"
239
+ ).gsub(
240
+ /require_relative 'core\/configuration_methods'/,
241
+ "require_relative 'templates/core/configuration_methods'"
226
242
  )
227
243
 
228
244
  # Create the directory and write the modified generator
@@ -252,17 +268,17 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
252
268
  end
253
269
 
254
270
  def copy_lib_runtime(destination_path)
255
- say "📂 Extracting PropelAuth runtime code...", :blue
271
+ say "📂 Extracting PropelAuthentication runtime code...", :blue
256
272
 
257
- lib_source = File.join(self.class.source_root, "lib", "propel_auth.rb")
258
- lib_dest = File.join(destination_path, "templates", "lib", "propel_auth.rb")
273
+ lib_source = File.join(self.class.source_root, "lib", "propel_authentication.rb.tt")
274
+ lib_dest = File.join(destination_path, "templates", "lib", "propel_authentication.rb.tt")
259
275
 
260
276
  if File.exist?(lib_source)
261
277
  FileUtils.mkdir_p(File.dirname(lib_dest))
262
278
  FileUtils.cp(lib_source, lib_dest)
263
- say " ✅ PropelAuth runtime code extracted", :green
279
+ say " ✅ PropelAuthentication runtime code extracted", :green
264
280
  else
265
- say " ⚠️ PropelAuth runtime template not found", :yellow
281
+ say " ⚠️ PropelAuthentication runtime template not found", :yellow
266
282
  end
267
283
  end
268
284
 
@@ -305,7 +321,7 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
305
321
 
306
322
  def show_completion_message(destination_path)
307
323
  say ""
308
- say "🎉 PropelAuth GENERATOR unpacked successfully!", :green
324
+ say "🎉 PropelAuthentication GENERATOR unpacked successfully!", :green
309
325
  say ""
310
326
  say "📁 Generator extracted to: #{destination_path}/", :bold
311
327
  say "📂 Templates available at: #{destination_path}/templates/", :bold
@@ -318,6 +334,7 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
318
334
  say " 🧪 Test templates: #{destination_path}/templates/test/"
319
335
  say " 📧 Email templates: #{destination_path}/templates/views/auth_mailer/"
320
336
  say " ⚙️ Config templates: #{destination_path}/templates/config/"
337
+ say " 📚 Documentation templates: #{destination_path}/templates/doc/"
321
338
  say ""
322
339
 
323
340
  say "⚠️ Important: You now have a LOCAL GENERATOR, not gem generator:", :yellow
@@ -329,7 +346,7 @@ class PropelAuth::UnpackGenerator < Rails::Generators::Base
329
346
 
330
347
  say "💡 Test your customized generator:", :blue
331
348
  say " # Your local generator will be used instead of the gem:"
332
- say " rails generate propel_auth:install"
349
+ say " rails generate propel_authentication:install"
333
350
  say ""
334
351
 
335
352
  say "🔄 To use gem generator again:", :cyan
@@ -0,0 +1,3 @@
1
+ module PropelAuthentication
2
+ VERSION = "0.2.0"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propel_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Propel Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-07-22 00:00:00.000000000 Z
11
+ date: 2025-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -67,105 +67,108 @@ executables: []
67
67
  extensions: []
68
68
  extra_rdoc_files: []
69
69
  files:
70
+ - CHANGELOG.md
70
71
  - LICENSE
71
72
  - README.md
72
73
  - Rakefile
73
- - lib/generators/propel_auth/core/configuration_methods.rb
74
- - lib/generators/propel_auth/install_generator.rb
75
- - lib/generators/propel_auth/pack_generator.rb
76
- - lib/generators/propel_auth/templates/agency.rb
77
- - lib/generators/propel_auth/templates/agent.rb
78
- - lib/generators/propel_auth/templates/auth/base_passwords_controller.rb.tt
79
- - lib/generators/propel_auth/templates/auth/base_tokens_controller.rb.tt
80
- - lib/generators/propel_auth/templates/auth/passwords_controller.rb.tt
81
- - lib/generators/propel_auth/templates/auth_mailer.rb
82
- - lib/generators/propel_auth/templates/authenticatable.rb
83
- - lib/generators/propel_auth/templates/concerns/confirmable.rb
84
- - lib/generators/propel_auth/templates/concerns/lockable.rb
85
- - lib/generators/propel_auth/templates/concerns/propel_authentication.rb
86
- - lib/generators/propel_auth/templates/concerns/rack_session_disable.rb
87
- - lib/generators/propel_auth/templates/concerns/recoverable.rb
88
- - lib/generators/propel_auth/templates/config/environments/development_email.rb
89
- - lib/generators/propel_auth/templates/db/migrate/create_agencies.rb
90
- - lib/generators/propel_auth/templates/db/migrate/create_agents.rb
91
- - lib/generators/propel_auth/templates/db/migrate/create_invitations.rb
92
- - lib/generators/propel_auth/templates/db/migrate/create_organizations.rb
93
- - lib/generators/propel_auth/templates/db/migrate/create_users.rb
94
- - lib/generators/propel_auth/templates/db/seeds.rb
95
- - lib/generators/propel_auth/templates/invitation.rb
96
- - lib/generators/propel_auth/templates/organization.rb
97
- - lib/generators/propel_auth/templates/propel_auth.rb.tt
98
- - lib/generators/propel_auth/templates/services/auth_notification_service.rb
99
- - lib/generators/propel_auth/templates/test/concerns/confirmable_test.rb.tt
100
- - lib/generators/propel_auth/templates/test/concerns/lockable_test.rb.tt
101
- - lib/generators/propel_auth/templates/test/concerns/propel_authentication_test.rb.tt
102
- - lib/generators/propel_auth/templates/test/concerns/recoverable_test.rb.tt
103
- - lib/generators/propel_auth/templates/test/controllers/auth/lockable_integration_test.rb.tt
104
- - lib/generators/propel_auth/templates/test/controllers/auth/password_reset_integration_test.rb.tt
105
- - lib/generators/propel_auth/templates/test/controllers/auth/tokens_controller_test.rb.tt
106
- - lib/generators/propel_auth/templates/test/mailers/auth_mailer_test.rb.tt
107
- - lib/generators/propel_auth/templates/test/mailers/previews/auth_mailer_preview.rb
108
- - lib/generators/propel_auth/templates/tokens_controller.rb.tt
109
- - lib/generators/propel_auth/templates/user.rb
110
- - lib/generators/propel_auth/templates/user_test.rb.tt
111
- - lib/generators/propel_auth/templates/views/auth_mailer/account_unlock.html.erb
112
- - lib/generators/propel_auth/templates/views/auth_mailer/account_unlock.text.erb
113
- - lib/generators/propel_auth/templates/views/auth_mailer/email_confirmation.html.erb
114
- - lib/generators/propel_auth/templates/views/auth_mailer/email_confirmation.text.erb
115
- - lib/generators/propel_auth/templates/views/auth_mailer/password_reset.html.erb
116
- - lib/generators/propel_auth/templates/views/auth_mailer/password_reset.text.erb
117
- - lib/generators/propel_auth/templates/views/auth_mailer/user_invitation.html.erb
118
- - lib/generators/propel_auth/templates/views/auth_mailer/user_invitation.text.erb
119
- - lib/generators/propel_auth/test/dummy/Dockerfile
120
- - lib/generators/propel_auth/test/dummy/Gemfile
121
- - lib/generators/propel_auth/test/dummy/README.md
122
- - lib/generators/propel_auth/test/dummy/Rakefile
123
- - lib/generators/propel_auth/test/dummy/app/assets/stylesheets/application.css
124
- - lib/generators/propel_auth/test/dummy/app/controllers/application_controller.rb
125
- - lib/generators/propel_auth/test/dummy/app/helpers/application_helper.rb
126
- - lib/generators/propel_auth/test/dummy/app/jobs/application_job.rb
127
- - lib/generators/propel_auth/test/dummy/app/mailers/application_mailer.rb
128
- - lib/generators/propel_auth/test/dummy/app/models/application_record.rb
129
- - lib/generators/propel_auth/test/dummy/app/views/layouts/application.html.erb
130
- - lib/generators/propel_auth/test/dummy/app/views/layouts/mailer.html.erb
131
- - lib/generators/propel_auth/test/dummy/app/views/layouts/mailer.text.erb
132
- - lib/generators/propel_auth/test/dummy/app/views/pwa/manifest.json.erb
133
- - lib/generators/propel_auth/test/dummy/app/views/pwa/service-worker.js
134
- - lib/generators/propel_auth/test/dummy/bin/brakeman
135
- - lib/generators/propel_auth/test/dummy/bin/dev
136
- - lib/generators/propel_auth/test/dummy/bin/docker-entrypoint
137
- - lib/generators/propel_auth/test/dummy/bin/rails
138
- - lib/generators/propel_auth/test/dummy/bin/rake
139
- - lib/generators/propel_auth/test/dummy/bin/rubocop
140
- - lib/generators/propel_auth/test/dummy/bin/setup
141
- - lib/generators/propel_auth/test/dummy/bin/thrust
142
- - lib/generators/propel_auth/test/dummy/config.ru
143
- - lib/generators/propel_auth/test/dummy/config/application.rb
144
- - lib/generators/propel_auth/test/dummy/config/boot.rb
145
- - lib/generators/propel_auth/test/dummy/config/cable.yml
146
- - lib/generators/propel_auth/test/dummy/config/credentials.yml.enc
147
- - lib/generators/propel_auth/test/dummy/config/database.yml
148
- - lib/generators/propel_auth/test/dummy/config/environment.rb
149
- - lib/generators/propel_auth/test/dummy/config/environments/development.rb
150
- - lib/generators/propel_auth/test/dummy/config/environments/production.rb
151
- - lib/generators/propel_auth/test/dummy/config/environments/test.rb
152
- - lib/generators/propel_auth/test/dummy/config/initializers/assets.rb
153
- - lib/generators/propel_auth/test/dummy/config/initializers/content_security_policy.rb
154
- - lib/generators/propel_auth/test/dummy/config/initializers/filter_parameter_logging.rb
155
- - lib/generators/propel_auth/test/dummy/config/initializers/inflections.rb
156
- - lib/generators/propel_auth/test/dummy/config/locales/en.yml
157
- - lib/generators/propel_auth/test/dummy/config/master.key
158
- - lib/generators/propel_auth/test/dummy/config/puma.rb
159
- - lib/generators/propel_auth/test/dummy/config/routes.rb
160
- - lib/generators/propel_auth/test/dummy/config/storage.yml
161
- - lib/generators/propel_auth/test/dummy/db/schema.rb
162
- - lib/generators/propel_auth/test/generators/authentication/controllers/tokens_controller_test.rb
163
- - lib/generators/propel_auth/test/generators/authentication/install_generator_test.rb
164
- - lib/generators/propel_auth/test/generators/authentication/uninstall_generator_test.rb
165
- - lib/generators/propel_auth/test/integration/generator_integration_test.rb
166
- - lib/generators/propel_auth/test/integration/multi_version_generator_test.rb
167
- - lib/generators/propel_auth/unpack_generator.rb
168
- - lib/propel_auth.rb
74
+ - lib/generators/propel_authentication/install_generator.rb
75
+ - lib/generators/propel_authentication/templates/application_mailer.rb
76
+ - lib/generators/propel_authentication/templates/auth/passwords_controller.rb.tt
77
+ - lib/generators/propel_authentication/templates/auth/signup_controller.rb.tt
78
+ - lib/generators/propel_authentication/templates/auth/tokens_controller.rb.tt
79
+ - lib/generators/propel_authentication/templates/auth_mailer.rb
80
+ - lib/generators/propel_authentication/templates/authenticatable.rb
81
+ - lib/generators/propel_authentication/templates/concerns/confirmable.rb
82
+ - lib/generators/propel_authentication/templates/concerns/lockable.rb
83
+ - lib/generators/propel_authentication/templates/concerns/propel_authentication_concern.rb
84
+ - lib/generators/propel_authentication/templates/concerns/rack_session_disable.rb
85
+ - lib/generators/propel_authentication/templates/concerns/recoverable.rb
86
+ - lib/generators/propel_authentication/templates/config/environments/development_email.rb
87
+ - lib/generators/propel_authentication/templates/core/configuration_methods.rb
88
+ - lib/generators/propel_authentication/templates/db/migrate/create_agencies.rb
89
+ - lib/generators/propel_authentication/templates/db/migrate/create_agents.rb
90
+ - lib/generators/propel_authentication/templates/db/migrate/create_invitations.rb
91
+ - lib/generators/propel_authentication/templates/db/migrate/create_organizations.rb
92
+ - lib/generators/propel_authentication/templates/db/migrate/create_users.rb
93
+ - lib/generators/propel_authentication/templates/db/seeds.rb
94
+ - lib/generators/propel_authentication/templates/doc/signup_flow.md
95
+ - lib/generators/propel_authentication/templates/models/agency.rb.tt
96
+ - lib/generators/propel_authentication/templates/models/agent.rb.tt
97
+ - lib/generators/propel_authentication/templates/models/invitation.rb.tt
98
+ - lib/generators/propel_authentication/templates/models/organization.rb.tt
99
+ - lib/generators/propel_authentication/templates/models/user.rb.tt
100
+ - lib/generators/propel_authentication/templates/propel_authentication.rb.tt
101
+ - lib/generators/propel_authentication/templates/routes/auth_routes.rb.tt
102
+ - lib/generators/propel_authentication/templates/services/auth_notification_service.rb
103
+ - lib/generators/propel_authentication/templates/test/concerns/confirmable_test.rb.tt
104
+ - lib/generators/propel_authentication/templates/test/concerns/lockable_test.rb.tt
105
+ - lib/generators/propel_authentication/templates/test/concerns/propel_authentication_test.rb.tt
106
+ - lib/generators/propel_authentication/templates/test/concerns/recoverable_test.rb.tt
107
+ - lib/generators/propel_authentication/templates/test/controllers/auth/lockable_integration_test.rb.tt
108
+ - lib/generators/propel_authentication/templates/test/controllers/auth/password_reset_integration_test.rb.tt
109
+ - lib/generators/propel_authentication/templates/test/controllers/auth/signup_controller_test.rb.tt
110
+ - lib/generators/propel_authentication/templates/test/controllers/auth/tokens_controller_test.rb.tt
111
+ - lib/generators/propel_authentication/templates/test/mailers/auth_mailer_test.rb.tt
112
+ - lib/generators/propel_authentication/templates/test/mailers/previews/auth_mailer_preview.rb
113
+ - lib/generators/propel_authentication/templates/user_test.rb.tt
114
+ - lib/generators/propel_authentication/templates/views/auth_mailer/account_unlock.html.erb
115
+ - lib/generators/propel_authentication/templates/views/auth_mailer/account_unlock.text.erb
116
+ - lib/generators/propel_authentication/templates/views/auth_mailer/email_confirmation.html.erb
117
+ - lib/generators/propel_authentication/templates/views/auth_mailer/email_confirmation.text.erb
118
+ - lib/generators/propel_authentication/templates/views/auth_mailer/password_reset.html.erb
119
+ - lib/generators/propel_authentication/templates/views/auth_mailer/password_reset.text.erb
120
+ - lib/generators/propel_authentication/templates/views/auth_mailer/user_invitation.html.erb
121
+ - lib/generators/propel_authentication/templates/views/auth_mailer/user_invitation.text.erb
122
+ - lib/generators/propel_authentication/test/dummy/Dockerfile
123
+ - lib/generators/propel_authentication/test/dummy/Gemfile
124
+ - lib/generators/propel_authentication/test/dummy/README.md
125
+ - lib/generators/propel_authentication/test/dummy/Rakefile
126
+ - lib/generators/propel_authentication/test/dummy/app/assets/stylesheets/application.css
127
+ - lib/generators/propel_authentication/test/dummy/app/controllers/application_controller.rb
128
+ - lib/generators/propel_authentication/test/dummy/app/helpers/application_helper.rb
129
+ - lib/generators/propel_authentication/test/dummy/app/jobs/application_job.rb
130
+ - lib/generators/propel_authentication/test/dummy/app/mailers/application_mailer.rb
131
+ - lib/generators/propel_authentication/test/dummy/app/models/application_record.rb
132
+ - lib/generators/propel_authentication/test/dummy/app/views/layouts/application.html.erb
133
+ - lib/generators/propel_authentication/test/dummy/app/views/layouts/mailer.html.erb
134
+ - lib/generators/propel_authentication/test/dummy/app/views/layouts/mailer.text.erb
135
+ - lib/generators/propel_authentication/test/dummy/app/views/pwa/manifest.json.erb
136
+ - lib/generators/propel_authentication/test/dummy/app/views/pwa/service-worker.js
137
+ - lib/generators/propel_authentication/test/dummy/bin/brakeman
138
+ - lib/generators/propel_authentication/test/dummy/bin/dev
139
+ - lib/generators/propel_authentication/test/dummy/bin/docker-entrypoint
140
+ - lib/generators/propel_authentication/test/dummy/bin/rails
141
+ - lib/generators/propel_authentication/test/dummy/bin/rake
142
+ - lib/generators/propel_authentication/test/dummy/bin/rubocop
143
+ - lib/generators/propel_authentication/test/dummy/bin/setup
144
+ - lib/generators/propel_authentication/test/dummy/bin/thrust
145
+ - lib/generators/propel_authentication/test/dummy/config.ru
146
+ - lib/generators/propel_authentication/test/dummy/config/application.rb
147
+ - lib/generators/propel_authentication/test/dummy/config/boot.rb
148
+ - lib/generators/propel_authentication/test/dummy/config/cable.yml
149
+ - lib/generators/propel_authentication/test/dummy/config/credentials.yml.enc
150
+ - lib/generators/propel_authentication/test/dummy/config/database.yml
151
+ - lib/generators/propel_authentication/test/dummy/config/environment.rb
152
+ - lib/generators/propel_authentication/test/dummy/config/environments/development.rb
153
+ - lib/generators/propel_authentication/test/dummy/config/environments/production.rb
154
+ - lib/generators/propel_authentication/test/dummy/config/environments/test.rb
155
+ - lib/generators/propel_authentication/test/dummy/config/initializers/assets.rb
156
+ - lib/generators/propel_authentication/test/dummy/config/initializers/content_security_policy.rb
157
+ - lib/generators/propel_authentication/test/dummy/config/initializers/filter_parameter_logging.rb
158
+ - lib/generators/propel_authentication/test/dummy/config/initializers/inflections.rb
159
+ - lib/generators/propel_authentication/test/dummy/config/locales/en.yml
160
+ - lib/generators/propel_authentication/test/dummy/config/master.key
161
+ - lib/generators/propel_authentication/test/dummy/config/puma.rb
162
+ - lib/generators/propel_authentication/test/dummy/config/routes.rb
163
+ - lib/generators/propel_authentication/test/dummy/config/storage.yml
164
+ - lib/generators/propel_authentication/test/dummy/db/schema.rb
165
+ - lib/generators/propel_authentication/test/generators/authentication/controllers/tokens_controller_test.rb
166
+ - lib/generators/propel_authentication/test/generators/authentication/install_generator_test.rb
167
+ - lib/generators/propel_authentication/test/generators/authentication/uninstall_generator_test.rb
168
+ - lib/generators/propel_authentication/test/integration/generator_integration_test.rb
169
+ - lib/generators/propel_authentication/test/integration/multi_version_generator_test.rb
170
+ - lib/generators/propel_authentication/unpack_generator.rb
171
+ - lib/propel_authentication.rb
169
172
  homepage: https://github.com/propel-hq/propel_rails.git
170
173
  licenses:
171
174
  - MIT
@@ -1,134 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- # Module providing configuration detection and validation for PropelAuth generators
5
- #
6
- module PropelAuth
7
- module ConfigurationMethods
8
-
9
- # Shared class options across all PropelAuth generators
10
- def self.included(base)
11
- base.class_option :namespace,
12
- type: :string,
13
- default: nil,
14
- desc: "Authentication namespace (e.g., 'api', 'admin_api'). Use 'none' for no namespace. Defaults to PropelAuth configuration."
15
-
16
- base.class_option :version,
17
- type: :string,
18
- default: nil,
19
- desc: "Authentication version (e.g., 'v1', 'v2'). Use 'none' for no versioning. Defaults to PropelAuth configuration."
20
-
21
- # Legacy support for existing --api-version option
22
- base.class_option :api_version,
23
- type: :string,
24
- default: nil,
25
- desc: "Legacy: Use --version instead. Authentication version (e.g., 'v1', 'v2')."
26
- end
27
-
28
- protected
29
-
30
- # Initialize shared PropelAuth settings used across all generators
31
- def initialize_propel_auth_settings
32
- @auth_namespace = determine_auth_namespace
33
- @auth_version = determine_auth_version
34
- end
35
-
36
- # Determine the authentication namespace to use
37
- # Priority order:
38
- # 1. Command line option (--namespace)
39
- # 2. PropelAuth configuration (if exists)
40
- # 3. Default fallback (nil for clean URLs like /login)
41
- def determine_auth_namespace
42
- if options[:namespace] == 'none'
43
- return nil
44
- end
45
-
46
- if options[:namespace].present?
47
- return options[:namespace]
48
- end
49
-
50
- # Try to read from PropelAuth configuration
51
- begin
52
- if defined?(PropelAuth) && PropelAuth.configuration.respond_to?(:namespace)
53
- config_namespace = PropelAuth.configuration.namespace
54
- return config_namespace if config_namespace.present? && config_namespace != 'none'
55
- end
56
- rescue => e
57
- # Configuration not available, continue to default
58
- end
59
-
60
- # Default fallback - no namespace for clean URLs
61
- nil
62
- end
63
-
64
- # Determine the authentication version to use
65
- # Priority order:
66
- # 1. Command line option (--version or legacy --api-version)
67
- # 2. PropelAuth configuration (if exists)
68
- # 3. Default fallback (nil for clean URLs like /login)
69
- def determine_auth_version
70
- # Check for 'none' in either option
71
- if options[:version] == 'none' || options[:api_version] == 'none'
72
- return nil
73
- end
74
-
75
- # Check explicit version option first
76
- if options[:version].present?
77
- return options[:version]
78
- end
79
-
80
- # Check legacy api_version option
81
- if options[:api_version].present?
82
- return options[:api_version]
83
- end
84
-
85
- # Try to read from PropelAuth configuration
86
- begin
87
- if defined?(PropelAuth) && PropelAuth.configuration.respond_to?(:version)
88
- config_version = PropelAuth.configuration.version
89
- return config_version if config_version.present? && config_version != 'none'
90
- end
91
- rescue => e
92
- # Configuration not available, continue to default
93
- end
94
-
95
- # Default fallback - no version for clean URLs
96
- nil
97
- end
98
-
99
- # Display helpers for logging
100
- def namespace_display
101
- @auth_namespace.present? ? @auth_namespace : 'none'
102
- end
103
-
104
- def version_display
105
- @auth_version.present? ? @auth_version : 'none'
106
- end
107
-
108
- # Authentication route path generation
109
- def auth_route_prefix
110
- path_parts = []
111
- path_parts << @auth_namespace if @auth_namespace.present?
112
- path_parts << @auth_version if @auth_version.present?
113
- return '/' if path_parts.empty?
114
- '/' + path_parts.join('/')
115
- end
116
-
117
- # Authentication controller namespace generation
118
- def auth_controller_namespace
119
- class_parts = []
120
- class_parts << @auth_namespace.camelize if @auth_namespace.present?
121
- class_parts << @auth_version.upcase if @auth_version.present?
122
- class_parts.empty? ? 'Auth' : class_parts.join('::') + '::Auth'
123
- end
124
-
125
- # Authentication controller directory path
126
- def auth_controller_directory
127
- path_parts = ['app', 'controllers']
128
- path_parts << @auth_namespace if @auth_namespace.present?
129
- path_parts << @auth_version if @auth_version.present?
130
- path_parts << 'auth'
131
- path_parts.join('/')
132
- end
133
- end
134
- end