orthodox 0.2.4 → 0.3.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/authentication/USAGE +14 -0
  3. data/lib/generators/authentication/authentication_generator.rb +214 -0
  4. data/lib/generators/authentication/templates/controllers/concerns/authentication.rb.erb +110 -0
  5. data/lib/generators/authentication/templates/controllers/concerns/two_factor_authentication.rb +40 -0
  6. data/lib/generators/authentication/templates/controllers/password_resets_controller.rb.erb +54 -0
  7. data/lib/generators/authentication/templates/controllers/sessions_controller.rb.erb +36 -0
  8. data/lib/generators/authentication/templates/controllers/tfa_sessions_controller.rb.erb +48 -0
  9. data/lib/generators/authentication/templates/controllers/tfas_controller.rb.erb +38 -0
  10. data/lib/generators/authentication/templates/helpers/otp_credentials_helper.rb +33 -0
  11. data/lib/generators/authentication/templates/javascript/tfa_forms.js +19 -0
  12. data/lib/generators/authentication/templates/models/concerns/authenticateable.rb +37 -0
  13. data/lib/generators/authentication/templates/models/concerns/otpable.rb +26 -0
  14. data/lib/generators/authentication/templates/models/concerns/password_resetable.rb +19 -0
  15. data/lib/generators/authentication/templates/models/otp_credential.rb.erb +133 -0
  16. data/lib/generators/authentication/templates/models/password_reset_token.rb +64 -0
  17. data/lib/generators/authentication/templates/models/session.rb.erb +80 -0
  18. data/lib/generators/authentication/templates/models/tfa_session.rb +77 -0
  19. data/lib/generators/authentication/templates/spec/models/otp_credential_spec.rb +215 -0
  20. data/lib/generators/authentication/templates/spec/models/password_reset_token_spec.rb +146 -0
  21. data/lib/generators/authentication/templates/spec/models/session_spec.rb.erb +45 -0
  22. data/lib/generators/authentication/templates/spec/models/tfa_session_spec.rb.erb +115 -0
  23. data/lib/generators/authentication/templates/spec/support/authentication_helpers.rb +18 -0
  24. data/lib/generators/authentication/templates/spec/support/factory_bot.rb +5 -0
  25. data/lib/generators/authentication/templates/spec/system/authentication_spec.rb.erb +25 -0
  26. data/lib/generators/authentication/templates/spec/system/password_resets_spec.rb.erb +73 -0
  27. data/lib/generators/authentication/templates/spec/system/tfa_authentication_spec.rb.erb +38 -0
  28. data/lib/generators/authentication/templates/views/mailers/password_reset_link.html.slim.erb +7 -0
  29. data/lib/generators/authentication/templates/views/password_resets/edit.html.slim.erb +16 -0
  30. data/lib/generators/authentication/templates/views/password_resets/new.html.slim.erb +12 -0
  31. data/lib/generators/authentication/templates/views/sessions/new.html.slim.erb +21 -0
  32. data/lib/generators/authentication/templates/views/tfa_sessions/new.html.slim.erb +26 -0
  33. data/lib/generators/authentication/templates/views/tfas/show.html.slim.erb +9 -0
  34. data/lib/generators/base_controller/USAGE +8 -0
  35. data/lib/generators/base_controller/base_controller_generator.rb +22 -0
  36. data/lib/generators/base_controller/templates/base_controller.rb.erb +7 -0
  37. data/lib/generators/layout_helper/USAGE +8 -0
  38. data/lib/generators/layout_helper/layout_helper_generator.rb +55 -0
  39. data/lib/orthodox/version.rb +1 -1
  40. metadata +39 -2
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal
2
+ class <%= namespace_module %>::BaseController < ApplicationController
3
+
4
+ # layout "<%= plural_file_name %>"
5
+
6
+ # Define methods common to all <%= file_name %> controllers here.
7
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate layout_helper Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal
2
+
3
+ require 'rails/generators'
4
+
5
+ class LayoutHelperGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('templates', __dir__)
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ desc "This generator adds useful layout helper methods"
11
+
12
+
13
+ def copy_template_file
14
+ generate "helper", "Layout"
15
+ add_title_method
16
+ add_description_method
17
+ end
18
+
19
+
20
+ private
21
+
22
+ def file_path
23
+ Rails.root.join('app', 'helpers', "layout_helper.rb")
24
+ end
25
+
26
+ def add_title_method
27
+ inject_into_file(file_path, after: "module LayoutHelper\n") do
28
+ <<-RUBY
29
+
30
+ def title(value = nil)
31
+ if value
32
+ @title = value
33
+ else
34
+ @title.to_s
35
+ end
36
+ end
37
+ RUBY
38
+ end
39
+ end
40
+
41
+ def add_description_method
42
+ inject_into_file(file_path, after: "module LayoutHelper\n") do
43
+ <<-RUBY
44
+
45
+ def description(value = nil)
46
+ if value
47
+ @description = value
48
+ else
49
+ @description.to_s
50
+ end
51
+ end
52
+ RUBY
53
+ end
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module Orthodox
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthodox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodacious
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-11-10 00:00:00.000000000 Z
12
+ date: 2019-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -163,6 +163,41 @@ files:
163
163
  - dummy/public/favicon.ico
