rbs_rails 0.12.0 → 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 +64 -0
- data/Gemfile +9 -3
- data/Gemfile.lock +202 -129
- data/README.md +47 -1
- data/Rakefile +7 -2
- data/Steepfile +5 -0
- data/example/rbs_rails.rb +27 -0
- data/exe/rbs_rails +6 -0
- data/lib/generators/rbs_rails/install_generator.rb +10 -15
- data/lib/rbs_rails/active_record/enum.rb +81 -0
- data/lib/rbs_rails/active_record.rb +269 -171
- data/lib/rbs_rails/cli/configuration.rb +66 -0
- data/lib/rbs_rails/cli.rb +173 -0
- data/lib/rbs_rails/dependency_builder.rb +29 -8
- data/lib/rbs_rails/path_helpers.rb +14 -2
- data/lib/rbs_rails/rake_task.rb +39 -41
- data/lib/rbs_rails/util/file_writer.rb +22 -0
- data/lib/rbs_rails/util.rb +17 -15
- data/lib/rbs_rails/version.rb +1 -1
- data/lib/rbs_rails.rb +5 -2
- data/rbs_collection.lock.yaml +273 -45
- data/rbs_collection.yaml +1 -18
- data/rbs_rails.gemspec +2 -1
- 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 +68 -46
- data/sig/rbs_rails/cli/configuration.rbs +37 -0
- data/sig/rbs_rails/cli.rbs +35 -0
- data/sig/rbs_rails/dependency_builder.rbs +8 -0
- data/sig/rbs_rails/path_helpers.rbs +13 -6
- data/sig/rbs_rails/rake_task.rbs +8 -7
- 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 +33 -14
- data/sig/_internal/activerecord.rbs +0 -4
- data/sig/_internal/fileutils.rbs +0 -4
- data/sig/_internal/thor.rbs +0 -5
- 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,70 @@
|
|
|
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
|
+
|
|
61
|
+
## 0.12.1
|
|
62
|
+
|
|
63
|
+
* Drop support for old Rubies. [#284](https://github.com/pocke/rbs_rails/pull/284)
|
|
64
|
+
* Make type names absolute to avoid referring to incorrect class. [#265](https://github.com/pocke/rbs_rails/pull/265)
|
|
65
|
+
* Avoid to create directory on initialization. [#261](https://github.com/pocke/rbs_rails/pull/261)
|
|
66
|
+
* Make `build_*` methods parameters optional. [#258](https://github.com/pocke/rbs_rails/pull/258)
|
|
67
|
+
* Skip to define rake tasks when rbs_rails is not able to load. [#251](https://github.com/pocke/rbs_rails/pull/251)
|
|
68
|
+
|
|
5
69
|
## 0.12.0
|
|
6
70
|
|
|
7
71
|
* Support RBS v3. [#246](https://github.com/pocke/rbs_rails/pull/246)
|
data/Gemfile
CHANGED
|
@@ -6,7 +6,13 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
8
|
gem "rake", "~> 13.0"
|
|
9
|
-
gem 'rails', '
|
|
10
|
-
gem 'rbs', '>=
|
|
11
|
-
gem '
|
|
9
|
+
gem 'rails', '>= 7.0'
|
|
10
|
+
gem 'rbs', '>= 3'
|
|
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,176 +1,249 @@
|
|
|
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 (
|
|
12
|
-
actionpack (=
|
|
13
|
-
activesupport (=
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
zeitwerk (~> 2.6)
|
|
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)
|
|
24
|
+
mail (>= 2.8.0)
|
|
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)
|
|
30
|
+
mail (>= 2.8.0)
|
|
31
|
+
rails-dom-testing (~> 2.2)
|
|
32
|
+
actionpack (7.2.2.2)
|
|
33
|
+
actionview (= 7.2.2.2)
|
|
34
|
+
activesupport (= 7.2.2.2)
|
|
35
|
+
nokogiri (>= 1.8.5)
|
|
36
|
+
racc
|
|
37
|
+
rack (>= 2.2.4, < 3.2)
|
|
38
|
+
rack-session (>= 1.0.1)
|
|
34
39
|
rack-test (>= 0.6.3)
|
|
35
|
-
rails-dom-testing (~> 2.
|
|
36
|
-
rails-html-sanitizer (~> 1.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
rails-dom-testing (~> 2.2)
|
|
41
|
+
rails-html-sanitizer (~> 1.6)
|
|
42
|
+
useragent (~> 0.16)
|
|
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)
|
|
48
|
+
globalid (>= 0.6.0)
|
|
42
49
|
nokogiri (>= 1.8.5)
|
|
43
|
-
actionview (
|
|
44
|
-
activesupport (=
|
|
50
|
+
actionview (7.2.2.2)
|
|
51
|
+
activesupport (= 7.2.2.2)
|
|
45
52
|
builder (~> 3.1)
|
|
46
|
-
erubi (~> 1.
|
|
47
|
-
rails-dom-testing (~> 2.
|
|
48
|
-
rails-html-sanitizer (~> 1.
|
|
49
|
-
activejob (
|
|
50
|
-
activesupport (=
|
|
53
|
+
erubi (~> 1.11)
|
|
54
|
+
rails-dom-testing (~> 2.2)
|
|
55
|
+
rails-html-sanitizer (~> 1.6)
|
|
56
|
+
activejob (7.2.2.2)
|
|
57
|
+
activesupport (= 7.2.2.2)
|
|
51
58
|
globalid (>= 0.3.6)
|
|
52
|
-
activemodel (
|
|
53
|
-
activesupport (=
|
|
54
|
-
activerecord (
|
|
55
|
-
activemodel (=
|
|
56
|
-
activesupport (=
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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)
|
|
64
|
+
timeout (>= 0.4.0)
|
|
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)
|
|
62
70
|
marcel (~> 1.0)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
activesupport (7.2.2.2)
|
|
72
|
+
base64
|
|
73
|
+
benchmark (>= 0.3)
|
|
74
|
+
bigdecimal
|
|
75
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
76
|
+
connection_pool (>= 2.2.5)
|
|
77
|
+
drb
|
|
66
78
|
i18n (>= 1.6, < 2)
|
|
79
|
+
logger (>= 1.4.2)
|
|
67
80
|
minitest (>= 5.1)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
ast (2.4.
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
securerandom (>= 0.3)
|
|
82
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
83
|
+
ast (2.4.3)
|
|
84
|
+
base64 (0.3.0)
|
|
85
|
+
benchmark (0.4.1)
|
|
86
|
+
bigdecimal (3.2.2)
|
|
87
|
+
builder (3.3.0)
|
|
88
|
+
concurrent-ruby (1.3.5)
|
|
89
|
+
connection_pool (2.5.3)
|
|
73
90
|
crass (1.0.6)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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)
|
|
96
|
+
fileutils (1.7.3)
|
|
97
|
+
globalid (1.2.1)
|
|
98
|
+
activesupport (>= 6.1)
|
|
99
|
+
i18n (1.14.7)
|
|
79
100
|
concurrent-ruby (~> 1.0)
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
io-console (0.7.2)
|
|
102
|
+
irb (1.14.1)
|
|
103
|
+
rdoc (>= 4.0.0)
|
|
104
|
+
reline (>= 0.4.2)
|
|
105
|
+
json (2.11.3)
|
|
106
|
+
language_server-protocol (3.17.0.4)
|
|
107
|
+
listen (3.9.0)
|
|
82
108
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
83
109
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
84
|
-
|
|
110
|
+
logger (1.7.0)
|
|
111
|
+
loofah (2.24.1)
|
|
85
112
|
crass (~> 1.0.2)
|
|
86
|
-
nokogiri (>= 1.
|
|
87
|
-
mail (2.
|
|
113
|
+
nokogiri (>= 1.12.0)
|
|
114
|
+
mail (2.8.1)
|
|
88
115
|
mini_mime (>= 0.1.1)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
116
|
+
net-imap
|
|
117
|
+
net-pop
|
|
118
|
+
net-smtp
|
|
119
|
+
marcel (1.0.4)
|
|
120
|
+
mini_mime (1.1.5)
|
|
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)
|
|
127
|
+
date
|
|
128
|
+
net-protocol
|
|
129
|
+
net-pop (0.1.2)
|
|
130
|
+
net-protocol
|
|
131
|
+
net-protocol (0.2.2)
|
|
132
|
+
timeout
|
|
133
|
+
net-smtp (0.5.0)
|
|
134
|
+
net-protocol
|
|
135
|
+
nio4r (2.7.4)
|
|
136
|
+
nokogiri (1.18.9)
|
|
137
|
+
mini_portile2 (~> 2.8.2)
|
|
97
138
|
racc (~> 1.4)
|
|
98
|
-
|
|
99
|
-
parser (3.1.1.0)
|
|
139
|
+
parser (3.3.8.0)
|
|
100
140
|
ast (~> 2.4.1)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
141
|
+
racc
|
|
142
|
+
prism (1.2.0)
|
|
143
|
+
psych (5.1.2)
|
|
144
|
+
stringio
|
|
145
|
+
racc (1.8.1)
|
|
146
|
+
rack (3.1.18)
|
|
147
|
+
rack-session (2.1.1)
|
|
148
|
+
base64 (>= 0.1.0)
|
|
149
|
+
rack (>= 3.0.0)
|
|
150
|
+
rack-test (2.2.0)
|
|
151
|
+
rack (>= 1.3)
|
|
152
|
+
rackup (2.2.0)
|
|
153
|
+
rack (>= 3)
|
|
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)
|
|
117
166
|
bundler (>= 1.15.0)
|
|
118
|
-
railties (=
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
167
|
+
railties (= 7.2.2.2)
|
|
168
|
+
rails-dom-testing (2.3.0)
|
|
169
|
+
activesupport (>= 5.0.0)
|
|
170
|
+
minitest
|
|
122
171
|
nokogiri (>= 1.6)
|
|
123
|
-
rails-html-sanitizer (1.
|
|
124
|
-
loofah (~> 2.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
172
|
+
rails-html-sanitizer (1.6.2)
|
|
173
|
+
loofah (~> 2.21)
|
|
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)
|
|
178
|
+
irb (~> 1.13)
|
|
179
|
+
rackup (>= 1.0.0)
|
|
129
180
|
rake (>= 12.2)
|
|
130
|
-
thor (~> 1.0)
|
|
181
|
+
thor (~> 1.0, >= 1.2.2)
|
|
182
|
+
zeitwerk (~> 2.6)
|
|
131
183
|
rainbow (3.1.1)
|
|
132
|
-
rake (13.
|
|
133
|
-
rb-fsevent (0.11.
|
|
134
|
-
rb-inotify (0.
|
|
184
|
+
rake (13.2.1)
|
|
185
|
+
rb-fsevent (0.11.2)
|
|
186
|
+
rb-inotify (0.11.1)
|
|
135
187
|
ffi (~> 1.0)
|
|
136
|
-
rbs (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
188
|
+
rbs (3.9.5)
|
|
189
|
+
logger
|
|
190
|
+
rbs-inline (0.11.0)
|
|
191
|
+
prism (>= 0.29, < 1.3)
|
|
192
|
+
rbs (>= 3.5.0)
|
|
193
|
+
rdoc (6.7.0)
|
|
194
|
+
psych (>= 4.0.0)
|
|
195
|
+
reline (0.5.10)
|
|
196
|
+
io-console (~> 0.5)
|
|
197
|
+
securerandom (0.4.1)
|
|
198
|
+
steep (1.10.0)
|
|
145
199
|
activesupport (>= 5.1)
|
|
146
|
-
|
|
200
|
+
concurrent-ruby (>= 1.1.10)
|
|
201
|
+
csv (>= 3.0.9)
|
|
202
|
+
fileutils (>= 1.1.0)
|
|
203
|
+
json (>= 2.1.0)
|
|
204
|
+
language_server-protocol (>= 3.17.0.4, < 4.0)
|
|
147
205
|
listen (~> 3.0)
|
|
148
|
-
|
|
149
|
-
|
|
206
|
+
logger (>= 1.3.0)
|
|
207
|
+
mutex_m (>= 0.3.0)
|
|
208
|
+
parser (>= 3.1)
|
|
150
209
|
rainbow (>= 2.2.2, < 4.0)
|
|
151
|
-
rbs (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
210
|
+
rbs (~> 3.9)
|
|
211
|
+
securerandom (>= 0.1)
|
|
212
|
+
strscan (>= 1.0.0)
|
|
213
|
+
terminal-table (>= 2, < 5)
|
|
214
|
+
uri (>= 0.12.0)
|
|
215
|
+
stringio (3.1.1)
|
|
216
|
+
strscan (3.1.4)
|
|
217
|
+
terminal-table (4.0.0)
|
|
218
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
219
|
+
thor (1.3.2)
|
|
220
|
+
timeout (0.4.3)
|
|
221
|
+
tsort (0.2.0)
|
|
222
|
+
tzinfo (2.0.6)
|
|
157
223
|
concurrent-ruby (~> 1.0)
|
|
158
|
-
unicode-display_width (
|
|
159
|
-
|
|
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)
|
|
229
|
+
websocket-driver (0.7.6)
|
|
160
230
|
websocket-extensions (>= 0.1.0)
|
|
161
231
|
websocket-extensions (0.1.5)
|
|
162
|
-
zeitwerk (2.
|
|
232
|
+
zeitwerk (2.7.1)
|
|
163
233
|
|
|
164
234
|
PLATFORMS
|
|
165
235
|
ruby
|
|
166
236
|
|
|
167
237
|
DEPENDENCIES
|
|
168
238
|
minitest
|
|
169
|
-
|
|
239
|
+
minitest-hooks
|
|
240
|
+
rails (>= 7.0)
|
|
170
241
|
rake (~> 13.0)
|
|
171
|
-
rbs (>=
|
|
242
|
+
rbs (>= 3)
|
|
243
|
+
rbs-inline
|
|
172
244
|
rbs_rails!
|
|
173
|
-
steep
|
|
245
|
+
steep (>= 1.4)
|
|
246
|
+
tsort
|
|
174
247
|
|
|
175
248
|
BUNDLED WITH
|
|
176
|
-
2.
|
|
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
|
|
|
@@ -41,9 +53,40 @@ You need to install `rails` gem's RBS files. I highly recommend using `rbs colle
|
|
|
41
53
|
1. Then execute the following commands
|
|
42
54
|
```console
|
|
43
55
|
$ bundle install
|
|
56
|
+
$ bundle exec rbs collection init
|
|
44
57
|
$ bundle exec rbs collection install
|
|
45
58
|
```
|
|
46
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
|
+
|
|
47
90
|
### Steep integration
|
|
48
91
|
|
|
49
92
|
Put the following code as `Steepfile`.
|
|
@@ -64,7 +107,10 @@ After checking out the repo, run `bin/setup` to install dependencies.
|
|
|
64
107
|
|
|
65
108
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
66
109
|
|
|
67
|
-
|
|
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.
|
|
68
114
|
|
|
69
115
|
## Contributing
|
|
70
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|
|
data/Steepfile
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
D = Steep::Diagnostic
|
|
1
2
|
target :lib do
|
|
2
3
|
signature "sig"
|
|
3
4
|
signature 'assets/sig'
|
|
4
5
|
|
|
5
6
|
check "lib" # Directory name
|
|
6
7
|
repo_path ENV['RBS_REPO_DIR'] if ENV['RBS_REPO_DIR']
|
|
8
|
+
|
|
9
|
+
configure_code_diagnostics do |hash|
|
|
10
|
+
hash[D::Ruby::UnreachableBranch] = :information
|
|
11
|
+
end
|
|
7
12
|
end
|
|
@@ -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
|