tapioca 0.17.9 → 0.18.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/README.md +3 -2
- data/lib/tapioca/bundler_ext/auto_require_hook.rb +0 -3
- data/lib/tapioca/cli.rb +0 -2
- data/lib/tapioca/commands/abstract_dsl.rb +21 -2
- data/lib/tapioca/commands/abstract_gem.rb +20 -1
- data/lib/tapioca/commands/annotations.rb +7 -3
- data/lib/tapioca/commands/check_shims.rb +9 -2
- data/lib/tapioca/commands/command.rb +0 -1
- data/lib/tapioca/dsl/compiler.rb +17 -16
- data/lib/tapioca/dsl/compilers/aasm.rb +2 -6
- data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +2 -6
- 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 -3
- data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -6
- data/lib/tapioca/dsl/compilers/active_record_columns.rb +8 -5
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +45 -87
- data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_resource.rb +1 -5
- data/lib/tapioca/dsl/compilers/active_storage.rb +2 -6
- data/lib/tapioca/dsl/compilers/active_support_concern.rb +6 -10
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +4 -19
- data/lib/tapioca/dsl/compilers/active_support_environment_inquirer.rb +60 -0
- data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +1 -5
- data/lib/tapioca/dsl/compilers/config.rb +2 -6
- data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -5
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -5
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -5
- data/lib/tapioca/dsl/compilers/identity_cache.rb +2 -6
- data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +4 -18
- data/lib/tapioca/dsl/compilers/kredis.rb +1 -5
- data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +2 -6
- data/lib/tapioca/dsl/compilers/protobuf.rb +2 -6
- data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -5
- data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -5
- data/lib/tapioca/dsl/compilers/smart_properties.rb +1 -5
- data/lib/tapioca/dsl/compilers/state_machines.rb +2 -6
- data/lib/tapioca/dsl/compilers/url_helpers.rb +7 -10
- data/lib/tapioca/dsl/helpers/active_model_type_helper.rb +0 -2
- data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +3 -6
- data/lib/tapioca/dsl/helpers/active_record_constants_helper.rb +0 -2
- data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +18 -5
- data/lib/tapioca/dsl/pipeline.rb +25 -13
- data/lib/tapioca/executor.rb +0 -2
- data/lib/tapioca/gem/events.rb +15 -23
- data/lib/tapioca/gem/listeners/base.rb +0 -1
- data/lib/tapioca/gem/listeners/dynamic_mixins.rb +0 -2
- data/lib/tapioca/gem/listeners/foreign_constants.rb +0 -2
- data/lib/tapioca/gem/listeners/methods.rb +19 -9
- data/lib/tapioca/gem/listeners/mixins.rb +3 -5
- data/lib/tapioca/gem/listeners/remove_empty_payload_scopes.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_enums.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_helpers.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_props.rb +0 -1
- data/lib/tapioca/gem/listeners/sorbet_required_ancestors.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_signatures.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_type_variables.rb +1 -3
- data/lib/tapioca/gem/listeners/source_location.rb +6 -7
- data/lib/tapioca/gem/listeners/subconstants.rb +0 -2
- data/lib/tapioca/gem/listeners/yard_doc.rb +0 -2
- data/lib/tapioca/gem/pipeline.rb +25 -21
- data/lib/tapioca/gemfile.rb +1 -3
- data/lib/tapioca/helpers/cli_helper.rb +0 -1
- data/lib/tapioca/helpers/config_helper.rb +5 -2
- data/lib/tapioca/helpers/env_helper.rb +0 -1
- data/lib/tapioca/helpers/gem_helper.rb +0 -2
- data/lib/tapioca/helpers/git_attributes.rb +0 -2
- data/lib/tapioca/helpers/package_url.rb +416 -0
- data/lib/tapioca/helpers/rbi_files_helper.rb +8 -2
- data/lib/tapioca/helpers/rbi_helper.rb +0 -3
- data/lib/tapioca/helpers/sorbet_helper.rb +0 -2
- data/lib/tapioca/helpers/test/content.rb +0 -1
- data/lib/tapioca/helpers/test/dsl_compiler.rb +0 -3
- data/lib/tapioca/helpers/test/isolation.rb +0 -6
- data/lib/tapioca/helpers/test/template.rb +1 -9
- data/lib/tapioca/internal.rb +1 -1
- data/lib/tapioca/loaders/dsl.rb +0 -4
- data/lib/tapioca/loaders/gem.rb +14 -6
- data/lib/tapioca/loaders/loader.rb +0 -1
- data/lib/tapioca/rbi_ext/model.rb +9 -4
- data/lib/tapioca/rbi_formatter.rb +0 -2
- data/lib/tapioca/repo_index.rb +1 -4
- data/lib/tapioca/runtime/dynamic_mixin_compiler.rb +6 -9
- data/lib/tapioca/runtime/generic_type_registry.rb +8 -12
- data/lib/tapioca/runtime/reflection.rb +25 -31
- data/lib/tapioca/runtime/trackers/autoload.rb +0 -3
- data/lib/tapioca/runtime/trackers/constant_definition.rb +30 -8
- data/lib/tapioca/runtime/trackers/method_definition.rb +4 -5
- data/lib/tapioca/runtime/trackers/mixin.rb +5 -8
- data/lib/tapioca/runtime/trackers/required_ancestor.rb +2 -4
- data/lib/tapioca/runtime/trackers/tracker.rb +1 -4
- data/lib/tapioca/runtime/trackers.rb +0 -4
- data/lib/tapioca/sorbet_ext/generic_name_patch.rb +1 -3
- data/lib/tapioca/static/requires_compiler.rb +1 -3
- data/lib/tapioca/static/symbol_loader.rb +0 -1
- data/lib/tapioca/static/symbol_table_parser.rb +0 -4
- data/lib/tapioca/version.rb +1 -1
- data/lib/tapioca.rb +0 -2
- metadata +18 -5
- data/lib/tapioca/helpers/source_uri.rb +0 -84
- data/lib/tapioca/runtime/attached_class_of_32.rb +0 -20
- data/lib/tapioca/runtime/attached_class_of_legacy.rb +0 -24
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 659ca0696f2d5827518829428768bcd7b679532b7f554b893d16915c6d2389df
|
|
4
|
+
data.tar.gz: 2500137b33f2a4c4491200c579f6fc762c8a183257f741bfbd86148c7561db4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54af5a5d84ce82b7ed58ff41d0656f1979f180edbc90bd08750e6767e1cfb400a92522bb8f9ba23739c1f00739db0049a019f1635516e1fbe4789dfb4a10bf4d
|
|
7
|
+
data.tar.gz: 5e3e2784bdd12d0bc9f79d7aefc21ad07b71d4b50962c4f4e391ec9be9958f6accf1e82a1e076c88f243209487066ee23d13377a864bf7bc7d6cd8b10db8e79a
|
data/README.md
CHANGED
|
@@ -87,6 +87,7 @@ Commands:
|
|
|
87
87
|
tapioca init # Get project ready for type checking
|
|
88
88
|
tapioca require # Generate the list of files to be required by tapioca
|
|
89
89
|
tapioca todo # Generate the list of unresolved constants
|
|
90
|
+
tapioca tree # Print a tree of all available commands
|
|
90
91
|
|
|
91
92
|
Options:
|
|
92
93
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
|
@@ -673,7 +674,7 @@ module Tapioca
|
|
|
673
674
|
|
|
674
675
|
ConstantType = type_member {{ fixed: T.class_of(Encryptable) }}
|
|
675
676
|
|
|
676
|
-
sig { override.returns(T::Enumerable[Module]) }
|
|
677
|
+
sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
|
|
677
678
|
def self.gather_constants
|
|
678
679
|
# Collect all the classes that include Encryptable
|
|
679
680
|
all_classes.select { |c| c < ::Encryptable }
|
|
@@ -806,7 +807,7 @@ module Tapioca
|
|
|
806
807
|
|
|
807
808
|
ConstantType = type_member {{ fixed: T.class_of(Encryptable) }}
|
|
808
809
|
|
|
809
|
-
sig { override.returns(T::Enumerable[Module]) }
|
|
810
|
+
sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
|
|
810
811
|
def self.gather_constants
|
|
811
812
|
# Collect all the classes that include Encryptable
|
|
812
813
|
all_classes.select { |c| c < ::Encryptable }
|
|
@@ -8,13 +8,10 @@ module Tapioca
|
|
|
8
8
|
# `Bundler.require`.
|
|
9
9
|
# @requires_ancestor: ::Bundler::Dependency
|
|
10
10
|
module AutoRequireHook
|
|
11
|
-
extend T::Sig
|
|
12
11
|
@exclude = [] #: Array[String]
|
|
13
12
|
@enabled = false #: bool
|
|
14
13
|
|
|
15
14
|
class << self
|
|
16
|
-
extend T::Sig
|
|
17
|
-
|
|
18
15
|
#: (untyped name) -> bool
|
|
19
16
|
def excluded?(name)
|
|
20
17
|
@exclude.include?(name)
|
data/lib/tapioca/cli.rb
CHANGED
|
@@ -8,7 +8,26 @@ module Tapioca
|
|
|
8
8
|
include SorbetHelper
|
|
9
9
|
include RBIFilesHelper
|
|
10
10
|
|
|
11
|
-
#: (
|
|
11
|
+
#: (
|
|
12
|
+
#| requested_constants: Array[String],
|
|
13
|
+
#| requested_paths: Array[Pathname],
|
|
14
|
+
#| outpath: Pathname,
|
|
15
|
+
#| only: Array[String],
|
|
16
|
+
#| exclude: Array[String],
|
|
17
|
+
#| file_header: bool,
|
|
18
|
+
#| tapioca_path: String,
|
|
19
|
+
#| ?skip_constant: Array[String],
|
|
20
|
+
#| ?quiet: bool,
|
|
21
|
+
#| ?verbose: bool,
|
|
22
|
+
#| ?number_of_workers: Integer?,
|
|
23
|
+
#| ?auto_strictness: bool,
|
|
24
|
+
#| ?gem_dir: String,
|
|
25
|
+
#| ?rbi_formatter: RBIFormatter,
|
|
26
|
+
#| ?app_root: String,
|
|
27
|
+
#| ?halt_upon_load_error: bool,
|
|
28
|
+
#| ?compiler_options: Hash[String, untyped],
|
|
29
|
+
#| ?lsp_addon: bool
|
|
30
|
+
#| ) -> void
|
|
12
31
|
def initialize(
|
|
13
32
|
requested_constants:,
|
|
14
33
|
requested_paths:,
|
|
@@ -143,7 +162,7 @@ module Tapioca
|
|
|
143
162
|
filenames.to_set
|
|
144
163
|
end
|
|
145
164
|
|
|
146
|
-
#: (Array[String] constant_names, ?ignore_missing: bool) -> Array[Module]
|
|
165
|
+
#: (Array[String] constant_names, ?ignore_missing: bool) -> Array[T::Module[top]]
|
|
147
166
|
def constantize(constant_names, ignore_missing: false)
|
|
148
167
|
constant_map = constant_names.to_h do |name|
|
|
149
168
|
[name, Object.const_get(name)]
|
|
@@ -8,7 +8,26 @@ module Tapioca
|
|
|
8
8
|
include SorbetHelper
|
|
9
9
|
include RBIFilesHelper
|
|
10
10
|
|
|
11
|
-
#: (
|
|
11
|
+
#: (
|
|
12
|
+
#| gem_names: Array[String],
|
|
13
|
+
#| exclude: Array[String],
|
|
14
|
+
#| include_dependencies: bool,
|
|
15
|
+
#| prerequire: String?,
|
|
16
|
+
#| postrequire: String,
|
|
17
|
+
#| typed_overrides: Hash[String, String],
|
|
18
|
+
#| outpath: Pathname,
|
|
19
|
+
#| file_header: bool,
|
|
20
|
+
#| include_doc: bool,
|
|
21
|
+
#| include_loc: bool,
|
|
22
|
+
#| include_exported_rbis: bool,
|
|
23
|
+
#| ?number_of_workers: Integer?,
|
|
24
|
+
#| ?auto_strictness: bool,
|
|
25
|
+
#| ?dsl_dir: String,
|
|
26
|
+
#| ?rbi_formatter: RBIFormatter,
|
|
27
|
+
#| ?halt_upon_load_error: bool,
|
|
28
|
+
#| ?lsp_addon: bool?,
|
|
29
|
+
#| ?verbose: bool?
|
|
30
|
+
#| ) -> void
|
|
12
31
|
def initialize(
|
|
13
32
|
gem_names:,
|
|
14
33
|
exclude:,
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
module Tapioca
|
|
5
5
|
module Commands
|
|
6
6
|
class Annotations < CommandWithoutTracker
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
#: (
|
|
8
|
+
#| central_repo_root_uris: Array[String],
|
|
9
|
+
#| ?auth: String?,
|
|
10
|
+
#| ?netrc_file: String?,
|
|
11
|
+
#| ?central_repo_index_path: String,
|
|
12
|
+
#| ?typed_overrides: Hash[String, String]
|
|
13
|
+
#| ) -> void
|
|
10
14
|
def initialize(
|
|
11
15
|
central_repo_root_uris:,
|
|
12
16
|
auth: nil,
|
|
@@ -4,11 +4,18 @@
|
|
|
4
4
|
module Tapioca
|
|
5
5
|
module Commands
|
|
6
6
|
class CheckShims < CommandWithoutTracker
|
|
7
|
-
extend T::Sig
|
|
8
7
|
include SorbetHelper
|
|
9
8
|
include RBIFilesHelper
|
|
10
9
|
|
|
11
|
-
#: (
|
|
10
|
+
#: (
|
|
11
|
+
#| gem_rbi_dir: String,
|
|
12
|
+
#| dsl_rbi_dir: String,
|
|
13
|
+
#| annotations_rbi_dir: String,
|
|
14
|
+
#| shim_rbi_dir: String,
|
|
15
|
+
#| todo_rbi_file: String,
|
|
16
|
+
#| payload: bool,
|
|
17
|
+
#| number_of_workers: Integer?
|
|
18
|
+
#| ) -> void
|
|
12
19
|
def initialize(
|
|
13
20
|
gem_rbi_dir:,
|
|
14
21
|
dsl_rbi_dir:,
|
data/lib/tapioca/dsl/compiler.rb
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
module Tapioca
|
|
5
5
|
module Dsl
|
|
6
6
|
# @abstract
|
|
7
|
-
#: [ConstantType < Module]
|
|
7
|
+
#: [ConstantType < T::Module[top]]
|
|
8
8
|
class Compiler
|
|
9
|
-
extend T::Sig
|
|
10
|
-
|
|
11
9
|
include RBIHelper
|
|
12
10
|
include Runtime::Reflection
|
|
13
11
|
extend Runtime::Reflection
|
|
@@ -21,26 +19,24 @@ module Tapioca
|
|
|
21
19
|
#: Hash[String, untyped]
|
|
22
20
|
attr_reader :options
|
|
23
21
|
|
|
24
|
-
@@requested_constants = [] #: Array[Module] # rubocop:disable Style/ClassVars
|
|
22
|
+
@@requested_constants = [] #: Array[T::Module[top]] # rubocop:disable Style/ClassVars
|
|
25
23
|
|
|
26
24
|
class << self
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#: (Module constant) -> bool
|
|
25
|
+
#: (T::Module[top] constant) -> bool
|
|
30
26
|
def handles?(constant)
|
|
31
27
|
processable_constants.include?(constant)
|
|
32
28
|
end
|
|
33
29
|
|
|
34
30
|
# @abstract
|
|
35
|
-
#: -> T::
|
|
31
|
+
#: -> Enumerable[T::Module[top]]
|
|
36
32
|
def gather_constants = raise NotImplementedError, "Abstract method called"
|
|
37
33
|
|
|
38
|
-
#: -> Set[Module]
|
|
34
|
+
#: -> Set[T::Module[top]]
|
|
39
35
|
def processable_constants
|
|
40
|
-
@processable_constants ||= T::Set[Module].new.compare_by_identity.merge(gather_constants) #: Set[Module]?
|
|
36
|
+
@processable_constants ||= T::Set[T::Module[T.anything]].new.compare_by_identity.merge(gather_constants) #: Set[T::Module[top]]?
|
|
41
37
|
end
|
|
42
38
|
|
|
43
|
-
#: (Array[Module] constants) -> void
|
|
39
|
+
#: (Array[T::Module[top]] constants) -> void
|
|
44
40
|
def requested_constants=(constants)
|
|
45
41
|
@@requested_constants = constants # rubocop:disable Style/ClassVars
|
|
46
42
|
end
|
|
@@ -68,22 +64,27 @@ module Tapioca
|
|
|
68
64
|
end
|
|
69
65
|
end
|
|
70
66
|
|
|
71
|
-
#: ->
|
|
67
|
+
#: -> Enumerable[Class[top]]
|
|
72
68
|
def all_classes
|
|
73
|
-
@all_classes ||= all_modules.grep(Class).freeze #:
|
|
69
|
+
@all_classes ||= all_modules.grep(Class).freeze #: Enumerable[Class[top]]?
|
|
74
70
|
end
|
|
75
71
|
|
|
76
|
-
#: -> T::
|
|
72
|
+
#: -> Enumerable[T::Module[top]]
|
|
77
73
|
def all_modules
|
|
78
74
|
@all_modules ||= if @@requested_constants.any?
|
|
79
75
|
@@requested_constants.grep(Module)
|
|
80
76
|
else
|
|
81
77
|
ObjectSpace.each_object(Module).to_a
|
|
82
|
-
end.freeze #: T::
|
|
78
|
+
end.freeze #: Enumerable[T::Module[top]]?
|
|
83
79
|
end
|
|
84
80
|
end
|
|
85
81
|
|
|
86
|
-
#: (
|
|
82
|
+
#: (
|
|
83
|
+
#| Tapioca::Dsl::Pipeline pipeline,
|
|
84
|
+
#| RBI::Tree root,
|
|
85
|
+
#| ConstantType constant,
|
|
86
|
+
#| ?Hash[String, untyped] options
|
|
87
|
+
#| ) -> void
|
|
87
88
|
def initialize(pipeline, root, constant, options = {})
|
|
88
89
|
@pipeline = pipeline
|
|
89
90
|
@root = root
|
|
@@ -34,8 +34,6 @@ module Tapioca
|
|
|
34
34
|
#
|
|
35
35
|
#: [ConstantType = (Class[::AASM] & ::AASM::ClassMethods)]
|
|
36
36
|
class AASM < Compiler
|
|
37
|
-
extend T::Sig
|
|
38
|
-
|
|
39
37
|
# Taken directly from the AASM::Core::Event class, here:
|
|
40
38
|
# https://github.com/aasm/aasm/blob/0e03746/lib/aasm/core/event.rb#L21-L29
|
|
41
39
|
EVENT_CALLBACKS = [
|
|
@@ -200,12 +198,10 @@ module Tapioca
|
|
|
200
198
|
end
|
|
201
199
|
|
|
202
200
|
class << self
|
|
203
|
-
extend T::Sig
|
|
204
|
-
|
|
205
201
|
# @override
|
|
206
|
-
#: -> T::
|
|
202
|
+
#: -> Enumerable[T::Module[top]]
|
|
207
203
|
def gather_constants
|
|
208
|
-
T.cast(ObjectSpace.each_object(::AASM::ClassMethods), T::Enumerable[Module])
|
|
204
|
+
T.cast(ObjectSpace.each_object(::AASM::ClassMethods), T::Enumerable[T::Module[T.anything]])
|
|
209
205
|
end
|
|
210
206
|
end
|
|
211
207
|
end
|
|
@@ -63,8 +63,6 @@ module Tapioca
|
|
|
63
63
|
# ~~~
|
|
64
64
|
#: [ConstantType = singleton(::ActionController::Base)]
|
|
65
65
|
class ActionControllerHelpers < Compiler
|
|
66
|
-
extend T::Sig
|
|
67
|
-
|
|
68
66
|
# @override
|
|
69
67
|
#: -> void
|
|
70
68
|
def decorate
|
|
@@ -118,10 +116,8 @@ module Tapioca
|
|
|
118
116
|
end
|
|
119
117
|
|
|
120
118
|
class << self
|
|
121
|
-
extend T::Sig
|
|
122
|
-
|
|
123
119
|
# @override
|
|
124
|
-
#: -> T::
|
|
120
|
+
#: -> Enumerable[T::Module[top]]
|
|
125
121
|
def gather_constants
|
|
126
122
|
descendants_of(::ActionController::Base).select(&:name).select do |klass|
|
|
127
123
|
klass.const_defined?(:HelperMethods, false)
|
|
@@ -152,7 +148,7 @@ module Tapioca
|
|
|
152
148
|
)
|
|
153
149
|
end
|
|
154
150
|
|
|
155
|
-
#: (Module mod) -> Array[String]
|
|
151
|
+
#: (T::Module[top] mod) -> Array[String]
|
|
156
152
|
def gather_includes(mod)
|
|
157
153
|
mod.ancestors
|
|
158
154
|
.reject { |ancestor| ancestor.is_a?(Class) || ancestor == mod || name_of(ancestor).nil? }
|
|
@@ -31,8 +31,6 @@ module Tapioca
|
|
|
31
31
|
# ~~~
|
|
32
32
|
#: [ConstantType = singleton(::ActionMailer::Base)]
|
|
33
33
|
class ActionMailer < Compiler
|
|
34
|
-
extend T::Sig
|
|
35
|
-
|
|
36
34
|
# @override
|
|
37
35
|
#: -> void
|
|
38
36
|
def decorate
|
|
@@ -51,10 +49,8 @@ module Tapioca
|
|
|
51
49
|
end
|
|
52
50
|
|
|
53
51
|
class << self
|
|
54
|
-
extend T::Sig
|
|
55
|
-
|
|
56
52
|
# @override
|
|
57
|
-
#: -> T::
|
|
53
|
+
#: -> Enumerable[T::Module[top]]
|
|
58
54
|
def gather_constants
|
|
59
55
|
descendants_of(::ActionMailer::Base).reject(&:abstract?)
|
|
60
56
|
end
|
|
@@ -45,8 +45,6 @@ module Tapioca
|
|
|
45
45
|
# ~~~
|
|
46
46
|
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
|
47
47
|
class ActionText < Compiler
|
|
48
|
-
extend T::Sig
|
|
49
|
-
|
|
50
48
|
# @override
|
|
51
49
|
#: -> void
|
|
52
50
|
def decorate
|
|
@@ -73,8 +71,6 @@ module Tapioca
|
|
|
73
71
|
end
|
|
74
72
|
|
|
75
73
|
class << self
|
|
76
|
-
extend T::Sig
|
|
77
|
-
|
|
78
74
|
#: (singleton(::ActiveRecord::Base) constant) -> Array[String]
|
|
79
75
|
def action_text_associations(constant)
|
|
80
76
|
# Implementation copied from https://github.com/rails/rails/blob/31052d0e518b9da103eea2f79d250242ed1e3705/actiontext/lib/action_text/attribute.rb#L66
|
|
@@ -84,7 +80,7 @@ module Tapioca
|
|
|
84
80
|
end
|
|
85
81
|
|
|
86
82
|
# @override
|
|
87
|
-
#: -> T::
|
|
83
|
+
#: -> Enumerable[T::Module[top]]
|
|
88
84
|
def gather_constants
|
|
89
85
|
descendants_of(::ActiveRecord::Base)
|
|
90
86
|
.reject(&:abstract_class?)
|
|
@@ -40,8 +40,6 @@ module Tapioca
|
|
|
40
40
|
# ~~~
|
|
41
41
|
#: [ConstantType = singleton(::ActiveJob::Base)]
|
|
42
42
|
class ActiveJob < Compiler
|
|
43
|
-
extend T::Sig
|
|
44
|
-
|
|
45
43
|
# @override
|
|
46
44
|
#: -> void
|
|
47
45
|
def decorate
|
|
@@ -85,10 +83,8 @@ module Tapioca
|
|
|
85
83
|
end
|
|
86
84
|
|
|
87
85
|
class << self
|
|
88
|
-
extend T::Sig
|
|
89
|
-
|
|
90
86
|
# @override
|
|
91
|
-
#: -> T::
|
|
87
|
+
#: -> Enumerable[T::Module[top]]
|
|
92
88
|
def gather_constants
|
|
93
89
|
descendants_of(::ActiveJob::Base)
|
|
94
90
|
end
|
|
@@ -40,8 +40,6 @@ module Tapioca
|
|
|
40
40
|
# ~~~
|
|
41
41
|
#: [ConstantType = (Class[::ActiveModel::Attributes] & ::ActiveModel::Attributes::ClassMethods)]
|
|
42
42
|
class ActiveModelAttributes < Compiler
|
|
43
|
-
extend T::Sig
|
|
44
|
-
|
|
45
43
|
# @override
|
|
46
44
|
#: -> void
|
|
47
45
|
def decorate
|
|
@@ -60,10 +58,8 @@ module Tapioca
|
|
|
60
58
|
end
|
|
61
59
|
|
|
62
60
|
class << self
|
|
63
|
-
extend T::Sig
|
|
64
|
-
|
|
65
61
|
# @override
|
|
66
|
-
#: -> T::
|
|
62
|
+
#: -> Enumerable[T::Module[top]]
|
|
67
63
|
def gather_constants
|
|
68
64
|
all_classes.grep(::ActiveModel::Attributes::ClassMethods)
|
|
69
65
|
end
|
|
@@ -55,8 +55,6 @@ module Tapioca
|
|
|
55
55
|
# ~~~
|
|
56
56
|
#: [ConstantType = (Class[::ActiveModel::SecurePassword] & ::ActiveModel::SecurePassword::ClassMethods)]
|
|
57
57
|
class ActiveModelSecurePassword < Compiler
|
|
58
|
-
extend T::Sig
|
|
59
|
-
|
|
60
58
|
# @override
|
|
61
59
|
#: -> void
|
|
62
60
|
def decorate
|
|
@@ -90,10 +88,8 @@ module Tapioca
|
|
|
90
88
|
end
|
|
91
89
|
|
|
92
90
|
class << self
|
|
93
|
-
extend T::Sig
|
|
94
|
-
|
|
95
91
|
# @override
|
|
96
|
-
#: -> T::
|
|
92
|
+
#: -> Enumerable[T::Module[top]]
|
|
97
93
|
def gather_constants
|
|
98
94
|
# In some versions of Rails 8.1, `ActiveModel::SecurePassword` uses `Numeric#minutes`
|
|
99
95
|
# which isn't explicitly required in the gem, and it might not be loaded already.
|
|
@@ -42,11 +42,9 @@ module Tapioca
|
|
|
42
42
|
# ~~~
|
|
43
43
|
#: [ConstantType = (Class[ActiveModel::Validations] & ActiveModel::Validations::HelperMethods & ActiveModel::Validations::ClassMethods)]
|
|
44
44
|
class ActiveModelValidationsConfirmation < Compiler
|
|
45
|
-
extend T::Sig
|
|
46
|
-
|
|
47
45
|
class << self
|
|
48
46
|
# @override
|
|
49
|
-
#: -> T::
|
|
47
|
+
#: -> Enumerable[T::Module[top]]
|
|
50
48
|
def gather_constants
|
|
51
49
|
# Collect all the classes that include ActiveModel::Validations
|
|
52
50
|
all_classes.select { |c| ActiveModel::Validations > c }
|
|
@@ -103,15 +103,12 @@ module Tapioca
|
|
|
103
103
|
# ~~~
|
|
104
104
|
#: [ConstantType = singleton(ActiveRecord::Base)]
|
|
105
105
|
class ActiveRecordAssociations < Compiler
|
|
106
|
-
extend T::Sig
|
|
107
106
|
include Helpers::ActiveRecordConstantsHelper
|
|
108
107
|
|
|
109
108
|
class SourceReflectionError < StandardError
|
|
110
109
|
end
|
|
111
110
|
|
|
112
111
|
class MissingConstantError < StandardError
|
|
113
|
-
extend T::Sig
|
|
114
|
-
|
|
115
112
|
#: String
|
|
116
113
|
attr_reader :class_name
|
|
117
114
|
|
|
@@ -138,10 +135,8 @@ module Tapioca
|
|
|
138
135
|
end
|
|
139
136
|
|
|
140
137
|
class << self
|
|
141
|
-
extend T::Sig
|
|
142
|
-
|
|
143
138
|
# @override
|
|
144
|
-
#: -> T::
|
|
139
|
+
#: -> Enumerable[T::Module[top]]
|
|
145
140
|
def gather_constants
|
|
146
141
|
descendants_of(::ActiveRecord::Base).reject(&:abstract_class?)
|
|
147
142
|
end
|
|
@@ -122,7 +122,6 @@ module Tapioca
|
|
|
122
122
|
# ~~~
|
|
123
123
|
#: [ConstantType = singleton(ActiveRecord::Base)]
|
|
124
124
|
class ActiveRecordColumns < Compiler
|
|
125
|
-
extend T::Sig
|
|
126
125
|
include Helpers::ActiveRecordConstantsHelper
|
|
127
126
|
|
|
128
127
|
# @override
|
|
@@ -163,10 +162,8 @@ module Tapioca
|
|
|
163
162
|
end
|
|
164
163
|
|
|
165
164
|
class << self
|
|
166
|
-
extend T::Sig
|
|
167
|
-
|
|
168
165
|
# @override
|
|
169
|
-
#: -> T::
|
|
166
|
+
#: -> Enumerable[T::Module[top]]
|
|
170
167
|
def gather_constants
|
|
171
168
|
descendants_of(::ActiveRecord::Base).reject(&:abstract_class?)
|
|
172
169
|
end
|
|
@@ -189,7 +186,13 @@ module Tapioca
|
|
|
189
186
|
)
|
|
190
187
|
end
|
|
191
188
|
|
|
192
|
-
#: (
|
|
189
|
+
#: (
|
|
190
|
+
#| RBI::Scope klass,
|
|
191
|
+
#| String name,
|
|
192
|
+
#| Array[String]? methods_to_add,
|
|
193
|
+
#| ?return_type: String,
|
|
194
|
+
#| ?parameters: Array[RBI::TypedParam]
|
|
195
|
+
#| ) -> void
|
|
193
196
|
def add_method(klass, name, methods_to_add, return_type: "void", parameters: [])
|
|
194
197
|
klass.create_method(
|
|
195
198
|
name,
|
|
@@ -65,7 +65,6 @@ module Tapioca
|
|
|
65
65
|
# ~~~
|
|
66
66
|
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
|
|
67
67
|
class ActiveRecordDelegatedTypes < Compiler
|
|
68
|
-
extend T::Sig
|
|
69
68
|
include Helpers::ActiveRecordConstantsHelper
|
|
70
69
|
|
|
71
70
|
# @override
|
|
@@ -88,10 +87,8 @@ module Tapioca
|
|
|
88
87
|
end
|
|
89
88
|
|
|
90
89
|
class << self
|
|
91
|
-
extend T::Sig
|
|
92
|
-
|
|
93
90
|
# @override
|
|
94
|
-
#: -> T::
|
|
91
|
+
#: -> Enumerable[T::Module[top]]
|
|
95
92
|
def gather_constants
|
|
96
93
|
descendants_of(::ActiveRecord::Base).reject(&:abstract_class?)
|
|
97
94
|
end
|
|
@@ -51,8 +51,6 @@ module Tapioca
|
|
|
51
51
|
# ~~~
|
|
52
52
|
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
|
53
53
|
class ActiveRecordEnum < Compiler
|
|
54
|
-
extend T::Sig
|
|
55
|
-
|
|
56
54
|
# @override
|
|
57
55
|
#: -> void
|
|
58
56
|
def decorate
|
|
@@ -75,10 +73,8 @@ module Tapioca
|
|
|
75
73
|
end
|
|
76
74
|
|
|
77
75
|
class << self
|
|
78
|
-
extend T::Sig
|
|
79
|
-
|
|
80
76
|
# @override
|
|
81
|
-
#: -> T::
|
|
77
|
+
#: -> Enumerable[T::Module[top]]
|
|
82
78
|
def gather_constants
|
|
83
79
|
descendants_of(::ActiveRecord::Base)
|
|
84
80
|
end
|
|
@@ -35,8 +35,6 @@ module Tapioca
|
|
|
35
35
|
# ~~~
|
|
36
36
|
#: [ConstantType = singleton(ActiveSupport::TestCase)]
|
|
37
37
|
class ActiveRecordFixtures < Compiler
|
|
38
|
-
extend T::Sig
|
|
39
|
-
|
|
40
38
|
MISSING = Object.new
|
|
41
39
|
|
|
42
40
|
# @override
|
|
@@ -59,10 +57,8 @@ module Tapioca
|
|
|
59
57
|
end
|
|
60
58
|
|
|
61
59
|
class << self
|
|
62
|
-
extend T::Sig
|
|
63
|
-
|
|
64
60
|
# @override
|
|
65
|
-
#: -> T::
|
|
61
|
+
#: -> Enumerable[T::Module[top]]
|
|
66
62
|
def gather_constants
|
|
67
63
|
return [] unless defined?(Rails.application) && Rails.application
|
|
68
64
|
|