tapioca 0.14.1 → 0.14.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tapioca/commands/abstract_dsl.rb +1 -1
- data/lib/tapioca/dsl/compilers/url_helpers.rb +4 -0
- data/lib/tapioca/dsl/extensions/kredis.rb +14 -13
- data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +11 -0
- data/lib/tapioca/helpers/rbi_files_helper.rb +14 -0
- data/lib/tapioca/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7488dd17c4950978384fa4da4908f6e2f7ad0ad87266a018044e21d565f704aa
|
4
|
+
data.tar.gz: 572b9cb88a228d86c46b36c3bb1b938781dfaf528301c1c0a61e0e3258e5b65a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1565590d51799b64e7bf57a4d4d25bfe5e20d1455345183412773be5eb5c4f3c7bfecca49438aa2ce67283d1260695d2f072303a5951d7daa1540bd3d4f8ef5c
|
7
|
+
data.tar.gz: 00e81fc94389204d15f54e0eb469ca1da367d3b69fedd73e2146f2b0a768d3928848decc94c52fd212e7405d7e8d177571de8e92986090c07ba694c030ae7e66
|
@@ -127,7 +127,7 @@ module Tapioca
|
|
127
127
|
error_handler: ->(error) {
|
128
128
|
say_error(error, :bold, :red)
|
129
129
|
},
|
130
|
-
skipped_constants: constantize(@skip_constant),
|
130
|
+
skipped_constants: constantize(@skip_constant, ignore_missing: true),
|
131
131
|
number_of_workers: @number_of_workers,
|
132
132
|
)
|
133
133
|
end
|
@@ -102,6 +102,10 @@ module Tapioca
|
|
102
102
|
def gather_constants
|
103
103
|
return [] unless defined?(Rails.application) && Rails.application
|
104
104
|
|
105
|
+
# Load routes if they haven't been loaded yet (see https://github.com/rails/rails/pull/51614).
|
106
|
+
routes_reloader = Rails.application.routes_reloader
|
107
|
+
routes_reloader.execute_unless_loaded if routes_reloader&.respond_to?(:execute_unless_loaded)
|
108
|
+
|
105
109
|
Object.const_set(:GeneratedUrlHelpersModule, Rails.application.routes.named_routes.url_helpers_module)
|
106
110
|
Object.const_set(:GeneratedPathHelpersModule, Rails.application.routes.named_routes.path_helpers_module)
|
107
111
|
|
@@ -19,32 +19,32 @@ module Tapioca
|
|
19
19
|
super
|
20
20
|
end
|
21
21
|
|
22
|
-
def kredis_string(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
22
|
+
def kredis_string(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
23
23
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
24
24
|
super
|
25
25
|
end
|
26
26
|
|
27
|
-
def kredis_integer(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
27
|
+
def kredis_integer(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
28
28
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
29
29
|
super
|
30
30
|
end
|
31
31
|
|
32
|
-
def kredis_decimal(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
32
|
+
def kredis_decimal(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
33
33
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
34
34
|
super
|
35
35
|
end
|
36
36
|
|
37
|
-
def kredis_datetime(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
37
|
+
def kredis_datetime(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
38
38
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
39
39
|
super
|
40
40
|
end
|
41
41
|
|
42
|
-
def kredis_flag(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
42
|
+
def kredis_flag(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
43
43
|
collect_kredis_type(name, "Kredis::Types::Flag")
|
44
44
|
super
|
45
45
|
end
|
46
46
|
|
47
|
-
def kredis_float(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
47
|
+
def kredis_float(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
48
48
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
49
49
|
super
|
50
50
|
end
|
@@ -54,22 +54,23 @@ module Tapioca
|
|
54
54
|
super
|
55
55
|
end
|
56
56
|
|
57
|
-
def kredis_json(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
57
|
+
def kredis_json(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
58
58
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
59
59
|
super
|
60
60
|
end
|
61
61
|
|
62
|
-
def kredis_list(name, key: nil, typed: :string, config: :shared, after_change: nil)
|
62
|
+
def kredis_list(name, key: nil, default: nil, typed: :string, config: :shared, after_change: nil)
|
63
63
|
collect_kredis_type(name, "Kredis::Types::List")
|
64
64
|
super
|
65
65
|
end
|
66
66
|
|
67
|
-
def kredis_unique_list(name, limit: nil, key: nil, typed: :string, config: :shared,
|
67
|
+
def kredis_unique_list(name, limit: nil, key: nil, default: nil, typed: :string, config: :shared,
|
68
|
+
after_change: nil)
|
68
69
|
collect_kredis_type(name, "Kredis::Types::UniqueList")
|
69
70
|
super
|
70
71
|
end
|
71
72
|
|
72
|
-
def kredis_set(name, key: nil, typed: :string, config: :shared, after_change: nil)
|
73
|
+
def kredis_set(name, key: nil, default: nil, typed: :string, config: :shared, after_change: nil)
|
73
74
|
collect_kredis_type(name, "Kredis::Types::Set")
|
74
75
|
super
|
75
76
|
end
|
@@ -84,17 +85,17 @@ module Tapioca
|
|
84
85
|
super
|
85
86
|
end
|
86
87
|
|
87
|
-
def kredis_counter(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
88
|
+
def kredis_counter(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
88
89
|
collect_kredis_type(name, "Kredis::Types::Counter")
|
89
90
|
super
|
90
91
|
end
|
91
92
|
|
92
|
-
def kredis_hash(name, key: nil, typed: :string, config: :shared, after_change: nil)
|
93
|
+
def kredis_hash(name, key: nil, default: nil, typed: :string, config: :shared, after_change: nil)
|
93
94
|
collect_kredis_type(name, "Kredis::Types::Hash")
|
94
95
|
super
|
95
96
|
end
|
96
97
|
|
97
|
-
def kredis_boolean(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
|
98
|
+
def kredis_boolean(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
|
98
99
|
collect_kredis_type(name, "Kredis::Types::Scalar")
|
99
100
|
super
|
100
101
|
end
|
@@ -69,6 +69,14 @@ module Tapioca
|
|
69
69
|
"::Money"
|
70
70
|
when ActiveRecord::Type::Integer
|
71
71
|
"::Integer"
|
72
|
+
when ActiveRecord::Encryption::EncryptedAttributeType
|
73
|
+
# Reflect to see if `ActiveModel::Type::Value` is being used first.
|
74
|
+
getter_type = Tapioca::Dsl::Helpers::ActiveModelTypeHelper.type_for(column_type)
|
75
|
+
return getter_type unless getter_type == "T.untyped"
|
76
|
+
|
77
|
+
# Otherwise fallback to String as `ActiveRecord::Encryption::EncryptedAttributeType` inherits from
|
78
|
+
# `ActiveRecord::Type::Text` which inherits from `ActiveModel::Type::String`.
|
79
|
+
"::String"
|
72
80
|
when ActiveRecord::Type::String
|
73
81
|
"::String"
|
74
82
|
when ActiveRecord::Type::Date
|
@@ -93,6 +101,9 @@ module Tapioca
|
|
93
101
|
when defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid) &&
|
94
102
|
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid
|
95
103
|
"::String"
|
104
|
+
when defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Cidr) &&
|
105
|
+
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Cidr
|
106
|
+
"::IPAddr"
|
96
107
|
when defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Hstore) &&
|
97
108
|
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Hstore
|
98
109
|
"T::Hash[::String, ::String]"
|
@@ -174,7 +174,21 @@ module Tapioca
|
|
174
174
|
shims_or_todos = extract_shims_and_todos(nodes, shim_rbi_dir: shim_rbi_dir, todo_rbi_file: todo_rbi_file)
|
175
175
|
return false if shims_or_todos.empty?
|
176
176
|
|
177
|
+
not_shims_or_todos = nodes - shims_or_todos
|
177
178
|
shims_or_todos_empty_scopes = extract_empty_scopes(shims_or_todos)
|
179
|
+
|
180
|
+
# We need to discard classes that are redefining the parent of a class
|
181
|
+
shims_or_todos_empty_scopes.select! do |scope|
|
182
|
+
# Empty modules are always duplicates
|
183
|
+
next true unless scope.is_a?(RBI::Class)
|
184
|
+
|
185
|
+
# Empty classes without parents are also duplicates
|
186
|
+
parent_name = scope.superclass_name
|
187
|
+
next true unless parent_name
|
188
|
+
|
189
|
+
# Empty classes that are not redefining the parent are also duplicates
|
190
|
+
not_shims_or_todos.any? { |node| node.is_a?(RBI::Class) && node.superclass_name == parent_name }
|
191
|
+
end
|
178
192
|
return true unless shims_or_todos_empty_scopes.empty?
|
179
193
|
|
180
194
|
mixins = extract_mixins(shims_or_todos)
|
data/lib/tapioca/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapioca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ufuk Kayserilioglu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-05-
|
14
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|