rbs_rails 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dependabot/config.yml +8 -0
- data/.gitignore +0 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +61 -0
- data/bin/gem_rbs +2 -2
- data/lib/rbs_rails/active_record.rb +15 -2
- data/lib/rbs_rails/version.rb +1 -1
- data/sig/activerecord.rbs +4 -0
- data/sig/rbs_rails/active_record.rbs +2 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d70009e239cba7c79ad16cf1861495051952a6930205678b05fcf5ad97f0809
|
4
|
+
data.tar.gz: 20e8d58362c2222651aa10430417ac90af1b8e38e5b3bbfcfdf43f186f77eff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef998ce7910f4169eb43716ed8ad0132338751b0c9346213cb02ddecae71fe1c0159d8eb2404877cd599dbd352fe42d3d52bd1316f6577fe2568c912ec0f402a
|
7
|
+
data.tar.gz: 846055b9290bfb250e933686a7dcd05bd52ff331cc1a83a3ddae4cd05ff480b2b43b7c164dbbbff164f25c568837b9d30353eb787464f430b08ffbed69737add
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.8.2 (2021-02-20)
|
6
|
+
|
7
|
+
* Add ActiveRecord::AttributeMethods::Dirty methods [#104](https://github.com/pocke/rbs_rails/pull/104)
|
8
|
+
* Define find method based on primary key [#105](https://github.com/pocke/rbs_rails/pull/105)
|
9
|
+
|
5
10
|
## 0.8.1 (2021-01-09)
|
6
11
|
|
7
12
|
* Skip generation RBS fro class that doesn't have table in DB. [#95](https://github.com/pocke/rbs_rails/pull/95)
|
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in rbs_rails.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem "rake", "~>
|
7
|
-
gem 'rbs', '1.0.0'
|
8
|
-
gem 'steep', '>= 0.34.0'
|
6
|
+
gem "rake", "~> 13.0"
|
7
|
+
gem 'rbs', '>= 1.0.0'
|
8
|
+
gem 'steep', '>= 0.34.0'
|
9
9
|
gem 'minitest'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rbs_rails (0.8.2)
|
5
|
+
parser
|
6
|
+
rbs (>= 1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (6.1.2.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 1.6, < 2)
|
14
|
+
minitest (>= 5.1)
|
15
|
+
tzinfo (~> 2.0)
|
16
|
+
zeitwerk (~> 2.3)
|
17
|
+
ast (2.4.2)
|
18
|
+
ast_utils (0.4.0)
|
19
|
+
parser (>= 2.7.0)
|
20
|
+
concurrent-ruby (1.1.8)
|
21
|
+
ffi (1.14.2)
|
22
|
+
i18n (1.8.9)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
language_server-protocol (3.15.0.1)
|
25
|
+
listen (3.4.1)
|
26
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
27
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
28
|
+
minitest (5.14.3)
|
29
|
+
parser (3.0.0.0)
|
30
|
+
ast (~> 2.4.1)
|
31
|
+
rainbow (3.0.0)
|
32
|
+
rake (13.0.3)
|
33
|
+
rb-fsevent (0.10.4)
|
34
|
+
rb-inotify (0.10.1)
|
35
|
+
ffi (~> 1.0)
|
36
|
+
rbs (1.0.6)
|
37
|
+
steep (0.41.0)
|
38
|
+
activesupport (>= 5.1)
|
39
|
+
ast_utils (>= 0.4.0)
|
40
|
+
language_server-protocol (~> 3.15.0.1)
|
41
|
+
listen (~> 3.0)
|
42
|
+
parser (>= 2.7)
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
44
|
+
rbs (~> 1.0.3)
|
45
|
+
tzinfo (2.0.4)
|
46
|
+
concurrent-ruby (~> 1.0)
|
47
|
+
zeitwerk (2.4.2)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
x86_64-linux
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
minitest
|
55
|
+
rake (~> 13.0)
|
56
|
+
rbs (>= 1.0.0)
|
57
|
+
rbs_rails!
|
58
|
+
steep (>= 0.34.0)
|
59
|
+
|
60
|
+
BUNDLED WITH
|
61
|
+
2.2.4
|
data/bin/gem_rbs
CHANGED
@@ -56,7 +56,7 @@ builder = QueryBuilder.new
|
|
56
56
|
gems.each do |gem|
|
57
57
|
path = "main:gems/#{gem}/#{VERSION}"
|
58
58
|
builder.add(<<~GRAPHQL, { 'path' => path })
|
59
|
-
#{gem}:repository(owner: "ruby", name: "
|
59
|
+
#{gem}:repository(owner: "ruby", name: "gem_rbs_collection") {
|
60
60
|
object(expression: $path) {
|
61
61
|
... on Tree {
|
62
62
|
entries {
|
@@ -82,7 +82,7 @@ resp[:data].each do |gem_name, gem_value|
|
|
82
82
|
if fname.end_with?('.rbs')
|
83
83
|
content =
|
84
84
|
if entry.dig(:object, :isTruncated)
|
85
|
-
`curl -H 'Accept: application/vnd.github.v3.raw' -H Authorization: token #{TOKEN} https://api.github.com/repos/ruby/
|
85
|
+
`curl -H 'Accept: application/vnd.github.v3.raw' -H Authorization: token #{TOKEN} https://api.github.com/repos/ruby/gem_rbs_collection/contents/gems/#{gem_name}/#{VERSION}/#{fname}`
|
86
86
|
else
|
87
87
|
entry.dig(:object, :text)
|
88
88
|
end
|
@@ -28,7 +28,7 @@ module RbsRails
|
|
28
28
|
private def klass_decl
|
29
29
|
<<~RBS
|
30
30
|
#{header}
|
31
|
-
extend _ActiveRecord_Relation_ClassMethods[#{klass_name}, #{relation_class_name}]
|
31
|
+
extend _ActiveRecord_Relation_ClassMethods[#{klass_name}, #{relation_class_name}, #{pk_type}]
|
32
32
|
|
33
33
|
#{columns}
|
34
34
|
#{associations}
|
@@ -44,11 +44,18 @@ module RbsRails
|
|
44
44
|
RBS
|
45
45
|
end
|
46
46
|
|
47
|
+
private def pk_type
|
48
|
+
pk = klass.primary_key
|
49
|
+
col = klass.columns.find {|col| col.name == pk }
|
50
|
+
sql_type_to_class(col.type)
|
51
|
+
end
|
52
|
+
|
47
53
|
private def relation_decl
|
48
54
|
<<~RBS
|
49
55
|
class #{relation_class_name} < ActiveRecord::Relation
|
50
|
-
include _ActiveRecord_Relation[#{klass_name}]
|
56
|
+
include _ActiveRecord_Relation[#{klass_name}, #{pk_type}]
|
51
57
|
include Enumerable[#{klass_name}]
|
58
|
+
|
52
59
|
#{enum_scope_methods(singleton: false)}
|
53
60
|
#{scopes(singleton: false)}
|
54
61
|
end
|
@@ -316,6 +323,12 @@ module RbsRails
|
|
316
323
|
def #{col.name}_previously_changed?: () -> bool
|
317
324
|
def #{col.name}_previous_change: () -> Array[#{class_name_opt}]?
|
318
325
|
def #{col.name}_previously_was: () -> #{class_name_opt}
|
326
|
+
def #{col.name}_before_last_save: () -> #{class_name_opt}
|
327
|
+
def #{col.name}_change_to_be_saved: () -> Array[#{class_name_opt}]?
|
328
|
+
def #{col.name}_in_database: () -> #{class_name_opt}
|
329
|
+
def saved_change_to_#{col.name}: () -> Array[#{class_name_opt}]?
|
330
|
+
def saved_change_to_#{col.name}?: () -> bool
|
331
|
+
def will_save_change_to_#{col.name}?: () -> bool
|
319
332
|
def restore_#{col.name}!: () -> void
|
320
333
|
def clear_#{col.name}_change: () -> void
|
321
334
|
EOS
|
data/lib/rbs_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Pocke Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -45,11 +45,13 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".dependabot/config.yml"
|
48
49
|
- ".github/workflows/ci.yml"
|
49
50
|
- ".gitignore"
|
50
51
|
- ".gitmodules"
|
51
52
|
- CHANGELOG.md
|
52
53
|
- Gemfile
|
54
|
+
- Gemfile.lock
|
53
55
|
- LICENSE
|
54
56
|
- README.md
|
55
57
|
- Rakefile
|
@@ -70,6 +72,7 @@ files:
|
|
70
72
|
- lib/rbs_rails/util.rb
|
71
73
|
- lib/rbs_rails/version.rb
|
72
74
|
- rbs_rails.gemspec
|
75
|
+
- sig/activerecord.rbs
|
73
76
|
- sig/fileutils.rbs
|
74
77
|
- sig/parser.rbs
|
75
78
|
- sig/rake.rbs
|
@@ -102,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
105
|
- !ruby/object:Gem::Version
|
103
106
|
version: '0'
|
104
107
|
requirements: []
|
105
|
-
rubygems_version: 3.3
|
108
|
+
rubygems_version: 3.2.3
|
106
109
|
signing_key:
|
107
110
|
specification_version: 4
|
108
111
|
summary: A RBS files generator for Rails application
|