164
164
  - dummy/public/robots.txt
165
165
  - dummy/tmp/.keep
166
+ - lib/generators/authentication/USAGE
167
+ - lib/generators/authentication/authentication_generator.rb
168
+ - lib/generators/authentication/templates/controllers/concerns/authentication.rb.erb
169
+ - lib/generators/authentication/templates/controllers/concerns/two_factor_authentication.rb
170
+ - lib/generators/authentication/templates/controllers/password_resets_controller.rb.erb
171
+ - lib/generators/authentication/templates/controllers/sessions_controller.rb.erb
172
+ - lib/generators/authentication/templates/controllers/tfa_sessions_controller.rb.erb
173
+ - lib/generators/authentication/templates/controllers/tfas_controller.rb.erb
174
+ - lib/generators/authentication/templates/helpers/otp_credentials_helper.rb
175
+ - lib/generators/authentication/templates/javascript/tfa_forms.js
176
+ - lib/generators/authentication/templates/models/concerns/authenticateable.rb
177
+ - lib/generators/authentication/templates/models/concerns/otpable.rb
178
+ - lib/generators/authentication/templates/models/concerns/password_resetable.rb
179
+ - lib/generators/authentication/templates/models/otp_credential.rb.erb
180
+ - lib/generators/authentication/templates/models/password_reset_token.rb
181
+ - lib/generators/authentication/templates/models/session.rb.erb
182
+ - lib/generators/authentication/templates/models/tfa_session.rb
183
+ - lib/generators/authentication/templates/spec/models/otp_credential_spec.rb
184
+ - lib/generators/authentication/templates/spec/models/password_reset_token_spec.rb
185
+ - lib/generators/authentication/templates/spec/models/session_spec.rb.erb
186
+ - lib/generators/authentication/templates/spec/models/tfa_session_spec.rb.erb
187
+ - lib/generators/authentication/templates/spec/support/authentication_helpers.rb
188
+ - lib/generators/authentication/templates/spec/support/factory_bot.rb
189
+ - lib/generators/authentication/templates/spec/system/authentication_spec.rb.erb
190
+ - lib/generators/authentication/templates/spec/system/password_resets_spec.rb.erb
191
+ - lib/generators/authentication/templates/spec/system/tfa_authentication_spec.rb.erb
192
+ - lib/generators/authentication/templates/views/mailers/password_reset_link.html.slim.erb
193
+ - lib/generators/authentication/templates/views/password_resets/edit.html.slim.erb
194
+ - lib/generators/authentication/templates/views/password_resets/new.html.slim.erb
195
+ - lib/generators/authentication/templates/views/sessions/new.html.slim.erb
196
+ - lib/generators/authentication/templates/views/tfa_sessions/new.html.slim.erb
197
+ - lib/generators/authentication/templates/views/tfas/show.html.slim.erb
198
+ - lib/generators/base_controller/USAGE
199
+ - lib/generators/base_controller/base_controller_generator.rb
200
+ - lib/generators/base_controller/templates/base_controller.rb.erb
166
201
  - lib/generators/coffeescript/USAGE
167
202
  - lib/generators/coffeescript/coffeescript_generator.rb
168
203
  - lib/generators/coffeescript/templates/coffeescript.coffee.erb
@@ -170,6 +205,8 @@ files:
170
205
  - lib/generators/controller/controller_generator.rb
171
206
  - lib/generators/controller/templates/controller.rb.erb
172
207
  - lib/generators/controller/templates/view.html.slim
208
+ - lib/generators/layout_helper/USAGE
209
+ - lib/generators/layout_helper/layout_helper_generator.rb
173
210
  - lib/generators/sass/USAGE
174
211
  - lib/generators/sass/sass_generator.rb
175
212
  - lib/generators/sass/templates/sass.sass.erb