rbs_draper 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +40 -32
- data/README.md +1 -7
- data/Steepfile +3 -4
- data/lib/rbs_draper/decorator.rb +19 -4
- data/lib/rbs_draper/rake_task.rb +5 -1
- data/lib/rbs_draper/sig/decoratable.rbs +1 -0
- data/lib/rbs_draper/sig/decorator.rbs +1 -0
- data/lib/rbs_draper/version.rb +1 -1
- data/rbs_collection.lock.yaml +29 -17
- data/rbs_draper.gemspec +4 -1
- data/sig/rbs_draper/decoratable.rbs +4 -4
- data/sig/rbs_draper/decorator.rbs +5 -4
- data/sig/shims/rake.rbs +19 -0
- data/sig/shims/thor.rbs +5 -0
- metadata +47 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ab0cf7b71bd6ed489df32f624962c6a8cb46e2fe3e05a6ce9a6864106465dde
|
4
|
+
data.tar.gz: 4f9db1dd8274da25ff5907544647ae9c4e8160fe5ed3fbb5aa6dd1a77ab0daba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c12feee4cf6e98dbfa4e172f1e569f51ecc1cf163a8e26ddd08fb72a44e5de60beaf6f8469871a2752547765ea0506335977c8da0cdc6c532f8595649914eb50
|
7
|
+
data.tar.gz: 408294ee26cc2e601d40b035e6537cff035d46e6b2baf3422549665be48982a383d4cb0169d4bd5fe98cebd90bbaeac04f5f8b3b61a007948a5513203a000520
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion:
|
2
|
+
TargetRubyVersion: 2.7
|
3
3
|
|
4
4
|
Style/Documentation:
|
5
5
|
Enabled: false
|
@@ -15,6 +15,9 @@ Style/StringLiteralsInInterpolation:
|
|
15
15
|
Layout/LineLength:
|
16
16
|
Max: 120
|
17
17
|
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Max: 20
|
20
|
+
|
18
21
|
Metrics/BlockLength:
|
19
22
|
Exclude:
|
20
23
|
- spec/**/*.rb
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,46 +1,50 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs_draper (0.
|
4
|
+
rbs_draper (1.0.0)
|
5
|
+
activesupport
|
5
6
|
draper
|
7
|
+
fileutils
|
8
|
+
rbs
|
6
9
|
rbs_rails
|
7
10
|
|
8
11
|
GEM
|
9
12
|
remote: https://rubygems.org/
|
10
13
|
specs:
|
11
|
-
actionpack (7.0.
|
12
|
-
actionview (= 7.0.
|
13
|
-
activesupport (= 7.0.
|
14
|
+
actionpack (7.0.7)
|
15
|
+
actionview (= 7.0.7)
|
16
|
+
activesupport (= 7.0.7)
|
14
17
|
rack (~> 2.0, >= 2.2.4)
|
15
18
|
rack-test (>= 0.6.3)
|
16
19
|
rails-dom-testing (~> 2.0)
|
17
20
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (7.0.
|
19
|
-
activesupport (= 7.0.
|
21
|
+
actionview (7.0.7)
|
22
|
+
activesupport (= 7.0.7)
|
20
23
|
builder (~> 3.1)
|
21
24
|
erubi (~> 1.4)
|
22
25
|
rails-dom-testing (~> 2.0)
|
23
26
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activemodel (7.0.
|
25
|
-
activesupport (= 7.0.
|
27
|
+
activemodel (7.0.7)
|
28
|
+
activesupport (= 7.0.7)
|
26
29
|
activemodel-serializers-xml (1.0.2)
|
27
30
|
activemodel (> 5.x)
|
28
31
|
activesupport (> 5.x)
|
29
32
|
builder (~> 3.1)
|
30
|
-
activerecord (7.0.
|
31
|
-
activemodel (= 7.0.
|
32
|
-
activesupport (= 7.0.
|
33
|
-
activesupport (7.0.
|
33
|
+
activerecord (7.0.7)
|
34
|
+
activemodel (= 7.0.7)
|
35
|
+
activesupport (= 7.0.7)
|
36
|
+
activesupport (7.0.7)
|
34
37
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
35
38
|
i18n (>= 1.6, < 2)
|
36
39
|
minitest (>= 5.1)
|
37
40
|
tzinfo (~> 2.0)
|
38
41
|
ast (2.4.2)
|
42
|
+
base64 (0.1.1)
|
39
43
|
builder (3.2.4)
|
40
44
|
coderay (1.1.3)
|
41
45
|
concurrent-ruby (1.2.2)
|
42
46
|
crass (1.0.6)
|
43
|
-
csv (3.2.
|
47
|
+
csv (3.2.7)
|
44
48
|
diff-lcs (1.5.0)
|
45
49
|
draper (4.0.2)
|
46
50
|
actionpack (>= 5.0)
|
@@ -64,10 +68,10 @@ GEM
|
|
64
68
|
crass (~> 1.0.2)
|
65
69
|
nokogiri (>= 1.12.0)
|
66
70
|
method_source (1.0.0)
|
67
|
-
minitest (5.
|
68
|
-
nokogiri (1.15.
|
71
|
+
minitest (5.19.0)
|
72
|
+
nokogiri (1.15.4-x86_64-darwin)
|
69
73
|
racc (~> 1.4)
|
70
|
-
nokogiri (1.15.
|
74
|
+
nokogiri (1.15.4-x86_64-linux)
|
71
75
|
racc (~> 1.4)
|
72
76
|
parallel (1.23.0)
|
73
77
|
parser (3.2.2.3)
|
@@ -77,18 +81,19 @@ GEM
|
|
77
81
|
coderay (~> 1.1)
|
78
82
|
method_source (~> 1.0)
|
79
83
|
racc (1.7.1)
|
80
|
-
rack (2.2.
|
84
|
+
rack (2.2.8)
|
81
85
|
rack-test (2.1.0)
|
82
86
|
rack (>= 1.3)
|
83
|
-
rails-dom-testing (2.0
|
84
|
-
activesupport (>=
|
87
|
+
rails-dom-testing (2.2.0)
|
88
|
+
activesupport (>= 5.0.0)
|
89
|
+
minitest
|
85
90
|
nokogiri (>= 1.6)
|
86
91
|
rails-html-sanitizer (1.6.0)
|
87
92
|
loofah (~> 2.21)
|
88
93
|
nokogiri (~> 1.14)
|
89
|
-
railties (7.0.
|
90
|
-
actionpack (= 7.0.
|
91
|
-
activesupport (= 7.0.
|
94
|
+
railties (7.0.7)
|
95
|
+
actionpack (= 7.0.7)
|
96
|
+
activesupport (= 7.0.7)
|
92
97
|
method_source
|
93
98
|
rake (>= 12.2)
|
94
99
|
thor (~> 1.0)
|
@@ -98,14 +103,14 @@ GEM
|
|
98
103
|
rb-fsevent (0.11.2)
|
99
104
|
rb-inotify (0.10.1)
|
100
105
|
ffi (~> 1.0)
|
101
|
-
rbs (3.1.
|
106
|
+
rbs (3.1.3)
|
102
107
|
rbs_rails (0.12.0)
|
103
108
|
parser
|
104
109
|
rbs (>= 1)
|
105
110
|
regexp_parser (2.8.1)
|
106
111
|
request_store (1.5.1)
|
107
112
|
rack (>= 1.4)
|
108
|
-
rexml (3.2.
|
113
|
+
rexml (3.2.6)
|
109
114
|
rspec (3.12.0)
|
110
115
|
rspec-core (~> 3.12.0)
|
111
116
|
rspec-expectations (~> 3.12.0)
|
@@ -122,14 +127,16 @@ GEM
|
|
122
127
|
diff-lcs (>= 1.2.0, < 2.0)
|
123
128
|
rspec-support (~> 3.12.0)
|
124
129
|
rspec-support (3.12.0)
|
125
|
-
rubocop (1.
|
130
|
+
rubocop (1.56.0)
|
131
|
+
base64 (~> 0.1.1)
|
126
132
|
json (~> 2.3)
|
133
|
+
language_server-protocol (>= 3.17.0)
|
127
134
|
parallel (~> 1.10)
|
128
135
|
parser (>= 3.2.2.3)
|
129
136
|
rainbow (>= 2.2.2, < 4.0)
|
130
137
|
regexp_parser (>= 1.8, < 3.0)
|
131
138
|
rexml (>= 3.2.5, < 4.0)
|
132
|
-
rubocop-ast (>= 1.28.
|
139
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
133
140
|
ruby-progressbar (~> 1.7)
|
134
141
|
unicode-display_width (>= 2.4.0, < 3.0)
|
135
142
|
rubocop-ast (1.29.0)
|
@@ -137,9 +144,9 @@ GEM
|
|
137
144
|
ruby-progressbar (1.13.0)
|
138
145
|
ruby2_keywords (0.0.5)
|
139
146
|
securerandom (0.2.2)
|
140
|
-
steep (1.
|
147
|
+
steep (1.5.3)
|
141
148
|
activesupport (>= 5.1)
|
142
|
-
concurrent-ruby (>= 1.
|
149
|
+
concurrent-ruby (>= 1.1.10)
|
143
150
|
csv (>= 3.0.9)
|
144
151
|
fileutils (>= 1.1.0)
|
145
152
|
json (>= 2.1.0)
|
@@ -148,7 +155,7 @@ GEM
|
|
148
155
|
logger (>= 1.3.0)
|
149
156
|
parser (>= 3.1)
|
150
157
|
rainbow (>= 2.2.2, < 4.0)
|
151
|
-
rbs (>=
|
158
|
+
rbs (>= 3.1.0)
|
152
159
|
securerandom (>= 0.1)
|
153
160
|
strscan (>= 1.0.0)
|
154
161
|
terminal-table (>= 2, < 4)
|
@@ -159,9 +166,10 @@ GEM
|
|
159
166
|
tzinfo (2.0.6)
|
160
167
|
concurrent-ruby (~> 1.0)
|
161
168
|
unicode-display_width (2.4.2)
|
162
|
-
zeitwerk (2.6.
|
169
|
+
zeitwerk (2.6.11)
|
163
170
|
|
164
171
|
PLATFORMS
|
172
|
+
x86_64-darwin-19
|
165
173
|
x86_64-darwin-21
|
166
174
|
x86_64-linux
|
167
175
|
|
@@ -172,8 +180,8 @@ DEPENDENCIES
|
|
172
180
|
rbs_draper!
|
173
181
|
rspec
|
174
182
|
rspec-daemon
|
175
|
-
rubocop (~> 1.
|
183
|
+
rubocop (~> 1.56)
|
176
184
|
steep
|
177
185
|
|
178
186
|
BUNDLED WITH
|
179
|
-
2.4.
|
187
|
+
2.4.4
|
data/README.md
CHANGED
@@ -7,19 +7,13 @@ rbs_draper is a generator for decorators using [Draper](https://github.com/drape
|
|
7
7
|
Add a new entry to your Gemfile and run `bundle install`:
|
8
8
|
|
9
9
|
group :development do
|
10
|
-
gem 'rbs_draper'
|
10
|
+
gem 'rbs_draper', require: false
|
11
11
|
end
|
12
12
|
|
13
13
|
After the installation, please run rake task generator:
|
14
14
|
|
15
15
|
bundle exec rails g rbs_draper:install
|
16
16
|
|
17
|
-
Additionally, it would be better to add the following entry to your `rbs_collection.yml`:
|
18
|
-
|
19
|
-
gems:
|
20
|
-
- name: rbs_draper
|
21
|
-
ignore: true
|
22
|
-
|
23
17
|
## Usage
|
24
18
|
|
25
19
|
1. Run `rbs:draper:clean` at first
|
data/Steepfile
CHANGED
@@ -3,10 +3,9 @@
|
|
3
3
|
D = Steep::Diagnostic
|
4
4
|
|
5
5
|
target :lib do
|
6
|
-
signature "sig"
|
6
|
+
signature "sig", "lib/rbs_draper/sig"
|
7
7
|
|
8
|
-
check "lib"
|
9
|
-
check "Gemfile" # File name
|
8
|
+
check "lib"
|
10
9
|
|
11
|
-
configure_code_diagnostics(D::Ruby.lenient)
|
10
|
+
configure_code_diagnostics(D::Ruby.lenient)
|
12
11
|
end
|
data/lib/rbs_draper/decorator.rb
CHANGED
@@ -30,7 +30,7 @@ module RbsDraper
|
|
30
30
|
def klass_decl
|
31
31
|
<<~RBS
|
32
32
|
#{header}
|
33
|
-
|
33
|
+
#{object_method_decls}
|
34
34
|
|
35
35
|
#{method_decls}
|
36
36
|
#{footer}
|
@@ -57,6 +57,18 @@ module RbsDraper
|
|
57
57
|
end.join("\n")
|
58
58
|
end
|
59
59
|
|
60
|
+
def object_method_decls
|
61
|
+
object_name = klass_name.to_s.sub(/Decorator$/, "")
|
62
|
+
if object_name.include?("::")
|
63
|
+
"def object: () -> #{object_name}"
|
64
|
+
else
|
65
|
+
<<~RBS
|
66
|
+
def object: () -> #{object_name}
|
67
|
+
def #{object_name.underscore}: () -> #{object_name}
|
68
|
+
RBS
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
60
72
|
def method_decls
|
61
73
|
delegated_methods.filter_map do |name, method|
|
62
74
|
next if user_defined_class&.methods&.fetch(name, nil)
|
@@ -76,7 +88,7 @@ module RbsDraper
|
|
76
88
|
end
|
77
89
|
|
78
90
|
def decorated_class
|
79
|
-
type_name = RBS::TypeName(klass.name.sub(/Decorator$/, "")).absolute!
|
91
|
+
type_name = RBS::TypeName(klass.name.to_s.sub(/Decorator$/, "")).absolute!
|
80
92
|
@decorated_class ||= rbs_builder.build_instance(type_name)
|
81
93
|
rescue StandardError
|
82
94
|
nil
|
@@ -85,8 +97,11 @@ module RbsDraper
|
|
85
97
|
def delegated_methods
|
86
98
|
return [] unless klass.ancestors.include? ::Draper::AutomaticDelegation
|
87
99
|
|
88
|
-
|
89
|
-
|
100
|
+
decorated_klass = decorated_class
|
101
|
+
return [] unless decorated_klass
|
102
|
+
|
103
|
+
decorated_klass.methods.keys.sort.filter_map do |name|
|
104
|
+
method = decorated_klass.methods[name]
|
90
105
|
next if %w[::Object ::BasicObject ::Kernel].include? method.defined_in.to_s
|
91
106
|
|
92
107
|
[name, method] if method.accessibility == :public
|
data/lib/rbs_draper/rake_task.rb
CHANGED
@@ -43,6 +43,8 @@ module RbsDraper
|
|
43
43
|
def define_base_class_generate_task
|
44
44
|
desc "Generate RBS files for base classes"
|
45
45
|
task("#{name}:base_class:generate": :environment) do
|
46
|
+
require "rbs_draper" # load RbsDraper lazily
|
47
|
+
|
46
48
|
signature_root_dir.mkpath
|
47
49
|
|
48
50
|
basedir = Pathname(__FILE__).dirname
|
@@ -54,10 +56,12 @@ module RbsDraper
|
|
54
56
|
def define_decoratables_generate_task
|
55
57
|
desc "Generate RBS files for decoratable models"
|
56
58
|
task("#{name}:decoratables:generate": :environment) do
|
59
|
+
require "rbs_draper" # load RbsDraper lazily
|
60
|
+
|
57
61
|
Rails.application.eager_load!
|
58
62
|
|
59
63
|
RbsDraper::Decoratable.all.each do |klass|
|
60
|
-
path = signature_root_dir / "app/models/#{klass.name.underscore}.rbs"
|
64
|
+
path = signature_root_dir / "app/models/#{klass.name.to_s.underscore}.rbs"
|
61
65
|
path.dirname.mkpath
|
62
66
|
rbs = RbsDraper::Decoratable.class_to_rbs(klass)
|
63
67
|
path.write rbs if rbs
|
data/lib/rbs_draper/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: a4c633634493ab7ae73219022f56acff56ab69af
|
6
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
7
7
|
repo_dir: gems
|
8
8
|
path: ".gem_rbs_collection"
|
@@ -16,7 +16,7 @@ gems:
|
|
16
16
|
source:
|
17
17
|
type: git
|
18
18
|
name: ruby/gem_rbs_collection
|
19
|
-
revision:
|
19
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
20
20
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
21
21
|
repo_dir: gems
|
22
22
|
- name: actionview
|
@@ -24,7 +24,7 @@ gems:
|
|
24
24
|
source:
|
25
25
|
type: git
|
26
26
|
name: ruby/gem_rbs_collection
|
27
|
-
revision:
|
27
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
28
28
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
29
29
|
repo_dir: gems
|
30
30
|
- name: activemodel
|
@@ -32,7 +32,7 @@ gems:
|
|
32
32
|
source:
|
33
33
|
type: git
|
34
34
|
name: ruby/gem_rbs_collection
|
35
|
-
revision:
|
35
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
36
36
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
37
37
|
repo_dir: gems
|
38
38
|
- name: activerecord
|
@@ -40,7 +40,7 @@ gems:
|
|
40
40
|
source:
|
41
41
|
type: git
|
42
42
|
name: ruby/gem_rbs_collection
|
43
|
-
revision:
|
43
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
44
44
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
45
45
|
repo_dir: gems
|
46
46
|
- name: activesupport
|
@@ -48,7 +48,7 @@ gems:
|
|
48
48
|
source:
|
49
49
|
type: git
|
50
50
|
name: ruby/gem_rbs_collection
|
51
|
-
revision:
|
51
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
52
52
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
53
53
|
repo_dir: gems
|
54
54
|
- name: ast
|
@@ -56,9 +56,13 @@ gems:
|
|
56
56
|
source:
|
57
57
|
type: git
|
58
58
|
name: ruby/gem_rbs_collection
|
59
|
-
revision:
|
59
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
60
60
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
61
61
|
repo_dir: gems
|
62
|
+
- name: base64
|
63
|
+
version: '0'
|
64
|
+
source:
|
65
|
+
type: stdlib
|
62
66
|
- name: cgi
|
63
67
|
version: '0'
|
64
68
|
source:
|
@@ -68,19 +72,23 @@ gems:
|
|
68
72
|
source:
|
69
73
|
type: git
|
70
74
|
name: ruby/gem_rbs_collection
|
71
|
-
revision:
|
75
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
72
76
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
73
77
|
repo_dir: gems
|
74
78
|
- name: date
|
75
79
|
version: '0'
|
76
80
|
source:
|
77
81
|
type: stdlib
|
82
|
+
- name: fileutils
|
83
|
+
version: '0'
|
84
|
+
source:
|
85
|
+
type: stdlib
|
78
86
|
- name: i18n
|
79
87
|
version: '1.10'
|
80
88
|
source:
|
81
89
|
type: git
|
82
90
|
name: ruby/gem_rbs_collection
|
83
|
-
revision:
|
91
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
84
92
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
85
93
|
repo_dir: gems
|
86
94
|
- name: json
|
@@ -108,7 +116,7 @@ gems:
|
|
108
116
|
source:
|
109
117
|
type: git
|
110
118
|
name: ruby/gem_rbs_collection
|
111
|
-
revision:
|
119
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
112
120
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
113
121
|
repo_dir: gems
|
114
122
|
- name: optparse
|
@@ -120,7 +128,7 @@ gems:
|
|
120
128
|
source:
|
121
129
|
type: git
|
122
130
|
name: ruby/gem_rbs_collection
|
123
|
-
revision:
|
131
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
124
132
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
125
133
|
repo_dir: gems
|
126
134
|
- name: pathname
|
@@ -132,7 +140,7 @@ gems:
|
|
132
140
|
source:
|
133
141
|
type: git
|
134
142
|
name: ruby/gem_rbs_collection
|
135
|
-
revision:
|
143
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
136
144
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
137
145
|
repo_dir: gems
|
138
146
|
- name: rails-dom-testing
|
@@ -140,7 +148,7 @@ gems:
|
|
140
148
|
source:
|
141
149
|
type: git
|
142
150
|
name: ruby/gem_rbs_collection
|
143
|
-
revision:
|
151
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
144
152
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
145
153
|
repo_dir: gems
|
146
154
|
- name: railties
|
@@ -148,7 +156,7 @@ gems:
|
|
148
156
|
source:
|
149
157
|
type: git
|
150
158
|
name: ruby/gem_rbs_collection
|
151
|
-
revision:
|
159
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
152
160
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
153
161
|
repo_dir: gems
|
154
162
|
- name: rainbow
|
@@ -156,11 +164,11 @@ gems:
|
|
156
164
|
source:
|
157
165
|
type: git
|
158
166
|
name: ruby/gem_rbs_collection
|
159
|
-
revision:
|
167
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
160
168
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
161
169
|
repo_dir: gems
|
162
170
|
- name: rbs
|
163
|
-
version: 3.1.
|
171
|
+
version: 3.1.3
|
164
172
|
source:
|
165
173
|
type: rubygems
|
166
174
|
- name: rbs_rails
|
@@ -176,9 +184,13 @@ gems:
|
|
176
184
|
source:
|
177
185
|
type: git
|
178
186
|
name: ruby/gem_rbs_collection
|
179
|
-
revision:
|
187
|
+
revision: a4c633634493ab7ae73219022f56acff56ab69af
|
180
188
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
181
189
|
repo_dir: gems
|
190
|
+
- name: securerandom
|
191
|
+
version: '0'
|
192
|
+
source:
|
193
|
+
type: stdlib
|
182
194
|
- name: singleton
|
183
195
|
version: '0'
|
184
196
|
source:
|
data/rbs_draper.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "A RBS files generator for Draper decorators"
|
13
13
|
spec.homepage = "https://github.com/tk0miya/rbs_draper"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">=
|
15
|
+
spec.required_ruby_version = ">= 2.7"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = spec.homepage
|
@@ -27,7 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
+
spec.add_dependency "activesupport"
|
30
31
|
spec.add_dependency "draper"
|
32
|
+
spec.add_dependency "fileutils"
|
33
|
+
spec.add_dependency "rbs"
|
31
34
|
spec.add_dependency "rbs_rails"
|
32
35
|
|
33
36
|
# For more information and examples about making a new gem, check out our
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module RbsDraper
|
2
2
|
module Decoratable
|
3
|
-
def self.all: () -> Array[
|
4
|
-
def self.class_to_rbs: (
|
3
|
+
def self.all: () -> Array[singleton(Draper::Decoratable)]
|
4
|
+
def self.class_to_rbs: (singleton(Draper::Decoratable) klass) -> String
|
5
5
|
|
6
6
|
class Generator
|
7
|
-
attr_reader klass:
|
7
|
+
attr_reader klass: singleton(Draper::Decoratable)
|
8
8
|
attr_reader klass_name: String
|
9
9
|
|
10
|
-
def initialize: (
|
10
|
+
def initialize: (singleton(Draper::Decoratable) klass) -> void
|
11
11
|
def generate: () -> String
|
12
12
|
|
13
13
|
private
|
@@ -1,27 +1,28 @@
|
|
1
1
|
module RbsDraper
|
2
2
|
module Decorator
|
3
|
-
def self.class_to_rbs: (
|
3
|
+
def self.class_to_rbs: (singleton(Draper::Decorator) klass, RBS::DefinitionBuilder rbs_builder) -> String?
|
4
4
|
|
5
5
|
class Generator
|
6
|
-
attr_reader klass:
|
6
|
+
attr_reader klass: singleton(Draper::Decorator)
|
7
7
|
attr_reader klass_name: String
|
8
8
|
attr_reader rbs_builder: RBS::DefinitionBuilder
|
9
9
|
|
10
10
|
@decorated_class: RBS::Definition
|
11
11
|
@user_defined_class: RBS::Definition
|
12
12
|
|
13
|
-
def initialize: (
|
13
|
+
def initialize: (singleton(Draper::Decorator) klass, RBS::DefinitionBuilder rbs_builder) -> void
|
14
14
|
def generate: () -> String?
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def klass_decl: () -> String
|
19
19
|
def header: () -> String
|
20
|
+
def object_method_decls: () -> String
|
20
21
|
def method_decls: () -> String?
|
21
22
|
def footer: () -> String
|
22
23
|
def module_names: () -> Array[String]
|
23
24
|
def decorated_class: () -> RBS::Definition?
|
24
|
-
def delegated_methods: () -> Array[[Symbol, RBS::Definition]]
|
25
|
+
def delegated_methods: () -> Array[[Symbol, RBS::Definition::Method]]
|
25
26
|
def user_defined_class: () -> RBS::Definition?
|
26
27
|
end
|
27
28
|
end
|
data/sig/shims/rake.rbs
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Rake
|
2
|
+
class TaskLib
|
3
|
+
include Rake::DSL
|
4
|
+
end
|
5
|
+
|
6
|
+
module DSL
|
7
|
+
private
|
8
|
+
|
9
|
+
def desc: (String description) -> void
|
10
|
+
def file: (*untyped args) ?{ () -> void } -> void
|
11
|
+
def import: (*String fns) -> void
|
12
|
+
def multitask: (*untyped args) ?{ () -> void } -> void
|
13
|
+
def namespace: (?String? name) ?{ () -> void } -> void
|
14
|
+
def rule: (*untyped args) ?{ () -> void } -> void
|
15
|
+
def task: (*untyped args) ?{ () -> void } -> void
|
16
|
+
def sh: (*String cmd) ?{ (bool, Process::Status) -> void } -> void
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
data/sig/shims/thor.rbs
ADDED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_draper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
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-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: draper
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,6 +38,34 @@ dependencies:
|
|
24
38
|
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fileutils
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rbs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: rbs_rails
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,6 +112,8 @@ files:
|
|
70
112
|
- sig/rbs_draper/decoratable.rbs
|
71
113
|
- sig/rbs_draper/decorator.rbs
|
72
114
|
- sig/rbs_draper/rake_task.rbs
|
115
|
+
- sig/shims/rake.rbs
|
116
|
+
- sig/shims/thor.rbs
|
73
117
|
homepage: https://github.com/tk0miya/rbs_draper
|
74
118
|
licenses:
|
75
119
|
- MIT
|
@@ -85,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
129
|
requirements:
|
86
130
|
- - ">="
|
87
131
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
132
|
+
version: '2.7'
|
89
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
134
|
requirements:
|
91
135
|
- - ">="
|