rbs_discard 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/generators/rbs_discard/install_generator.rb +3 -0
- data/lib/rbs_discard/discard.rb +12 -10
- data/lib/rbs_discard/rake_task.rb +2 -1
- data/lib/rbs_discard/version.rb +1 -1
- data/rbs_collection.lock.yaml +118 -26
- data/rbs_collection.yaml +3 -0
- data/rbs_discard.gemspec +1 -1
- data/sig/rbs_discard/discard.rbs +1 -1
- data/sig/shims/thor.rbs +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf799cb56cfe433c75127cb1b808b8f36f97ec442f489df8849e77e732ff252f
|
4
|
+
data.tar.gz: a2cf51f37804a9e661245142259d61eaacaa5beed2dbeb26f55e52ce38f686f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e16101f420de3625c4e8733329c8c954426da24646296d4c7ca5d19d7634b1656010059d973f12937bbcc08f7b660051f12f785db34107779f55cc6dff06bdbf
|
7
|
+
data.tar.gz: f8acb01a7d6c008d4819a5f599c6c81559dc87270515705058a726ea7888237091a0d38440d72bd18ceaef099064ad91e04858e0527507cca24c161cba337c73
|
data/.rubocop.yml
CHANGED
@@ -6,8 +6,11 @@ module RbsDiscard
|
|
6
6
|
class InstallGenerator < ::Rails::Generators::Base
|
7
7
|
def create_raketask
|
8
8
|
create_file "lib/tasks/rbs_discard.rake", <<~RUBY
|
9
|
+
# frozen_string_literal: true
|
10
|
+
|
9
11
|
begin
|
10
12
|
require "rbs_discard/rake_task"
|
13
|
+
|
11
14
|
RbsDiscard::RakeTask.new
|
12
15
|
rescue LoadError
|
13
16
|
# failed to load rbs_discard. Skip to load rbs_discard tasks.
|
data/lib/rbs_discard/discard.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rbs"
|
4
|
-
require "rbs_rails"
|
5
4
|
|
6
5
|
module RbsDiscard
|
7
6
|
module Discard
|
@@ -22,17 +21,11 @@ module RbsDiscard
|
|
22
21
|
|
23
22
|
def initialize(klass)
|
24
23
|
@klass = klass
|
25
|
-
@klass_name =
|
24
|
+
@klass_name = klass.name || ""
|
26
25
|
end
|
27
26
|
|
28
27
|
def generate
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def klass_decl
|
35
|
-
<<~RBS
|
28
|
+
format <<~RBS
|
36
29
|
#{header}
|
37
30
|
class ActiveRecord_Relation
|
38
31
|
include Discard::Model::Relation
|
@@ -51,6 +44,15 @@ module RbsDiscard
|
|
51
44
|
RBS
|
52
45
|
end
|
53
46
|
|
47
|
+
private
|
48
|
+
|
49
|
+
def format(rbs)
|
50
|
+
parsed = RBS::Parser.parse_signature(rbs)
|
51
|
+
StringIO.new.tap do |out|
|
52
|
+
RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
|
53
|
+
end.string
|
54
|
+
end
|
55
|
+
|
54
56
|
def header
|
55
57
|
namespace = +""
|
56
58
|
klass_name.split("::").map do |mod_name|
|
@@ -60,7 +62,7 @@ module RbsDiscard
|
|
60
62
|
when Class
|
61
63
|
# @type var superclass: Class
|
62
64
|
superclass = _ = mod_object.superclass
|
63
|
-
superclass_name =
|
65
|
+
superclass_name = superclass.name || "Object"
|
64
66
|
|
65
67
|
"class #{mod_name} < ::#{superclass_name}"
|
66
68
|
when Module
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support"
|
3
4
|
require "pathname"
|
4
5
|
require "rake/tasklib"
|
5
6
|
|
@@ -46,7 +47,7 @@ module RbsDiscard
|
|
46
47
|
|
47
48
|
RbsDiscard::Discard.all.each do |klass|
|
48
49
|
rbs = RbsDiscard::Discard.class_to_rbs(klass)
|
49
|
-
path = signature_root_dir / "app/models/#{klass.name.underscore}.rbs"
|
50
|
+
path = signature_root_dir / "app/models/#{klass.name.to_s.underscore}.rbs"
|
50
51
|
path.dirname.mkpath
|
51
52
|
path.write(rbs)
|
52
53
|
end
|
data/lib/rbs_discard/version.rb
CHANGED
data/rbs_collection.lock.yaml
CHANGED
@@ -2,21 +2,49 @@
|
|
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"
|
9
9
|
gems:
|
10
|
-
- name:
|
11
|
-
version: '0'
|
10
|
+
- name: actionmailer
|
11
|
+
version: '7.0'
|
12
12
|
source:
|
13
|
-
type:
|
13
|
+
type: git
|
14
|
+
name: ruby/gem_rbs_collection
|
15
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
16
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
17
|
+
repo_dir: gems
|
18
|
+
- name: actionpack
|
19
|
+
version: '6.0'
|
20
|
+
source:
|
21
|
+
type: git
|
22
|
+
name: ruby/gem_rbs_collection
|
23
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
24
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
25
|
+
repo_dir: gems
|
26
|
+
- name: actionview
|
27
|
+
version: '6.0'
|
28
|
+
source:
|
29
|
+
type: git
|
30
|
+
name: ruby/gem_rbs_collection
|
31
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
32
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
33
|
+
repo_dir: gems
|
34
|
+
- name: activejob
|
35
|
+
version: '6.0'
|
36
|
+
source:
|
37
|
+
type: git
|
38
|
+
name: ruby/gem_rbs_collection
|
39
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
40
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
41
|
+
repo_dir: gems
|
14
42
|
- name: activemodel
|
15
43
|
version: '7.0'
|
16
44
|
source:
|
17
45
|
type: git
|
18
46
|
name: ruby/gem_rbs_collection
|
19
|
-
revision:
|
47
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
20
48
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
21
49
|
repo_dir: gems
|
22
50
|
- name: activerecord
|
@@ -24,7 +52,15 @@ gems:
|
|
24
52
|
source:
|
25
53
|
type: git
|
26
54
|
name: ruby/gem_rbs_collection
|
27
|
-
revision:
|
55
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
56
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
57
|
+
repo_dir: gems
|
58
|
+
- name: activestorage
|
59
|
+
version: '6.1'
|
60
|
+
source:
|
61
|
+
type: git
|
62
|
+
name: ruby/gem_rbs_collection
|
63
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
28
64
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
29
65
|
repo_dir: gems
|
30
66
|
- name: activesupport
|
@@ -32,7 +68,7 @@ gems:
|
|
32
68
|
source:
|
33
69
|
type: git
|
34
70
|
name: ruby/gem_rbs_collection
|
35
|
-
revision:
|
71
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
36
72
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
37
73
|
repo_dir: gems
|
38
74
|
- name: ast
|
@@ -40,31 +76,51 @@ gems:
|
|
40
76
|
source:
|
41
77
|
type: git
|
42
78
|
name: ruby/gem_rbs_collection
|
43
|
-
revision:
|
79
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
44
80
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
45
81
|
repo_dir: gems
|
46
82
|
- name: base64
|
47
83
|
version: '0'
|
48
84
|
source:
|
49
85
|
type: stdlib
|
86
|
+
- name: cgi
|
87
|
+
version: '0'
|
88
|
+
source:
|
89
|
+
type: stdlib
|
50
90
|
- name: concurrent-ruby
|
51
91
|
version: '1.1'
|
52
92
|
source:
|
53
93
|
type: git
|
54
94
|
name: ruby/gem_rbs_collection
|
55
|
-
revision:
|
95
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
56
96
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
57
97
|
repo_dir: gems
|
58
98
|
- name: date
|
59
99
|
version: '0'
|
60
100
|
source:
|
61
101
|
type: stdlib
|
102
|
+
- name: erb
|
103
|
+
version: '0'
|
104
|
+
source:
|
105
|
+
type: stdlib
|
106
|
+
- name: fileutils
|
107
|
+
version: '0'
|
108
|
+
source:
|
109
|
+
type: stdlib
|
110
|
+
- name: globalid
|
111
|
+
version: '1.1'
|
112
|
+
source:
|
113
|
+
type: git
|
114
|
+
name: ruby/gem_rbs_collection
|
115
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
116
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
117
|
+
repo_dir: gems
|
62
118
|
- name: i18n
|
63
119
|
version: '1.10'
|
64
120
|
source:
|
65
121
|
type: git
|
66
122
|
name: ruby/gem_rbs_collection
|
67
|
-
revision:
|
123
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
68
124
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
69
125
|
repo_dir: gems
|
70
126
|
- name: json
|
@@ -75,6 +131,14 @@ gems:
|
|
75
131
|
version: '0'
|
76
132
|
source:
|
77
133
|
type: stdlib
|
134
|
+
- name: mail
|
135
|
+
version: '2.8'
|
136
|
+
source:
|
137
|
+
type: git
|
138
|
+
name: ruby/gem_rbs_collection
|
139
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
140
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
141
|
+
repo_dir: gems
|
78
142
|
- name: minitest
|
79
143
|
version: '0'
|
80
144
|
source:
|
@@ -87,42 +151,58 @@ gems:
|
|
87
151
|
version: '0'
|
88
152
|
source:
|
89
153
|
type: stdlib
|
90
|
-
- name:
|
91
|
-
version: '
|
154
|
+
- name: nokogiri
|
155
|
+
version: '1.11'
|
92
156
|
source:
|
93
|
-
type:
|
157
|
+
type: git
|
158
|
+
name: ruby/gem_rbs_collection
|
159
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
160
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
161
|
+
repo_dir: gems
|
94
162
|
- name: parallel
|
95
163
|
version: '1.20'
|
96
164
|
source:
|
97
165
|
type: git
|
98
166
|
name: ruby/gem_rbs_collection
|
99
|
-
revision:
|
167
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
100
168
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
101
169
|
repo_dir: gems
|
102
170
|
- name: pathname
|
103
171
|
version: '0'
|
104
172
|
source:
|
105
173
|
type: stdlib
|
106
|
-
- name:
|
107
|
-
version: '
|
174
|
+
- name: rack
|
175
|
+
version: '2.2'
|
108
176
|
source:
|
109
177
|
type: git
|
110
178
|
name: ruby/gem_rbs_collection
|
111
|
-
revision:
|
179
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
112
180
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
113
181
|
repo_dir: gems
|
114
|
-
- name:
|
115
|
-
version:
|
182
|
+
- name: rails-dom-testing
|
183
|
+
version: '2.0'
|
116
184
|
source:
|
117
|
-
type:
|
118
|
-
|
119
|
-
|
185
|
+
type: git
|
186
|
+
name: ruby/gem_rbs_collection
|
187
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
188
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
189
|
+
repo_dir: gems
|
190
|
+
- name: railties
|
191
|
+
version: '6.0'
|
120
192
|
source:
|
121
|
-
type:
|
122
|
-
|
123
|
-
|
193
|
+
type: git
|
194
|
+
name: ruby/gem_rbs_collection
|
195
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
196
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
197
|
+
repo_dir: gems
|
198
|
+
- name: rainbow
|
199
|
+
version: '3.0'
|
124
200
|
source:
|
125
|
-
type:
|
201
|
+
type: git
|
202
|
+
name: ruby/gem_rbs_collection
|
203
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
204
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
205
|
+
repo_dir: gems
|
126
206
|
- name: securerandom
|
127
207
|
version: '0'
|
128
208
|
source:
|
@@ -131,12 +211,24 @@ gems:
|
|
131
211
|
version: '0'
|
132
212
|
source:
|
133
213
|
type: stdlib
|
214
|
+
- name: tempfile
|
215
|
+
version: '0'
|
216
|
+
source:
|
217
|
+
type: stdlib
|
134
218
|
- name: time
|
135
219
|
version: '0'
|
136
220
|
source:
|
137
221
|
type: stdlib
|
222
|
+
- name: timeout
|
223
|
+
version: '0'
|
224
|
+
source:
|
225
|
+
type: stdlib
|
138
226
|
- name: tsort
|
139
227
|
version: '0'
|
140
228
|
source:
|
141
229
|
type: stdlib
|
230
|
+
- name: uri
|
231
|
+
version: '0'
|
232
|
+
source:
|
233
|
+
type: stdlib
|
142
234
|
gemfile_lock_path: Gemfile.lock
|
data/rbs_collection.yaml
CHANGED
data/rbs_discard.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
spec.add_dependency "discard"
|
32
|
-
spec.add_dependency "
|
32
|
+
spec.add_dependency "rails"
|
33
33
|
|
34
34
|
# For more information and examples about making a new gem, check out our
|
35
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/sig/rbs_discard/discard.rbs
CHANGED
data/sig/shims/thor.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_discard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: discard
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- sig/rbs_discard/rake_task.rbs
|
69
69
|
- sig/shims/discard.rbs
|
70
70
|
- sig/shims/rake.rbs
|
71
|
+
- sig/shims/thor.rbs
|
71
72
|
homepage: https://github.com/tk0miya/rbs_discard
|
72
73
|
licenses:
|
73
74
|
- MIT
|