rbs_devise 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/rbs_devise/install_generator.rb +3 -0
- data/lib/rbs_devise/devise.rb +28 -8
- data/lib/rbs_devise/version.rb +1 -1
- data/rbs_collection.lock.yaml +5 -1
- data/rbs_collection.yaml +2 -0
- data/rbs_devise.gemspec +0 -1
- data/sig/rbs_devise/devise.rbs +4 -2
- data/sig/shims/thor.rbs +5 -0
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3879b95db460f238ea805b89aec709db6433e67587be58572294612fdfe56337
|
4
|
+
data.tar.gz: 529bc991ab6349cb235919e68fb5ae0fbace74776a359c238ac352e4a938fe16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c44228c2bb3e41967b9f5fda159ebf6d8ddcaa90f0f480d75ed809ac329e48e923ef5674cbd6c152c0b3980ab21728f20eddf12140066ca8e37cb4c30073ed7
|
7
|
+
data.tar.gz: fd5f7aba1e09a1c3c673d9182e85ee17782fdbfa891c764096d9b4e12418d8d603e4fb3122327a6cad00a23babe46b9571e268ea9a7ad9d82f80a05e4f982ea2
|
@@ -6,8 +6,11 @@ module RbsDevise
|
|
6
6
|
class InstallGenerator < ::Rails::Generators::Base
|
7
7
|
def create_raketask
|
8
8
|
create_file "lib/tasks/rbs_devise.rake", <<~RUBY
|
9
|
+
# frozen_string_literal: true
|
10
|
+
|
9
11
|
begin
|
10
12
|
require "rbs_devise/rake_task"
|
13
|
+
|
11
14
|
RbsDevise::RakeTask.new
|
12
15
|
rescue LoadError
|
13
16
|
# failed to load rbs_devise. Skip to load rbs_devise tasks.
|
data/lib/rbs_devise/devise.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "devise"
|
4
4
|
require "rbs"
|
5
|
-
require "rbs_rails"
|
6
5
|
|
7
6
|
module RbsDevise
|
8
7
|
module Devise
|
@@ -18,24 +17,29 @@ module RbsDevise
|
|
18
17
|
|
19
18
|
class Generator
|
20
19
|
def generate
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def klass_decl
|
27
|
-
<<~RBS
|
20
|
+
format <<~RBS
|
28
21
|
module Devise
|
29
22
|
#{devise_controllers_signinout_decl}
|
30
23
|
#{device_helpers_decl}
|
24
|
+
#{device_models_decl}
|
31
25
|
#{devise_sessions_controller_decl}
|
32
26
|
end
|
33
27
|
|
34
28
|
#{devise_controller_decl}
|
35
29
|
#{actioncontroller_base_decl}
|
30
|
+
#{activerecord_base_decl}
|
36
31
|
RBS
|
37
32
|
end
|
38
33
|
|
34
|
+
private
|
35
|
+
|
36
|
+
def format(rbs)
|
37
|
+
parsed = RBS::Parser.parse_signature(rbs)
|
38
|
+
StringIO.new.tap do |out|
|
39
|
+
RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
|
40
|
+
end.string
|
41
|
+
end
|
42
|
+
|
39
43
|
def devise_controllers_signinout_decl
|
40
44
|
resource_type = resource_classes.join(" | ")
|
41
45
|
<<~RBS
|
@@ -75,6 +79,14 @@ module RbsDevise
|
|
75
79
|
end.join("\n")
|
76
80
|
end
|
77
81
|
|
82
|
+
def device_models_decl
|
83
|
+
<<~RBS
|
84
|
+
module Models
|
85
|
+
def devise: (*Symbol) -> void
|
86
|
+
end
|
87
|
+
RBS
|
88
|
+
end
|
89
|
+
|
78
90
|
def devise_sessions_controller_decl
|
79
91
|
<<~RBS
|
80
92
|
class SessionsController < DeviseController
|
@@ -104,6 +116,14 @@ module RbsDevise
|
|
104
116
|
RBS
|
105
117
|
end
|
106
118
|
|
119
|
+
def activerecord_base_decl
|
120
|
+
<<~RBS
|
121
|
+
class ActiveRecord::Base
|
122
|
+
include Devise::Models
|
123
|
+
end
|
124
|
+
RBS
|
125
|
+
end
|
126
|
+
|
107
127
|
def parent_controller
|
108
128
|
::Devise.parent_controller
|
109
129
|
end
|
data/lib/rbs_devise/version.rb
CHANGED
data/rbs_collection.lock.yaml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
sources:
|
3
3
|
- type: git
|
4
4
|
name: ruby/gem_rbs_collection
|
5
|
-
revision:
|
5
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
6
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
7
7
|
repo_dir: gems
|
8
8
|
path: ".gem_rbs_collection"
|
@@ -171,6 +171,10 @@ gems:
|
|
171
171
|
revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
|
172
172
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
173
173
|
repo_dir: gems
|
174
|
+
- name: pathname
|
175
|
+
version: '0'
|
176
|
+
source:
|
177
|
+
type: stdlib
|
174
178
|
- name: rack
|
175
179
|
version: '2.2'
|
176
180
|
source:
|
data/rbs_collection.yaml
CHANGED
data/rbs_devise.gemspec
CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency "devise"
|
32
32
|
spec.add_dependency "rails"
|
33
|
-
spec.add_dependency "rbs_rails"
|
34
33
|
|
35
34
|
# For more information and examples about making a new gem, check out our
|
36
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/sig/rbs_devise/devise.rbs
CHANGED
@@ -8,13 +8,15 @@ module RbsDevise
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
def
|
12
|
-
def sessions_controller_decl: () -> String
|
11
|
+
def format: (String rbs) -> String
|
13
12
|
def devise_controllers_signinout_decl: () -> String
|
14
13
|
def device_helpers_decl: () -> String
|
15
14
|
def device_helpers_methods: () -> String
|
15
|
+
def device_models_decl: () -> String
|
16
16
|
def devise_controller_decl: () -> String
|
17
|
+
def devise_sessions_controller_decl: () -> String
|
17
18
|
def actioncontroller_base_decl: () -> String
|
19
|
+
def activerecord_base_decl: () -> String
|
18
20
|
def parent_controller: () -> String
|
19
21
|
def resource_classes: () -> Array[String]
|
20
22
|
end
|
data/sig/shims/thor.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi KOMIYA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rbs_rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: A RBS files generator for discard gem
|
56
42
|
email:
|
57
43
|
- i.tkomiya@gmail.com
|
@@ -81,6 +67,7 @@ files:
|
|
81
67
|
- sig/rbs_devise/devise.rbs
|
82
68
|
- sig/rbs_devise/rake_task.rbs
|
83
69
|
- sig/shims/rake.rbs
|
70
|
+
- sig/shims/thor.rbs
|
84
71
|
homepage: https://github.com/tk0miya/rbs_devise
|
85
72
|
licenses:
|
86
73
|
- MIT
|