yaag 0.1.0 → 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.
- checksums.yaml +4 -4
- data/README.md +23 -1
- data/lib/generators/authentication/copy/controllers_generator.rb +13 -0
- data/lib/yaag/test/sessions_helper.rb +19 -0
- data/lib/yaag/version.rb +1 -1
- data/lib/yaag.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d12d4feb11b2bf161940d8925180dc1bf27a57029521197bef08bac48c5a8997
|
|
4
|
+
data.tar.gz: a26d2996a3aa9fe193a074c0f9f745b977a048f33df2e13d479a5ec5d267a87f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abc264f8d2def0f837f46056fa41811ce8dbf9cdd7cc69cca56153edff8d6eb67e76b721427051a467724945cd21d771fc4dba5b03a143373dfe460735898549
|
|
7
|
+
data.tar.gz: 1ce0344f09b9c879b0d23f6ba4d055a8fbceabb06a813770033734600e6dac2fff242e3df34c4655cf009bc2fa67e54f1ee30c2e7b532beeb1bff980e3986753
|
data/README.md
CHANGED
|
@@ -60,12 +60,34 @@ class MyController < ApplicationController
|
|
|
60
60
|
end
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
### Generators
|
|
64
|
+
|
|
65
|
+
Here is a list of generator available in case any of the components of the gem need to be customized to specific application needs.
|
|
66
|
+
|
|
67
|
+
For views:
|
|
64
68
|
|
|
65
69
|
```bash
|
|
66
70
|
rails g authentication:copy:views
|
|
67
71
|
```
|
|
68
72
|
|
|
73
|
+
For controllers (including concerns):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
rails g authentication:copy:controllers
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Test helper
|
|
80
|
+
|
|
81
|
+
To be able to perform tasks as an authenticated user, a helper is available to be used in tests. Add `include Yaag::Test::SessionsHelper` to access the methods `sign_in_as` and `sign_out`:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
class MyControllerTest < ActionDispatch::IntegrationTest
|
|
85
|
+
include Yaag::Test::SessionsHelper
|
|
86
|
+
setup { sign_in_as(User.take) }
|
|
87
|
+
...
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
69
91
|
## Release
|
|
70
92
|
|
|
71
93
|
```bash
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Authentication
|
|
2
|
+
module Copy
|
|
3
|
+
class ControllersGenerator < Rails::Generators::Base
|
|
4
|
+
source_root File.expand_path("../../../../", __dir__)
|
|
5
|
+
|
|
6
|
+
def copy_controllers
|
|
7
|
+
copy_file "app/controllers/concerns/authentication.rb"
|
|
8
|
+
copy_file "app/controllers/sessions_controller.rb"
|
|
9
|
+
copy_file "app/controllers/signins_controller.rb"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Yaag
|
|
2
|
+
module Test
|
|
3
|
+
module SessionsHelper
|
|
4
|
+
def sign_in_as(user)
|
|
5
|
+
Current.session = user.sessions.create!
|
|
6
|
+
|
|
7
|
+
ActionDispatch::TestRequest.create.cookie_jar.tap do |cookie_jar|
|
|
8
|
+
cookie_jar.signed[:session_id] = Current.session.id
|
|
9
|
+
cookies["session_id"] = cookie_jar[:session_id]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def sign_out
|
|
14
|
+
Current.session&.destroy!
|
|
15
|
+
cookies.delete("session_id")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/yaag/version.rb
CHANGED
data/lib/yaag.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yaag
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nu12
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Yet Another Authentication Gem (YAAG) provides passwordless authentication
|
|
14
14
|
for your Ruby on Rails app, all it takes is the user's e-mail address.
|
|
@@ -37,12 +37,14 @@ files:
|
|
|
37
37
|
- db/migrate/20260108164812_create_users.rb
|
|
38
38
|
- db/migrate/20260108165215_create_sessions.rb
|
|
39
39
|
- lib/generators/authentication/USAGE
|
|
40
|
+
- lib/generators/authentication/copy/controllers_generator.rb
|
|
40
41
|
- lib/generators/authentication/copy/views_generator.rb
|
|
41
42
|
- lib/generators/authentication/install_generator.rb
|
|
42
43
|
- lib/generators/authentication/templates/README
|
|
43
44
|
- lib/tasks/yaag_tasks.rake
|
|
44
45
|
- lib/yaag.rb
|
|
45
46
|
- lib/yaag/engine.rb
|
|
47
|
+
- lib/yaag/test/sessions_helper.rb
|
|
46
48
|
- lib/yaag/version.rb
|
|
47
49
|
homepage: https://github.com/nu12/yaag
|
|
48
50
|
licenses:
|