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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08dd691a8f038f811f0fa85d1e99a38a4be3729d60df0dc78cd7455aec78ece2'
4
- data.tar.gz: fa226445dcf0f97cde9598499b17bef02509bb77c0bb3780aa71a834d069bee6
3
+ metadata.gz: 3879b95db460f238ea805b89aec709db6433e67587be58572294612fdfe56337
4
+ data.tar.gz: 529bc991ab6349cb235919e68fb5ae0fbace74776a359c238ac352e4a938fe16
5
5
  SHA512:
6
- metadata.gz: 40198fea0e5ec6605ef1e4d95aab2a55cda76988dea498a6f589791ac061da9f14790730beba28727be82655223bc50c7f195f5234a1094ee038bfe10fa8bb30
7
- data.tar.gz: 7b9e361dd480bd18d0c29c6540d67822279448fcd3510a040bb159384c25d9641a43164fecfbbeba1145d235c1153e4fde659e95d4fcfb45c35f93689f670647
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.
@@ -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
- RbsRails::Util.format_rbs klass_decl
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbsDevise
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.1"
5
5
  end
@@ -2,7 +2,7 @@
2
2
  sources:
3
3
  - type: git
4
4
  name: ruby/gem_rbs_collection
5
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
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
@@ -16,3 +16,5 @@ path: .gem_rbs_collection
16
16
  gems:
17
17
  # Skip loading rbs gem's RBS.
18
18
  # It's unnecessary if you don't use rbs as a library.
19
+
20
+ - name: pathname
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
@@ -8,13 +8,15 @@ module RbsDevise
8
8
 
9
9
  private
10
10
 
11
- def klass_decl: () -> String
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
@@ -0,0 +1,5 @@
1
+ class Thor
2
+ module Actions
3
+ def create_file: (String destination, *String? args, ?config: bool) ?{ () -> void } -> untyped
4
+ end
5
+ end
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.0
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-08-30 00:00:00.000000000 Z
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