rbs_rails 0.12.1 → 0.13.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/.github/workflows/ci.yml +1 -1
- data/.github/workflows/release.yml +27 -0
- data/CHANGELOG.md +56 -0
- data/Gemfile +7 -1
- data/Gemfile.lock +111 -93
- data/README.md +46 -1
- data/Rakefile +7 -2
- data/example/rbs_rails.rb +27 -0
- data/exe/rbs_rails +6 -0
- data/lib/generators/rbs_rails/install_generator.rb +1 -10
- data/lib/rbs_rails/active_record/enum.rb +81 -0
- data/lib/rbs_rails/active_record.rb +233 -143
- data/lib/rbs_rails/cli/configuration.rb +66 -0
- data/lib/rbs_rails/cli.rb +173 -0
- data/lib/rbs_rails/dependency_builder.rb +25 -8
- data/lib/rbs_rails/path_helpers.rb +14 -2
- data/lib/rbs_rails/rake_task.rb +38 -40
- data/lib/rbs_rails/util/file_writer.rb +22 -0
- data/lib/rbs_rails/util.rb +11 -4
- data/lib/rbs_rails/version.rb +1 -1
- data/lib/rbs_rails.rb +5 -2
- data/rbs_collection.lock.yaml +86 -38
- data/rbs_collection.yaml +1 -16
- data/rbs_rails.gemspec +1 -0
- data/sig/{install_generator.rbs → generators/rbs_rails/install_generator.rbs} +2 -0
- data/sig/rbs_rails/active_record/enum.rbs +26 -0
- data/sig/rbs_rails/active_record.rbs +67 -49
- data/sig/rbs_rails/cli/configuration.rbs +37 -0
- data/sig/rbs_rails/cli.rbs +35 -0
- data/sig/rbs_rails/dependency_builder.rbs +7 -3
- data/sig/rbs_rails/path_helpers.rbs +13 -6
- data/sig/rbs_rails/rake_task.rbs +7 -6
- data/sig/rbs_rails/util/file_writer.rbs +16 -0
- data/sig/rbs_rails/util.rbs +7 -2
- data/sig/rbs_rails/utils/file_writer.rbs +4 -0
- data/sig/rbs_rails/version.rbs +5 -1
- data/sig/rbs_rails.rbs +6 -3
- metadata +32 -8
- data/sig/_internal/activerecord.rbs +0 -4
- data/sig/parser.rbs +0 -14
- data/sig/rake.rbs +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7d71f04b224c69937d2e7c3fca24a085a5475ec09425baa810577d8dc403600
|
|
4
|
+
data.tar.gz: b5e4959c6afaf50ac5c9569cb095ef52eb4c54b38a48083337c177297afb05e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f23018664d11f5bd9a94451830f0370e5f295bb0571ae5fc7927d7e8afe05a697bc0f51be10794924001319b8440aa0ab7ef0381f8d0df811ef8135a1162dd3
|
|
7
|
+
data.tar.gz: 37725067cf0c61a72b173f7faad77381652f04a4f8948855c318d88022ae50b34cfb277369b3ca0bbb09c1be6be4fa553b1c40a8ae70acd52c5f2ab90237e933
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
paths:
|
|
8
|
+
- "lib/rbs_rails/version.rb"
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Ruby
|
|
21
|
+
uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: "4.0"
|
|
24
|
+
bundler-cache: true
|
|
25
|
+
|
|
26
|
+
- name: Publish to RubyGems
|
|
27
|
+
uses: rubygems/release-gem@v1
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
## master (unreleased)
|
|
4
4
|
|
|
5
|
+
## 0.13
|
|
6
|
+
|
|
7
|
+
### New features
|
|
8
|
+
|
|
9
|
+
* Enable type generation for models with composite primary keys [#358](https://github.com/pocke/rbs_rails/pull/358)
|
|
10
|
+
* Add optional arguments for column_changed? and column_previously_changed? [#357](https://github.com/pocke/rbs_rails/pull/357)
|
|
11
|
+
* Check database migrations before generating types for models [#342](https://github.com/pocke/rbs_rails/pull/342)
|
|
12
|
+
* Integrate model_dependencies.rbs to each model signatures [#345](https://github.com/pocke/rbs_rails/pull/345)
|
|
13
|
+
* Do not update RBS file if the signature nothing changed [#346](https://github.com/pocke/rbs_rails/pull/346)
|
|
14
|
+
* support alias attribute in enum definitions [#325](https://github.com/pocke/rbs_rails/pull/325)
|
|
15
|
+
* active_record: Support #id_value alias for #id column [#350](https://github.com/pocke/rbs_rails/pull/350)
|
|
16
|
+
* Allow overrides methods in subclasses [#317](https://github.com/pocke/rbs_rails/pull/317)
|
|
17
|
+
* feat: Add command line interface for rbs_rails [#335](https://github.com/pocke/rbs_rails/pull/335)
|
|
18
|
+
* feat: Display class name when RBS generation fails [#334](https://github.com/pocke/rbs_rails/pull/334)
|
|
19
|
+
* Support no-arguments in create_** method for has_one associations [#333](https://github.com/pocke/rbs_rails/pull/333)
|
|
20
|
+
* Add #{attribute}_before_type_cast and #{attribute}_for_database methods for attributes [#322](https://github.com/pocke/rbs_rails/pull/322)
|
|
21
|
+
* Support has_and_belongs_to_many [#272](https://github.com/pocke/rbs_rails/pull/272)
|
|
22
|
+
* Support special directory structures, such as when using packs-rails [#323](https://github.com/pocke/rbs_rails/pull/323)
|
|
23
|
+
* enum: Support Rails 7 style enum definitions [#311](https://github.com/pocke/rbs_rails/pull/311)
|
|
24
|
+
* add generate columns aliased by alias_attibute [#318](https://github.com/pocke/rbs_rails/pull/318)
|
|
25
|
+
* Add additional enum methods [#312](https://github.com/pocke/rbs_rails/pull/312)
|
|
26
|
+
* enum: Support array-style enum declarations [#310](https://github.com/pocke/rbs_rails/pull/310)
|
|
27
|
+
* Support resolve-type-names header [#304](https://github.com/pocke/rbs_rails/pull/304)
|
|
28
|
+
* Install _RbsRailsPathHelpers to ActionController::Base by default [#279](https://github.com/pocke/rbs_rails/pull/279)
|
|
29
|
+
* Override types of CollectionProxy [#289](https://github.com/pocke/rbs_rails/pull/289)
|
|
30
|
+
* path_helpers: Support Rails 8.0 [#283](https://github.com/pocke/rbs_rails/pull/283)
|
|
31
|
+
* Reimplement enum inspector via spy [#296](https://github.com/pocke/rbs_rails/pull/296)
|
|
32
|
+
* generated rbs for activerecord models respects serialize (common cases) [#293](https://github.com/pocke/rbs_rails/pull/293)
|
|
33
|
+
|
|
34
|
+
### Bug fixes
|
|
35
|
+
|
|
36
|
+
* Avoid reusing the same object when generating attribute aliases [#361](https://github.com/pocke/rbs_rails/pull/361)
|
|
37
|
+
* Use Prism instead of parser/current to suppress warnings [#362](https://github.com/pocke/rbs_rails/pull/362)
|
|
38
|
+
* Fix: Ruby::UnresolvedOverloading error when calling ::ActiveRecord::Relation#select [#353](https://github.com/pocke/rbs_rails/pull/353)
|
|
39
|
+
* CI: Fix broken testcases [#336](https://github.com/pocke/rbs_rails/pull/336)
|
|
40
|
+
* fix: external library models not saved to correct path structure [#324](https://github.com/pocke/rbs_rails/pull/324)
|
|
41
|
+
* Fix [#{](https://github.com/pocke/rbs_rails/pull/{)attribute}_before_type_cast and {#attribute}_for_database methods test #330
|
|
42
|
+
* test: Adjust expectations for Blog model [#327](https://github.com/pocke/rbs_rails/pull/327)
|
|
43
|
+
* Fix [#233](https://github.com/pocke/rbs_rails/pull/233): Support enum name including unexpected characters #285
|
|
44
|
+
* test: Update db/schema.rb on test app [#307](https://github.com/pocke/rbs_rails/pull/307)
|
|
45
|
+
* Fix [#277](https://github.com/pocke/rbs_rails/pull/277): CollectionProxy should include Enumerable explicitly #278
|
|
46
|
+
|
|
47
|
+
### misc
|
|
48
|
+
|
|
49
|
+
* CI: Hello Ruby 4.0! [#359](https://github.com/pocke/rbs_rails/pull/359)
|
|
50
|
+
* deps: Drop Rails 6 support [#355](https://github.com/pocke/rbs_rails/pull/355)
|
|
51
|
+
* test: Share build results across tests to reduce build times [#337](https://github.com/pocke/rbs_rails/pull/337)
|
|
52
|
+
* CI: Add GitHub Actions workflow for releasing gem [#309](https://github.com/pocke/rbs_rails/pull/309)
|
|
53
|
+
* test: Upgrade testing Rails app to 7.2 [#321](https://github.com/pocke/rbs_rails/pull/321)
|
|
54
|
+
* Manage types of this gem using RBS::Inline [#300](https://github.com/pocke/rbs_rails/pull/300)
|
|
55
|
+
* rake: Remove deprecated --silent option from rbs validate [#306](https://github.com/pocke/rbs_rails/pull/306)
|
|
56
|
+
* CI: Test with ruby 3.4 💎 [#301](https://github.com/pocke/rbs_rails/pull/301)
|
|
57
|
+
* sig: Remove sig/rake.rbs [#295](https://github.com/pocke/rbs_rails/pull/295)
|
|
58
|
+
* Add path helper method tests [#292](https://github.com/pocke/rbs_rails/pull/292)
|
|
59
|
+
* deps: Add benchmark gem to test/app/Gemfile [#294](https://github.com/pocke/rbs_rails/pull/294)
|
|
60
|
+
|
|
5
61
|
## 0.12.1
|
|
6
62
|
|
|
7
63
|
* Drop support for old Rubies. [#284](https://github.com/pocke/rbs_rails/pull/284)
|
data/Gemfile
CHANGED
|
@@ -8,5 +8,11 @@ gemspec
|
|
|
8
8
|
gem "rake", "~> 13.0"
|
|
9
9
|
gem 'rails', '>= 7.0'
|
|
10
10
|
gem 'rbs', '>= 3'
|
|
11
|
-
gem '
|
|
11
|
+
gem 'rbs-inline', require: false
|
|
12
|
+
gem 'steep', '>= 1.4', require: false
|
|
12
13
|
gem 'minitest'
|
|
14
|
+
gem 'minitest-hooks'
|
|
15
|
+
|
|
16
|
+
# Temporary workaround for Ruby 4.1+ where tsort is no longer bundled.
|
|
17
|
+
# Can be removed once rbs adds tsort as a runtime dependency.
|
|
18
|
+
gem 'tsort'
|
data/Gemfile.lock
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rbs_rails (0.
|
|
4
|
+
rbs_rails (0.13.0)
|
|
5
5
|
parser
|
|
6
|
+
prism
|
|
6
7
|
rbs (>= 1)
|
|
7
8
|
|
|
8
9
|
GEM
|
|
9
10
|
remote: https://rubygems.org/
|
|
10
11
|
specs:
|
|
11
|
-
actioncable (7.2.2)
|
|
12
|
-
actionpack (= 7.2.2)
|
|
13
|
-
activesupport (= 7.2.2)
|
|
12
|
+
actioncable (7.2.2.2)
|
|
13
|
+
actionpack (= 7.2.2.2)
|
|
14
|
+
activesupport (= 7.2.2.2)
|
|
14
15
|
nio4r (~> 2.0)
|
|
15
16
|
websocket-driver (>= 0.6.1)
|
|
16
17
|
zeitwerk (~> 2.6)
|
|
17
|
-
actionmailbox (7.2.2)
|
|
18
|
-
actionpack (= 7.2.2)
|
|
19
|
-
activejob (= 7.2.2)
|
|
20
|
-
activerecord (= 7.2.2)
|
|
21
|
-
activestorage (= 7.2.2)
|
|
22
|
-
activesupport (= 7.2.2)
|
|
18
|
+
actionmailbox (7.2.2.2)
|
|
19
|
+
actionpack (= 7.2.2.2)
|
|
20
|
+
activejob (= 7.2.2.2)
|
|
21
|
+
activerecord (= 7.2.2.2)
|
|
22
|
+
activestorage (= 7.2.2.2)
|
|
23
|
+
activesupport (= 7.2.2.2)
|
|
23
24
|
mail (>= 2.8.0)
|
|
24
|
-
actionmailer (7.2.2)
|
|
25
|
-
actionpack (= 7.2.2)
|
|
26
|
-
actionview (= 7.2.2)
|
|
27
|
-
activejob (= 7.2.2)
|
|
28
|
-
activesupport (= 7.2.2)
|
|
25
|
+
actionmailer (7.2.2.2)
|
|
26
|
+
actionpack (= 7.2.2.2)
|
|
27
|
+
actionview (= 7.2.2.2)
|
|
28
|
+
activejob (= 7.2.2.2)
|
|
29
|
+
activesupport (= 7.2.2.2)
|
|
29
30
|
mail (>= 2.8.0)
|
|
30
31
|
rails-dom-testing (~> 2.2)
|
|
31
|
-
actionpack (7.2.2)
|
|
32
|
-
actionview (= 7.2.2)
|
|
33
|
-
activesupport (= 7.2.2)
|
|
32
|
+
actionpack (7.2.2.2)
|
|
33
|
+
actionview (= 7.2.2.2)
|
|
34
|
+
activesupport (= 7.2.2.2)
|
|
34
35
|
nokogiri (>= 1.8.5)
|
|
35
36
|
racc
|
|
36
37
|
rack (>= 2.2.4, < 3.2)
|
|
@@ -39,35 +40,35 @@ GEM
|
|
|
39
40
|
rails-dom-testing (~> 2.2)
|
|
40
41
|
rails-html-sanitizer (~> 1.6)
|
|
41
42
|
useragent (~> 0.16)
|
|
42
|
-
actiontext (7.2.2)
|
|
43
|
-
actionpack (= 7.2.2)
|
|
44
|
-
activerecord (= 7.2.2)
|
|
45
|
-
activestorage (= 7.2.2)
|
|
46
|
-
activesupport (= 7.2.2)
|
|
43
|
+
actiontext (7.2.2.2)
|
|
44
|
+
actionpack (= 7.2.2.2)
|
|
45
|
+
activerecord (= 7.2.2.2)
|
|
46
|
+
activestorage (= 7.2.2.2)
|
|
47
|
+
activesupport (= 7.2.2.2)
|
|
47
48
|
globalid (>= 0.6.0)
|
|
48
49
|
nokogiri (>= 1.8.5)
|
|
49
|
-
actionview (7.2.2)
|
|
50
|
-
activesupport (= 7.2.2)
|
|
50
|
+
actionview (7.2.2.2)
|
|
51
|
+
activesupport (= 7.2.2.2)
|
|
51
52
|
builder (~> 3.1)
|
|
52
53
|
erubi (~> 1.11)
|
|
53
54
|
rails-dom-testing (~> 2.2)
|
|
54
55
|
rails-html-sanitizer (~> 1.6)
|
|
55
|
-
activejob (7.2.2)
|
|
56
|
-
activesupport (= 7.2.2)
|
|
56
|
+
activejob (7.2.2.2)
|
|
57
|
+
activesupport (= 7.2.2.2)
|
|
57
58
|
globalid (>= 0.3.6)
|
|
58
|
-
activemodel (7.2.2)
|
|
59
|
-
activesupport (= 7.2.2)
|
|
60
|
-
activerecord (7.2.2)
|
|
61
|
-
activemodel (= 7.2.2)
|
|
62
|
-
activesupport (= 7.2.2)
|
|
59
|
+
activemodel (7.2.2.2)
|
|
60
|
+
activesupport (= 7.2.2.2)
|
|
61
|
+
activerecord (7.2.2.2)
|
|
62
|
+
activemodel (= 7.2.2.2)
|
|
63
|
+
activesupport (= 7.2.2.2)
|
|
63
64
|
timeout (>= 0.4.0)
|
|
64
|
-
activestorage (7.2.2)
|
|
65
|
-
actionpack (= 7.2.2)
|
|
66
|
-
activejob (= 7.2.2)
|
|
67
|
-
activerecord (= 7.2.2)
|
|
68
|
-
activesupport (= 7.2.2)
|
|
65
|
+
activestorage (7.2.2.2)
|
|
66
|
+
actionpack (= 7.2.2.2)
|
|
67
|
+
activejob (= 7.2.2.2)
|
|
68
|
+
activerecord (= 7.2.2.2)
|
|
69
|
+
activesupport (= 7.2.2.2)
|
|
69
70
|
marcel (~> 1.0)
|
|
70
|
-
activesupport (7.2.2)
|
|
71
|
+
activesupport (7.2.2.2)
|
|
71
72
|
base64
|
|
72
73
|
benchmark (>= 0.3)
|
|
73
74
|
bigdecimal
|
|
@@ -79,35 +80,35 @@ GEM
|
|
|
79
80
|
minitest (>= 5.1)
|
|
80
81
|
securerandom (>= 0.3)
|
|
81
82
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
82
|
-
ast (2.4.
|
|
83
|
-
base64 (0.
|
|
84
|
-
benchmark (0.
|
|
85
|
-
bigdecimal (3.
|
|
83
|
+
ast (2.4.3)
|
|
84
|
+
base64 (0.3.0)
|
|
85
|
+
benchmark (0.4.1)
|
|
86
|
+
bigdecimal (3.2.2)
|
|
86
87
|
builder (3.3.0)
|
|
87
|
-
concurrent-ruby (1.3.
|
|
88
|
-
connection_pool (2.
|
|
88
|
+
concurrent-ruby (1.3.5)
|
|
89
|
+
connection_pool (2.5.3)
|
|
89
90
|
crass (1.0.6)
|
|
90
|
-
csv (3.3.
|
|
91
|
-
date (3.4.
|
|
92
|
-
drb (2.2.
|
|
93
|
-
erubi (1.13.
|
|
94
|
-
ffi (1.17.
|
|
91
|
+
csv (3.3.4)
|
|
92
|
+
date (3.4.1)
|
|
93
|
+
drb (2.2.3)
|
|
94
|
+
erubi (1.13.1)
|
|
95
|
+
ffi (1.17.2)
|
|
95
96
|
fileutils (1.7.3)
|
|
96
97
|
globalid (1.2.1)
|
|
97
98
|
activesupport (>= 6.1)
|
|
98
|
-
i18n (1.14.
|
|
99
|
+
i18n (1.14.7)
|
|
99
100
|
concurrent-ruby (~> 1.0)
|
|
100
101
|
io-console (0.7.2)
|
|
101
102
|
irb (1.14.1)
|
|
102
103
|
rdoc (>= 4.0.0)
|
|
103
104
|
reline (>= 0.4.2)
|
|
104
|
-
json (2.
|
|
105
|
-
language_server-protocol (3.17.0.
|
|
105
|
+
json (2.11.3)
|
|
106
|
+
language_server-protocol (3.17.0.4)
|
|
106
107
|
listen (3.9.0)
|
|
107
108
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
108
109
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
109
|
-
logger (1.
|
|
110
|
-
loofah (2.
|
|
110
|
+
logger (1.7.0)
|
|
111
|
+
loofah (2.24.1)
|
|
111
112
|
crass (~> 1.0.2)
|
|
112
113
|
nokogiri (>= 1.12.0)
|
|
113
114
|
mail (2.8.1)
|
|
@@ -117,9 +118,12 @@ GEM
|
|
|
117
118
|
net-smtp
|
|
118
119
|
marcel (1.0.4)
|
|
119
120
|
mini_mime (1.1.5)
|
|
120
|
-
mini_portile2 (2.8.
|
|
121
|
-
minitest (5.
|
|
122
|
-
|
|
121
|
+
mini_portile2 (2.8.9)
|
|
122
|
+
minitest (5.27.0)
|
|
123
|
+
minitest-hooks (1.5.2)
|
|
124
|
+
minitest (> 5.3)
|
|
125
|
+
mutex_m (0.3.0)
|
|
126
|
+
net-imap (0.5.7)
|
|
123
127
|
date
|
|
124
128
|
net-protocol
|
|
125
129
|
net-pop (0.1.2)
|
|
@@ -129,46 +133,48 @@ GEM
|
|
|
129
133
|
net-smtp (0.5.0)
|
|
130
134
|
net-protocol
|
|
131
135
|
nio4r (2.7.4)
|
|
132
|
-
nokogiri (1.
|
|
136
|
+
nokogiri (1.18.9)
|
|
133
137
|
mini_portile2 (~> 2.8.2)
|
|
134
138
|
racc (~> 1.4)
|
|
135
|
-
parser (3.3.
|
|
139
|
+
parser (3.3.8.0)
|
|
136
140
|
ast (~> 2.4.1)
|
|
137
141
|
racc
|
|
142
|
+
prism (1.2.0)
|
|
138
143
|
psych (5.1.2)
|
|
139
144
|
stringio
|
|
140
145
|
racc (1.8.1)
|
|
141
|
-
rack (3.1.
|
|
142
|
-
rack-session (2.
|
|
146
|
+
rack (3.1.18)
|
|
147
|
+
rack-session (2.1.1)
|
|
148
|
+
base64 (>= 0.1.0)
|
|
143
149
|
rack (>= 3.0.0)
|
|
144
|
-
rack-test (2.
|
|
150
|
+
rack-test (2.2.0)
|
|
145
151
|
rack (>= 1.3)
|
|
146
152
|
rackup (2.2.0)
|
|
147
153
|
rack (>= 3)
|
|
148
|
-
rails (7.2.2)
|
|
149
|
-
actioncable (= 7.2.2)
|
|
150
|
-
actionmailbox (= 7.2.2)
|
|
151
|
-
actionmailer (= 7.2.2)
|
|
152
|
-
actionpack (= 7.2.2)
|
|
153
|
-
actiontext (= 7.2.2)
|
|
154
|
-
actionview (= 7.2.2)
|
|
155
|
-
activejob (= 7.2.2)
|
|
156
|
-
activemodel (= 7.2.2)
|
|
157
|
-
activerecord (= 7.2.2)
|
|
158
|
-
activestorage (= 7.2.2)
|
|
159
|
-
activesupport (= 7.2.2)
|
|
154
|
+
rails (7.2.2.2)
|
|
155
|
+
actioncable (= 7.2.2.2)
|
|
156
|
+
actionmailbox (= 7.2.2.2)
|
|
157
|
+
actionmailer (= 7.2.2.2)
|
|
158
|
+
actionpack (= 7.2.2.2)
|
|
159
|
+
actiontext (= 7.2.2.2)
|
|
160
|
+
actionview (= 7.2.2.2)
|
|
161
|
+
activejob (= 7.2.2.2)
|
|
162
|
+
activemodel (= 7.2.2.2)
|
|
163
|
+
activerecord (= 7.2.2.2)
|
|
164
|
+
activestorage (= 7.2.2.2)
|
|
165
|
+
activesupport (= 7.2.2.2)
|
|
160
166
|
bundler (>= 1.15.0)
|
|
161
|
-
railties (= 7.2.2)
|
|
162
|
-
rails-dom-testing (2.
|
|
167
|
+
railties (= 7.2.2.2)
|
|
168
|
+
rails-dom-testing (2.3.0)
|
|
163
169
|
activesupport (>= 5.0.0)
|
|
164
170
|
minitest
|
|
165
171
|
nokogiri (>= 1.6)
|
|
166
|
-
rails-html-sanitizer (1.6.
|
|
172
|
+
rails-html-sanitizer (1.6.2)
|
|
167
173
|
loofah (~> 2.21)
|
|
168
|
-
nokogiri (
|
|
169
|
-
railties (7.2.2)
|
|
170
|
-
actionpack (= 7.2.2)
|
|
171
|
-
activesupport (= 7.2.2)
|
|
174
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
175
|
+
railties (7.2.2.2)
|
|
176
|
+
actionpack (= 7.2.2.2)
|
|
177
|
+
activesupport (= 7.2.2.2)
|
|
172
178
|
irb (~> 1.13)
|
|
173
179
|
rackup (>= 1.0.0)
|
|
174
180
|
rake (>= 12.2)
|
|
@@ -179,38 +185,47 @@ GEM
|
|
|
179
185
|
rb-fsevent (0.11.2)
|
|
180
186
|
rb-inotify (0.11.1)
|
|
181
187
|
ffi (~> 1.0)
|
|
182
|
-
rbs (3.
|
|
188
|
+
rbs (3.9.5)
|
|
183
189
|
logger
|
|
190
|
+
rbs-inline (0.11.0)
|
|
191
|
+
prism (>= 0.29, < 1.3)
|
|
192
|
+
rbs (>= 3.5.0)
|
|
184
193
|
rdoc (6.7.0)
|
|
185
194
|
psych (>= 4.0.0)
|
|
186
195
|
reline (0.5.10)
|
|
187
196
|
io-console (~> 0.5)
|
|
188
|
-
securerandom (0.
|
|
189
|
-
steep (1.
|
|
197
|
+
securerandom (0.4.1)
|
|
198
|
+
steep (1.10.0)
|
|
190
199
|
activesupport (>= 5.1)
|
|
191
200
|
concurrent-ruby (>= 1.1.10)
|
|
192
201
|
csv (>= 3.0.9)
|
|
193
202
|
fileutils (>= 1.1.0)
|
|
194
203
|
json (>= 2.1.0)
|
|
195
|
-
language_server-protocol (>= 3.
|
|
204
|
+
language_server-protocol (>= 3.17.0.4, < 4.0)
|
|
196
205
|
listen (~> 3.0)
|
|
197
206
|
logger (>= 1.3.0)
|
|
207
|
+
mutex_m (>= 0.3.0)
|
|
198
208
|
parser (>= 3.1)
|
|
199
209
|
rainbow (>= 2.2.2, < 4.0)
|
|
200
|
-
rbs (~> 3.
|
|
210
|
+
rbs (~> 3.9)
|
|
201
211
|
securerandom (>= 0.1)
|
|
202
212
|
strscan (>= 1.0.0)
|
|
203
|
-
terminal-table (>= 2, <
|
|
213
|
+
terminal-table (>= 2, < 5)
|
|
214
|
+
uri (>= 0.12.0)
|
|
204
215
|
stringio (3.1.1)
|
|
205
|
-
strscan (3.1.
|
|
206
|
-
terminal-table (
|
|
207
|
-
unicode-display_width (>= 1.1.1, <
|
|
216
|
+
strscan (3.1.4)
|
|
217
|
+
terminal-table (4.0.0)
|
|
218
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
208
219
|
thor (1.3.2)
|
|
209
|
-
timeout (0.4.
|
|
220
|
+
timeout (0.4.3)
|
|
221
|
+
tsort (0.2.0)
|
|
210
222
|
tzinfo (2.0.6)
|
|
211
223
|
concurrent-ruby (~> 1.0)
|
|
212
|
-
unicode-display_width (
|
|
213
|
-
|
|
224
|
+
unicode-display_width (3.1.4)
|
|
225
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
226
|
+
unicode-emoji (4.2.0)
|
|
227
|
+
uri (1.0.4)
|
|
228
|
+
useragent (0.16.11)
|
|
214
229
|
websocket-driver (0.7.6)
|
|
215
230
|
websocket-extensions (>= 0.1.0)
|
|
216
231
|
websocket-extensions (0.1.5)
|
|
@@ -221,11 +236,14 @@ PLATFORMS
|
|
|
221
236
|
|
|
222
237
|
DEPENDENCIES
|
|
223
238
|
minitest
|
|
239
|
+
minitest-hooks
|
|
224
240
|
rails (>= 7.0)
|
|
225
241
|
rake (~> 13.0)
|
|
226
242
|
rbs (>= 3)
|
|
243
|
+
rbs-inline
|
|
227
244
|
rbs_rails!
|
|
228
245
|
steep (>= 1.4)
|
|
246
|
+
tsort
|
|
229
247
|
|
|
230
248
|
BUNDLED WITH
|
|
231
249
|
2.4.13
|
data/README.md
CHANGED
|
@@ -32,6 +32,18 @@ Then, the following three tasks are available.
|
|
|
32
32
|
* `rbs_rails:generate_rbs_for_path_helpers`: Generate RBS files for path helpers
|
|
33
33
|
* `rbs_rails:all`: Execute all tasks of RBS Rails
|
|
34
34
|
|
|
35
|
+
You can also run rbs_rails from command line:
|
|
36
|
+
|
|
37
|
+
```console
|
|
38
|
+
# Generate all RBS files
|
|
39
|
+
$ bundle exec rbs_rails all
|
|
40
|
+
|
|
41
|
+
# Generate RBS files for models
|
|
42
|
+
$ bundle exec rbs_rails models
|
|
43
|
+
|
|
44
|
+
# Generate RBS files for path helpers
|
|
45
|
+
$ bundle exec rbs_rails path_helpers
|
|
46
|
+
```
|
|
35
47
|
|
|
36
48
|
### Install RBS for `rails` gem
|
|
37
49
|
|
|
@@ -45,6 +57,36 @@ You need to install `rails` gem's RBS files. I highly recommend using `rbs colle
|
|
|
45
57
|
$ bundle exec rbs collection install
|
|
46
58
|
```
|
|
47
59
|
|
|
60
|
+
### Configuration
|
|
61
|
+
|
|
62
|
+
You can customize the behavior of rbs_rails via configuration file. Place one of the following files in your project:
|
|
63
|
+
|
|
64
|
+
* `.rbs_rails.rb` (in the project root)
|
|
65
|
+
* `config/rbs_rails.rb`
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
RbsRails.configure do |config|
|
|
69
|
+
# Specify the directory where RBS signatures will be generated
|
|
70
|
+
# Default: Rails.root.join("sig/rbs_rails")
|
|
71
|
+
config.signature_root_dir = "sig/rbs_rails"
|
|
72
|
+
|
|
73
|
+
# Enable or disable checking for database migrations.
|
|
74
|
+
# If enabled, rbs_rails stops to generate RBS files if database is not migrated to the latest version.
|
|
75
|
+
# Default: enabled
|
|
76
|
+
check_db_migrations = true
|
|
77
|
+
|
|
78
|
+
# Define which models should be ignored during generation
|
|
79
|
+
config.ignore_model_if do |klass|
|
|
80
|
+
# Example: Ignore test models
|
|
81
|
+
klass.name.start_with?("Test") ||
|
|
82
|
+
# Example: Ignore models in specific namespaces
|
|
83
|
+
klass.name.start_with?("Admin::") ||
|
|
84
|
+
# Example: Ignore models without database tables
|
|
85
|
+
!klass.table_exists?
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
```
|
|
89
|
+
|
|
48
90
|
### Steep integration
|
|
49
91
|
|
|
50
92
|
Put the following code as `Steepfile`.
|
|
@@ -65,7 +107,10 @@ After checking out the repo, run `bin/setup` to install dependencies.
|
|
|
65
107
|
|
|
66
108
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
67
109
|
|
|
68
|
-
|
|
110
|
+
This gem uses [RBS::Inline](https://github.com/soutaro/rbs-inline) to generate RBS files. Please mark up your code with RBS comments.
|
|
111
|
+
And then, run `bundle exec rake rbs_update` to reflect the type definitions to the RBS files.
|
|
112
|
+
|
|
113
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and push it to the GitHub (via Pull Request). Then, GitHub Actions will automatically create a release tag and publish the gem to rubygems.org.
|
|
69
114
|
|
|
70
115
|
## Contributing
|
|
71
116
|
|
data/Rakefile
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
2
|
require 'rake/testtask'
|
|
3
3
|
|
|
4
|
-
task :default => [:rbs_validate, :steep, :test]
|
|
4
|
+
task :default => [:rbs_update, :rbs_validate, :steep, :test]
|
|
5
5
|
|
|
6
6
|
desc 'run Steep'
|
|
7
7
|
task :steep do
|
|
8
8
|
sh 'steep', 'check'
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
task :rbs_update do
|
|
12
|
+
rm_rf('sig/rbs_rails')
|
|
13
|
+
sh 'rbs-inline', '--opt-out', '--output=sig/', 'lib'
|
|
14
|
+
end
|
|
15
|
+
|
|
11
16
|
task :rbs_validate do
|
|
12
17
|
repo = ENV['RBS_REPO_DIR']&.then do |env|
|
|
13
18
|
"--repo=#{env}"
|
|
14
19
|
end
|
|
15
|
-
sh "rbs #{repo} validate
|
|
20
|
+
sh "rbs #{repo} validate"
|
|
16
21
|
end
|
|
17
22
|
|
|
18
23
|
Rake::TestTask.new do |test|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Example configuration file for rbs_rails
|
|
2
|
+
#
|
|
3
|
+
# Place this file in the root of your Rails project or in config/rbs_rails.rb
|
|
4
|
+
|
|
5
|
+
RbsRails.configure do |config|
|
|
6
|
+
# Specify the directory where RBS signatures will be generated
|
|
7
|
+
# Default: Rails.root.join("sig/rbs_rails")
|
|
8
|
+
config.signature_root_dir = "sig/rbs_rails"
|
|
9
|
+
|
|
10
|
+
# Enable or disable checking for database migrations.
|
|
11
|
+
# If enabled, rbs_rails stops to generate RBS files if database is not migrated to the latest version.
|
|
12
|
+
# Default: enabled
|
|
13
|
+
check_db_migrations = true
|
|
14
|
+
|
|
15
|
+
# Define a proc to determine which models should be ignored during generation
|
|
16
|
+
# The proc receives a model class and should return true if the model should be ignored
|
|
17
|
+
config.ignore_model_if do |klass|
|
|
18
|
+
# Example: Ignore test models
|
|
19
|
+
klass.name.start_with?("Test") ||
|
|
20
|
+
# Example: Ignore models in the Admin namespace
|
|
21
|
+
klass.name.start_with?("Admin::") ||
|
|
22
|
+
# Example: Ignore models that are not backed by a database table
|
|
23
|
+
!klass.table_exists? ||
|
|
24
|
+
# Example: Ignore anonymous classes
|
|
25
|
+
klass.name.blank?
|
|
26
|
+
end
|
|
27
|
+
end
|
data/exe/rbs_rails
ADDED
|
@@ -2,24 +2,15 @@ require 'rails'
|
|
|
2
2
|
|
|
3
3
|
module RbsRails
|
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
|
5
|
-
def create_raketask
|
|
5
|
+
def create_raketask #: void
|
|
6
6
|
create_file "lib/tasks/rbs.rake", <<~RUBY
|
|
7
7
|
begin
|
|
8
8
|
require 'rbs_rails/rake_task'
|
|
9
9
|
|
|
10
10
|
RbsRails::RakeTask.new do |task|
|
|
11
|
-
# If you want to avoid generating RBS for some classes, comment in it.
|
|
12
|
-
# default: nil
|
|
13
|
-
#
|
|
14
|
-
# task.ignore_model_if = -> (klass) { klass == MyClass }
|
|
15
|
-
|
|
16
11
|
# If you want to change the rake task namespace, comment in it.
|
|
17
12
|
# default: :rbs_rails
|
|
18
13
|
# task.name = :cool_rbs_rails
|
|
19
|
-
|
|
20
|
-
# If you want to change where RBS Rails writes RBSs into, comment in it.
|
|
21
|
-
# default: Rails.root / 'sig/rbs_rails'
|
|
22
|
-
# task.signature_root_dir = Rails.root / 'my_sig/rbs_rails'
|
|
23
14
|
end
|
|
24
15
|
rescue LoadError
|
|
25
16
|
# failed to load rbs_rails. Skip to load rbs_rails tasks.
|