tapioca 0.11.17 → 0.12.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/lib/tapioca/dsl/compilers/aasm.rb +1 -6
- data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -5
- data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -5
- data/lib/tapioca/dsl/compilers/action_text.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_job.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_columns.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -7
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +2 -9
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -7
- data/lib/tapioca/dsl/compilers/active_resource.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_storage.rb +1 -6
- data/lib/tapioca/dsl/compilers/active_support_concern.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +6 -16
- data/lib/tapioca/dsl/compilers/config.rb +1 -5
- data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -5
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +2 -6
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +2 -6
- data/lib/tapioca/dsl/compilers/identity_cache.rb +1 -7
- data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +1 -7
- data/lib/tapioca/dsl/compilers/kredis.rb +1 -5
- data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +1 -5
- data/lib/tapioca/dsl/compilers/protobuf.rb +1 -5
- data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -6
- data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -5
- data/lib/tapioca/dsl/compilers/smart_properties.rb +1 -7
- data/lib/tapioca/dsl/compilers/state_machines.rb +1 -7
- data/lib/tapioca/dsl/compilers/url_helpers.rb +17 -16
- data/lib/tapioca/dsl/extensions/active_record.rb +4 -2
- data/lib/tapioca/dsl/extensions/frozen_record.rb +6 -2
- data/lib/tapioca/dsl/extensions/kredis.rb +6 -2
- data/lib/tapioca/gem/listeners/sorbet_props.rb +2 -1
- data/lib/tapioca/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a3ddc2c5d6e123488c0c4f2d0aad9a5de62a8145f2c3eb2d6b73de6f814afc0
|
4
|
+
data.tar.gz: 908740542e026711e9ee85d46ce3828533f965c302039b645213adc016d74258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0622e47a67918e24c8ec4434892265039b38c0de522b3e2ad1ca156d62b1487317384a7dcc928249c7d5cec62493bee5e36d0cbd2342b97a39011056485d6f30
|
7
|
+
data.tar.gz: 3082afd8096436fee4ecf4cb46b3a4232f77e34fa53bfb60b3182d12a7fcb5b3df58fe8ce67d1c8dcfb9b4a68dd859429bb6f0cf65eb8708991dfb2ff018720b
|
@@ -1,11 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "active_record"
|
6
|
-
rescue LoadError
|
7
|
-
return
|
8
|
-
end
|
4
|
+
return unless defined?(ActiveRecord::Base)
|
9
5
|
|
10
6
|
require "tapioca/dsl/helpers/active_record_column_type_helper"
|
11
7
|
require "tapioca/dsl/helpers/active_record_constants_helper"
|
@@ -1,11 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "active_record"
|
6
|
-
rescue LoadError
|
7
|
-
return
|
8
|
-
end
|
4
|
+
return unless defined?(ActiveRecord::Base)
|
9
5
|
|
10
6
|
require "tapioca/dsl/helpers/active_record_column_type_helper"
|
11
7
|
require "tapioca/dsl/helpers/active_record_constants_helper"
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "active_record"
|
6
|
-
rescue LoadError
|
7
|
-
# means ActiveRecord is not installed,
|
8
|
-
# so let's not even define the compiler.
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(ActiveRecord::Base)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -1,14 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "rails"
|
6
|
-
require "active_record"
|
7
|
-
require "active_record/fixtures"
|
8
|
-
require "active_support/test_case"
|
9
|
-
rescue LoadError
|
10
|
-
return
|
11
|
-
end
|
4
|
+
return unless defined?(Rails) && defined?(ActiveSupport::TestCase) && defined?(ActiveRecord::TestFixtures)
|
12
5
|
|
13
6
|
module Tapioca
|
14
7
|
module Dsl
|
@@ -62,7 +55,7 @@ module Tapioca
|
|
62
55
|
|
63
56
|
sig { override.returns(T::Enumerable[Module]) }
|
64
57
|
def gather_constants
|
65
|
-
return [] unless Rails.application
|
58
|
+
return [] unless defined?(Rails.application) && Rails.application
|
66
59
|
|
67
60
|
[ActiveSupport::TestCase]
|
68
61
|
end
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "activerecord-typedstore"
|
6
|
-
rescue LoadError
|
7
|
-
# means ActiveRecord::TypedStore is not installed,
|
8
|
-
# so let's not even define the compiler.
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(ActiveRecord::Base) && defined?(ActiveRecord::TypedStore)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -1,12 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "active_storage"
|
6
|
-
require "active_storage/reflection"
|
7
|
-
rescue LoadError
|
8
|
-
return
|
9
|
-
end
|
4
|
+
return unless defined?(ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods)
|
10
5
|
|
11
6
|
module Tapioca
|
12
7
|
module Dsl
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "active_support"
|
6
|
-
# The following is needed due to https://github.com/rails/rails/pull/41610
|
7
|
-
require "active_support/core_ext/module/delegation"
|
8
|
-
rescue LoadError
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(ActiveSupport::CurrentAttributes)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -122,17 +116,13 @@ module Tapioca
|
|
122
116
|
|
123
117
|
sig { params(klass: RBI::Scope, method: String, class_method: T::Boolean).void }
|
124
118
|
def generate_method(klass, method, class_method:)
|
125
|
-
if
|
126
|
-
|
127
|
-
klass.create_method(
|
128
|
-
method,
|
129
|
-
class_method: class_method,
|
130
|
-
parameters: [parameter],
|
131
|
-
return_type: "T.untyped",
|
132
|
-
)
|
119
|
+
method_def = if class_method
|
120
|
+
constant.method(method)
|
133
121
|
else
|
134
|
-
|
122
|
+
constant.instance_method(method)
|
135
123
|
end
|
124
|
+
|
125
|
+
create_method_from_def(klass, method_def, class_method: class_method)
|
136
126
|
end
|
137
127
|
end
|
138
128
|
end
|
@@ -1,12 +1,8 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require "graphql"
|
7
|
-
rescue LoadError
|
8
|
-
return
|
9
|
-
end
|
4
|
+
return unless defined?(GraphQL::Schema::InputObject)
|
5
|
+
return unless Gem::Requirement.new(">= 1.13").satisfied_by?(Gem::Version.new(GraphQL::VERSION))
|
10
6
|
|
11
7
|
require "tapioca/dsl/helpers/graphql_type_helper"
|
12
8
|
|
@@ -1,12 +1,8 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require "graphql"
|
7
|
-
rescue LoadError
|
8
|
-
return
|
9
|
-
end
|
4
|
+
return unless defined?(GraphQL::Schema::InputObject)
|
5
|
+
return unless Gem::Requirement.new(">= 1.13").satisfied_by?(Gem::Version.new(GraphQL::VERSION))
|
10
6
|
|
11
7
|
require "tapioca/dsl/helpers/graphql_type_helper"
|
12
8
|
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "identity_cache"
|
6
|
-
rescue LoadError
|
7
|
-
# means IdentityCache is not installed,
|
8
|
-
# so let's not even define the compiler.
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(ActiveRecord::Base) && defined?(IdentityCache::WithoutPrimaryIndex)
|
11
5
|
|
12
6
|
require "tapioca/dsl/helpers/active_record_column_type_helper"
|
13
7
|
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "json_api_client"
|
6
|
-
rescue LoadError
|
7
|
-
# means JsonApiClient is not installed,
|
8
|
-
# so let's not even define the compiler.
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(JsonApiClient::Resource)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "smart_properties"
|
6
|
-
rescue LoadError
|
7
|
-
# means SmartProperties is not installed,
|
8
|
-
# so let's not even define the compiler.
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(SmartProperties)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "state_machines"
|
6
|
-
rescue LoadError
|
7
|
-
# means StateMachines is not installed,
|
8
|
-
# so let's not even define the compiler.
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(StateMachines)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require "rails"
|
6
|
-
require "action_controller"
|
7
|
-
require "action_view"
|
8
|
-
rescue LoadError
|
9
|
-
return
|
10
|
-
end
|
4
|
+
return unless defined?(Rails) && defined?(ActionDispatch::Routing)
|
11
5
|
|
12
6
|
module Tapioca
|
13
7
|
module Dsl
|
@@ -102,19 +96,11 @@ module Tapioca
|
|
102
96
|
end
|
103
97
|
end
|
104
98
|
|
105
|
-
NON_DISCOVERABLE_INCLUDERS = T.let(
|
106
|
-
[
|
107
|
-
ActionDispatch::IntegrationTest,
|
108
|
-
ActionView::Helpers,
|
109
|
-
],
|
110
|
-
T::Array[Module],
|
111
|
-
)
|
112
|
-
|
113
99
|
class << self
|
114
100
|
extend T::Sig
|
115
101
|
sig { override.returns(T::Enumerable[Module]) }
|
116
102
|
def gather_constants
|
117
|
-
return [] unless Rails.application
|
103
|
+
return [] unless defined?(Rails.application) && Rails.application
|
118
104
|
|
119
105
|
Object.const_set(:GeneratedUrlHelpersModule, Rails.application.routes.named_routes.url_helpers_module)
|
120
106
|
Object.const_set(:GeneratedPathHelpersModule, Rails.application.routes.named_routes.path_helpers_module)
|
@@ -131,6 +117,19 @@ module Tapioca
|
|
131
117
|
constants.concat(NON_DISCOVERABLE_INCLUDERS)
|
132
118
|
end
|
133
119
|
|
120
|
+
sig { returns(T::Array[Module]) }
|
121
|
+
def gather_non_discoverable_includers
|
122
|
+
[].tap do |includers|
|
123
|
+
if defined?(ActionController::TemplateAssertions) && defined?(ActionDispatch::IntegrationTest)
|
124
|
+
includers << ActionDispatch::IntegrationTest
|
125
|
+
end
|
126
|
+
|
127
|
+
if defined?(ActionView::Helpers)
|
128
|
+
includers << ActionView::Helpers
|
129
|
+
end
|
130
|
+
end.freeze
|
131
|
+
end
|
132
|
+
|
134
133
|
sig { params(mod: Module, helper: Module).returns(T::Boolean) }
|
135
134
|
private def includes_helper?(mod, helper)
|
136
135
|
superclass_ancestors = []
|
@@ -145,6 +144,8 @@ module Tapioca
|
|
145
144
|
end
|
146
145
|
end
|
147
146
|
|
147
|
+
NON_DISCOVERABLE_INCLUDERS = T.let(gather_non_discoverable_includers, T::Array[Module])
|
148
|
+
|
148
149
|
private
|
149
150
|
|
150
151
|
sig { params(root: RBI::Tree, constant: Module).void }
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
begin
|
5
|
-
require "
|
5
|
+
require "active_support"
|
6
6
|
rescue LoadError
|
7
7
|
return
|
8
8
|
end
|
@@ -39,7 +39,9 @@ module Tapioca
|
|
39
39
|
super
|
40
40
|
end
|
41
41
|
|
42
|
-
::
|
42
|
+
::ActiveSupport.on_load(:active_record) do
|
43
|
+
::ActiveRecord::Base.singleton_class.prepend(::Tapioca::Dsl::Compilers::Extensions::ActiveRecord)
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
begin
|
5
|
-
require "
|
5
|
+
require "active_support"
|
6
6
|
rescue LoadError
|
7
7
|
return
|
8
8
|
end
|
@@ -21,7 +21,11 @@ module Tapioca
|
|
21
21
|
super
|
22
22
|
end
|
23
23
|
|
24
|
-
::
|
24
|
+
::ActiveSupport.on_load(:before_configuration) do
|
25
|
+
next unless defined?(::FrozenRecord::Base)
|
26
|
+
|
27
|
+
::FrozenRecord::Base.singleton_class.prepend(::Tapioca::Dsl::Compilers::Extensions::FrozenRecord)
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
begin
|
5
|
-
require "
|
5
|
+
require "active_support"
|
6
6
|
rescue LoadError
|
7
7
|
return
|
8
8
|
end
|
@@ -106,7 +106,11 @@ module Tapioca
|
|
106
106
|
@__tapioca_kredis_types[method.to_s] = { type: type, values: values }
|
107
107
|
end
|
108
108
|
|
109
|
-
::
|
109
|
+
::ActiveSupport.on_load(:before_configuration) do
|
110
|
+
next unless defined?(::Kredis::Attributes::ClassMethods)
|
111
|
+
|
112
|
+
::Kredis::Attributes::ClassMethods.prepend(::Tapioca::Dsl::Compilers::Extensions::Kredis)
|
113
|
+
end
|
110
114
|
end
|
111
115
|
end
|
112
116
|
end
|
@@ -6,6 +6,7 @@ module Tapioca
|
|
6
6
|
module Listeners
|
7
7
|
class SorbetProps < Base
|
8
8
|
extend T::Sig
|
9
|
+
include RBIHelper
|
9
10
|
|
10
11
|
private
|
11
12
|
|
@@ -17,7 +18,7 @@ module Tapioca
|
|
17
18
|
return unless T::Props::ClassMethods === constant
|
18
19
|
|
19
20
|
constant.props.map do |name, prop|
|
20
|
-
type = prop.fetch(:type_object, "T.untyped").to_s
|
21
|
+
type = sanitize_signature_types(prop.fetch(:type_object, "T.untyped").to_s)
|
21
22
|
|
22
23
|
default = prop.key?(:default) || prop.key?(:factory) ? "T.unsafe(nil)" : nil
|
23
24
|
node << if prop.fetch(:immutable, false)
|
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.
|
4
|
+
version: 0.12.0
|
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-01-
|
14
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
requirements: []
|
296
|
-
rubygems_version: 3.5.
|
296
|
+
rubygems_version: 3.5.5
|
297
297
|
signing_key:
|
298
298
|
specification_version: 4
|
299
299
|
summary: A Ruby Interface file generator for gems, core types and the Ruby standard
|