tapioca 0.17.3 → 0.17.4
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/ruby_lsp/tapioca/addon.rb +1 -1
- data/lib/tapioca/bundler_ext/auto_require_hook.rb +1 -4
- data/lib/tapioca/cli.rb +2 -2
- data/lib/tapioca/commands/abstract_dsl.rb +1 -2
- data/lib/tapioca/commands/abstract_gem.rb +1 -2
- data/lib/tapioca/commands/annotations.rb +1 -1
- data/lib/tapioca/commands/command.rb +4 -6
- data/lib/tapioca/commands/command_without_tracker.rb +1 -4
- data/lib/tapioca/dsl/compiler.rb +8 -10
- data/lib/tapioca/dsl/compilers/aasm.rb +1 -2
- data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -2
- data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -2
- data/lib/tapioca/dsl/compilers/action_text.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_job.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +1 -10
- data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_columns.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +54 -90
- data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_resource.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_storage.rb +1 -9
- data/lib/tapioca/dsl/compilers/active_support_concern.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +1 -2
- data/lib/tapioca/dsl/compilers/config.rb +1 -2
- data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -2
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -2
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -2
- data/lib/tapioca/dsl/compilers/identity_cache.rb +1 -2
- data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +1 -2
- data/lib/tapioca/dsl/compilers/kredis.rb +1 -4
- data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +1 -2
- data/lib/tapioca/dsl/compilers/protobuf.rb +1 -2
- data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -2
- data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -2
- data/lib/tapioca/dsl/compilers/smart_properties.rb +1 -2
- data/lib/tapioca/dsl/compilers/state_machines.rb +1 -2
- data/lib/tapioca/dsl/compilers/url_helpers.rb +1 -2
- data/lib/tapioca/gem/events.rb +2 -6
- data/lib/tapioca/gem/listeners/base.rb +1 -4
- data/lib/tapioca/helpers/cli_helper.rb +1 -4
- data/lib/tapioca/helpers/config_helper.rb +1 -4
- data/lib/tapioca/helpers/env_helper.rb +1 -4
- data/lib/tapioca/helpers/rbi_files_helper.rb +2 -5
- data/lib/tapioca/helpers/test/content.rb +1 -4
- data/lib/tapioca/helpers/test/dsl_compiler.rb +1 -4
- data/lib/tapioca/helpers/test/isolation.rb +2 -7
- data/lib/tapioca/helpers/test/template.rb +1 -4
- data/lib/tapioca/loaders/loader.rb +4 -6
- data/lib/tapioca/repo_index.rb +0 -2
- data/lib/tapioca/runtime/attached_class_of_legacy.rb +1 -4
- data/lib/tapioca/runtime/trackers/tracker.rb +1 -4
- data/lib/tapioca/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b36e9553bee2459f120edeb6eeaf9a77b25051c352750d17f473445c36d6d4d
|
4
|
+
data.tar.gz: f4777498dd0ed927e8d27f6f49fd0f01d372f2658bb1f6cd0c17494c436977cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d1c5fd8a3af303cbeb24593e3f448c43592389cb28d94be69035d8ba84a33c82ca462e8445d55ef13bcde62a32bccf8333fcbc91d546468a2e5070732fb51c9
|
7
|
+
data.tar.gz: edcc7dc4de8a1975ef2a396ce014137c6f20b796bfa680c8cf5a4e8fba37a04c5127f16bf6965af22993cb2c6e399937972176571e1fcb96efc260a74381f76d
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.
|
4
|
+
RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.26")
|
5
5
|
|
6
6
|
begin
|
7
7
|
# The Tapioca add-on depends on the Rails add-on to add a runtime component to the runtime server. We can allow the
|
@@ -6,12 +6,9 @@ module Tapioca
|
|
6
6
|
# This is a module that gets prepended to `Bundler::Dependency` and
|
7
7
|
# makes sure even gems marked as `require: false` are required during
|
8
8
|
# `Bundler.require`.
|
9
|
+
# @requires_ancestor: ::Bundler::Dependency
|
9
10
|
module AutoRequireHook
|
10
11
|
extend T::Sig
|
11
|
-
extend T::Helpers
|
12
|
-
|
13
|
-
requires_ancestor { ::Bundler::Dependency }
|
14
|
-
|
15
12
|
@exclude = [] #: Array[String]
|
16
13
|
@enabled = false #: bool
|
17
14
|
|
data/lib/tapioca/cli.rb
CHANGED
@@ -382,12 +382,12 @@ module Tapioca
|
|
382
382
|
# Indicates that we are running from the LSP, set using the `addon_mode!` method
|
383
383
|
attr_reader :addon_mode
|
384
384
|
|
385
|
-
|
385
|
+
#: -> void
|
386
386
|
def addon_mode!
|
387
387
|
@addon_mode = true
|
388
388
|
end
|
389
389
|
|
390
|
-
|
390
|
+
#: -> bool
|
391
391
|
def exit_on_failure?
|
392
392
|
!@addon_mode
|
393
393
|
end
|
@@ -3,12 +3,11 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
+
# @abstract
|
6
7
|
class AbstractDsl < CommandWithoutTracker
|
7
8
|
include SorbetHelper
|
8
9
|
include RBIFilesHelper
|
9
10
|
|
10
|
-
abstract!
|
11
|
-
|
12
11
|
#: (requested_constants: Array[String], requested_paths: Array[Pathname], outpath: Pathname, only: Array[String], exclude: Array[String], file_header: bool, tapioca_path: String, ?skip_constant: Array[String], ?quiet: bool, ?verbose: bool, ?number_of_workers: Integer?, ?auto_strictness: bool, ?gem_dir: String, ?rbi_formatter: RBIFormatter, ?app_root: String, ?halt_upon_load_error: bool, ?compiler_options: Hash[String, untyped], ?lsp_addon: bool) -> void
|
13
12
|
def initialize(
|
14
13
|
requested_constants:,
|
@@ -3,12 +3,11 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
+
# @abstract
|
6
7
|
class AbstractGem < Command
|
7
8
|
include SorbetHelper
|
8
9
|
include RBIFilesHelper
|
9
10
|
|
10
|
-
abstract!
|
11
|
-
|
12
11
|
#: (gem_names: Array[String], exclude: Array[String], include_dependencies: bool, prerequire: String?, postrequire: String, typed_overrides: Hash[String, String], outpath: Pathname, file_header: bool, include_doc: bool, include_loc: bool, include_exported_rbis: bool, ?number_of_workers: Integer?, ?auto_strictness: bool, ?dsl_dir: String, ?rbi_formatter: RBIFormatter, ?halt_upon_load_error: bool, ?lsp_addon: bool?) -> void
|
13
12
|
def initialize(
|
14
13
|
gem_names:,
|
@@ -125,7 +125,7 @@ module Tapioca
|
|
125
125
|
fetched_gems.keys.map(&:name).sort
|
126
126
|
end
|
127
127
|
|
128
|
-
|
128
|
+
#: (Array[String] repo_uris, GemInfo gem_info) -> bool
|
129
129
|
def fetch_annotation(repo_uris, gem_info)
|
130
130
|
gem_name = gem_info.name
|
131
131
|
gem_version = gem_info.version
|
@@ -3,10 +3,9 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
+
# @abstract
|
6
7
|
class Command
|
7
8
|
extend T::Sig
|
8
|
-
extend T::Helpers
|
9
|
-
|
10
9
|
class FileWriter < Thor
|
11
10
|
include Thor::Actions
|
12
11
|
end
|
@@ -14,8 +13,6 @@ module Tapioca
|
|
14
13
|
include Thor::Base
|
15
14
|
include CliHelper
|
16
15
|
|
17
|
-
abstract!
|
18
|
-
|
19
16
|
#: -> void
|
20
17
|
def initialize
|
21
18
|
@file_writer = FileWriter.new #: Thor::Actions
|
@@ -31,8 +28,9 @@ module Tapioca
|
|
31
28
|
|
32
29
|
private
|
33
30
|
|
34
|
-
|
35
|
-
|
31
|
+
# @abstract
|
32
|
+
#: -> void
|
33
|
+
def execute = raise NotImplementedError, "Abstract method called"
|
36
34
|
|
37
35
|
#: (Symbol command, *String args) -> String
|
38
36
|
def default_command(command, *args)
|
data/lib/tapioca/dsl/compiler.rb
CHANGED
@@ -3,19 +3,15 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Dsl
|
6
|
+
# @abstract
|
7
|
+
#: [ConstantType < Module]
|
6
8
|
class Compiler
|
7
9
|
extend T::Sig
|
8
|
-
extend T::Helpers
|
9
|
-
extend T::Generic
|
10
10
|
|
11
11
|
include RBIHelper
|
12
12
|
include Runtime::Reflection
|
13
13
|
extend Runtime::Reflection
|
14
14
|
|
15
|
-
ConstantType = type_member { { upper: Module } }
|
16
|
-
|
17
|
-
abstract!
|
18
|
-
|
19
15
|
#: ConstantType
|
20
16
|
attr_reader :constant
|
21
17
|
|
@@ -35,8 +31,9 @@ module Tapioca
|
|
35
31
|
processable_constants.include?(constant)
|
36
32
|
end
|
37
33
|
|
38
|
-
|
39
|
-
|
34
|
+
# @abstract
|
35
|
+
#: -> T::Enumerable[Module]
|
36
|
+
def gather_constants = raise NotImplementedError, "Abstract method called"
|
40
37
|
|
41
38
|
#: -> Set[Module]
|
42
39
|
def processable_constants
|
@@ -100,8 +97,9 @@ module Tapioca
|
|
100
97
|
@pipeline.compiler_enabled?(compiler_name)
|
101
98
|
end
|
102
99
|
|
103
|
-
|
104
|
-
|
100
|
+
# @abstract
|
101
|
+
#: -> void
|
102
|
+
def decorate = raise NotImplementedError, "Abstract method called"
|
105
103
|
|
106
104
|
# NOTE: This should eventually accept an `Error` object or `Exception` rather than simply a `String`.
|
107
105
|
#: (String error) -> void
|
@@ -32,6 +32,7 @@ module Tapioca
|
|
32
32
|
# sleeping?, running?, cleaning?
|
33
33
|
# run, run!, run_without_validation!, may_run?
|
34
34
|
#
|
35
|
+
#: [ConstantType = (Class[::AASM] & ::AASM::ClassMethods)]
|
35
36
|
class AASM < Compiler
|
36
37
|
extend T::Sig
|
37
38
|
|
@@ -68,8 +69,6 @@ module Tapioca
|
|
68
69
|
"success",
|
69
70
|
].freeze #: Array[String]
|
70
71
|
|
71
|
-
ConstantType = type_member { { fixed: T.all(T::Class[::AASM], ::AASM::ClassMethods) } }
|
72
|
-
|
73
72
|
# @override
|
74
73
|
#: -> void
|
75
74
|
def decorate
|
@@ -61,11 +61,10 @@ module Tapioca
|
|
61
61
|
# def helpers; end
|
62
62
|
# end
|
63
63
|
# ~~~
|
64
|
+
#: [ConstantType = singleton(::ActionController::Base)]
|
64
65
|
class ActionControllerHelpers < Compiler
|
65
66
|
extend T::Sig
|
66
67
|
|
67
|
-
ConstantType = type_member { { fixed: T.class_of(::ActionController::Base) } }
|
68
|
-
|
69
68
|
# @override
|
70
69
|
#: -> void
|
71
70
|
def decorate
|
@@ -29,11 +29,10 @@ module Tapioca
|
|
29
29
|
# def self.notify_customer(customer_id); end
|
30
30
|
# end
|
31
31
|
# ~~~
|
32
|
+
#: [ConstantType = singleton(::ActionMailer::Base)]
|
32
33
|
class ActionMailer < Compiler
|
33
34
|
extend T::Sig
|
34
35
|
|
35
|
-
ConstantType = type_member { { fixed: T.class_of(::ActionMailer::Base) } }
|
36
|
-
|
37
36
|
# @override
|
38
37
|
#: -> void
|
39
38
|
def decorate
|
@@ -43,11 +43,10 @@ module Tapioca
|
|
43
43
|
# def title?; end
|
44
44
|
# end
|
45
45
|
# ~~~
|
46
|
+
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
46
47
|
class ActionText < Compiler
|
47
48
|
extend T::Sig
|
48
49
|
|
49
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
|
50
|
-
|
51
50
|
# @override
|
52
51
|
#: -> void
|
53
52
|
def decorate
|
@@ -38,11 +38,10 @@ module Tapioca
|
|
38
38
|
# def self.perform_now(user); end
|
39
39
|
# end
|
40
40
|
# ~~~
|
41
|
+
#: [ConstantType = singleton(::ActiveJob::Base)]
|
41
42
|
class ActiveJob < Compiler
|
42
43
|
extend T::Sig
|
43
44
|
|
44
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveJob::Base) } }
|
45
|
-
|
46
45
|
# @override
|
47
46
|
#: -> void
|
48
47
|
def decorate
|
@@ -34,13 +34,10 @@ module Tapioca
|
|
34
34
|
# def name=(name); end
|
35
35
|
# end
|
36
36
|
# ~~~
|
37
|
+
#: [ConstantType = (Class[::ActiveModel::Attributes] & ::ActiveModel::Attributes::ClassMethods)]
|
37
38
|
class ActiveModelAttributes < Compiler
|
38
39
|
extend T::Sig
|
39
40
|
|
40
|
-
ConstantType = type_member do
|
41
|
-
{ fixed: T.all(T::Class[::ActiveModel::Attributes], ::ActiveModel::Attributes::ClassMethods) }
|
42
|
-
end
|
43
|
-
|
44
41
|
# @override
|
45
42
|
#: -> void
|
46
43
|
def decorate
|
@@ -53,13 +53,10 @@ module Tapioca
|
|
53
53
|
# def token_confirmation=(unencrypted_password); end
|
54
54
|
# end
|
55
55
|
# ~~~
|
56
|
+
#: [ConstantType = (Class[::ActiveModel::SecurePassword] & ::ActiveModel::SecurePassword::ClassMethods)]
|
56
57
|
class ActiveModelSecurePassword < Compiler
|
57
58
|
extend T::Sig
|
58
59
|
|
59
|
-
ConstantType = type_member do
|
60
|
-
{ fixed: T.all(T::Class[::ActiveModel::SecurePassword], ::ActiveModel::SecurePassword::ClassMethods) }
|
61
|
-
end
|
62
|
-
|
63
60
|
# @override
|
64
61
|
#: -> void
|
65
62
|
def decorate
|
@@ -40,19 +40,10 @@ module Tapioca
|
|
40
40
|
# def password_confirmation=(password_confirmation); end
|
41
41
|
# end
|
42
42
|
# ~~~
|
43
|
+
#: [ConstantType = (Class[ActiveModel::Validations] & ActiveModel::Validations::HelperMethods & ActiveModel::Validations::ClassMethods)]
|
43
44
|
class ActiveModelValidationsConfirmation < Compiler
|
44
45
|
extend T::Sig
|
45
46
|
|
46
|
-
ConstantType = type_member do
|
47
|
-
{
|
48
|
-
fixed: T.all(
|
49
|
-
T::Class[ActiveModel::Validations],
|
50
|
-
ActiveModel::Validations::HelperMethods,
|
51
|
-
ActiveModel::Validations::ClassMethods,
|
52
|
-
),
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
47
|
class << self
|
57
48
|
# @override
|
58
49
|
#: -> T::Enumerable[Module]
|
@@ -101,6 +101,7 @@ module Tapioca
|
|
101
101
|
# end
|
102
102
|
# end
|
103
103
|
# ~~~
|
104
|
+
#: [ConstantType = singleton(ActiveRecord::Base)]
|
104
105
|
class ActiveRecordAssociations < Compiler
|
105
106
|
extend T::Sig
|
106
107
|
include Helpers::ActiveRecordConstantsHelper
|
@@ -121,8 +122,6 @@ module Tapioca
|
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
124
|
-
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
|
125
|
-
|
126
125
|
# @override
|
127
126
|
#: -> void
|
128
127
|
def decorate
|
@@ -120,12 +120,11 @@ module Tapioca
|
|
120
120
|
# sig { returns(T.untyped) }
|
121
121
|
# def title; end
|
122
122
|
# ~~~
|
123
|
+
#: [ConstantType = singleton(ActiveRecord::Base)]
|
123
124
|
class ActiveRecordColumns < Compiler
|
124
125
|
extend T::Sig
|
125
126
|
include Helpers::ActiveRecordConstantsHelper
|
126
127
|
|
127
|
-
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
|
128
|
-
|
129
128
|
# @override
|
130
129
|
#: -> void
|
131
130
|
def decorate
|
@@ -63,12 +63,11 @@ module Tapioca
|
|
63
63
|
# end
|
64
64
|
#
|
65
65
|
# ~~~
|
66
|
+
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
|
66
67
|
class ActiveRecordDelegatedTypes < Compiler
|
67
68
|
extend T::Sig
|
68
69
|
include Helpers::ActiveRecordConstantsHelper
|
69
70
|
|
70
|
-
ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
|
71
|
-
|
72
71
|
# @override
|
73
72
|
#: -> void
|
74
73
|
def decorate
|
@@ -49,11 +49,10 @@ module Tapioca
|
|
49
49
|
# end
|
50
50
|
# end
|
51
51
|
# ~~~
|
52
|
+
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
52
53
|
class ActiveRecordEnum < Compiler
|
53
54
|
extend T::Sig
|
54
55
|
|
55
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
|
56
|
-
|
57
56
|
# @override
|
58
57
|
#: -> void
|
59
58
|
def decorate
|
@@ -33,10 +33,10 @@ module Tapioca
|
|
33
33
|
# def posts(fixture_name = nil, *other_fixtures); end
|
34
34
|
# end
|
35
35
|
# ~~~
|
36
|
+
#: [ConstantType = singleton(ActiveSupport::TestCase)]
|
36
37
|
class ActiveRecordFixtures < Compiler
|
37
38
|
extend T::Sig
|
38
39
|
|
39
|
-
ConstantType = type_member { { fixed: T.class_of(ActiveSupport::TestCase) } }
|
40
40
|
MISSING = Object.new
|
41
41
|
|
42
42
|
# @override
|
@@ -148,13 +148,12 @@ module Tapioca
|
|
148
148
|
# end
|
149
149
|
# end
|
150
150
|
# ~~~
|
151
|
+
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
151
152
|
class ActiveRecordRelations < Compiler
|
152
153
|
extend T::Sig
|
153
154
|
include Helpers::ActiveRecordConstantsHelper
|
154
155
|
include SorbetHelper
|
155
156
|
|
156
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
|
157
|
-
|
158
157
|
# From ActiveRecord::ConnectionAdapter::Quoting#quote, minus nil
|
159
158
|
ID_TYPES = [
|
160
159
|
"String",
|
@@ -217,6 +216,17 @@ module Tapioca
|
|
217
216
|
[]
|
218
217
|
end #: Array[Symbol]
|
219
218
|
BATCHES_METHODS = ActiveRecord::Batches.instance_methods(false) #: Array[Symbol]
|
219
|
+
BATCHES_METHODS_PARAMETERS = {
|
220
|
+
start: ["T.untyped", "nil"],
|
221
|
+
finish: ["T.untyped", "nil"],
|
222
|
+
load: ["T.untyped", "false"],
|
223
|
+
batch_size: ["Integer", "1000"],
|
224
|
+
of: ["Integer", "1000"],
|
225
|
+
error_on_ignore: ["T.untyped", "nil"],
|
226
|
+
order: ["Symbol", ":asc"],
|
227
|
+
cursor: ["T.untyped", "primary_key"],
|
228
|
+
use_ranges: ["T.untyped", "nil"],
|
229
|
+
} #: Hash[Symbol, [String, String]]
|
220
230
|
CALCULATION_METHODS = ActiveRecord::Calculations.instance_methods(false) #: Array[Symbol]
|
221
231
|
ENUMERABLE_QUERY_METHODS = [:any?, :many?, :none?, :one?] #: Array[Symbol]
|
222
232
|
FIND_OR_CREATE_METHODS = [
|
@@ -855,102 +865,31 @@ module Tapioca
|
|
855
865
|
end
|
856
866
|
|
857
867
|
BATCHES_METHODS.each do |method_name|
|
858
|
-
|
859
|
-
|
860
|
-
order = ActiveRecord::Batches.instance_method(:find_each).parameters.include?([:key, :order])
|
861
|
-
|
862
|
-
common_relation_methods_module.create_method("find_each") do |method|
|
863
|
-
method.add_kw_opt_param("start", "nil")
|
864
|
-
method.add_kw_opt_param("finish", "nil")
|
865
|
-
method.add_kw_opt_param("batch_size", "1000")
|
866
|
-
method.add_kw_opt_param("error_on_ignore", "nil")
|
867
|
-
method.add_kw_opt_param("order", ":asc") if order
|
868
|
-
method.add_block_param("block")
|
868
|
+
block_param, return_type, parameters = batch_method_configs(method_name)
|
869
|
+
next if block_param.nil? || return_type.nil? || parameters.nil?
|
869
870
|
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
sig.add_param("error_on_ignore", "T.untyped")
|
875
|
-
sig.add_param("order", "Symbol") if order
|
876
|
-
sig.add_param("block", "T.proc.params(object: #{constant_name}).void")
|
877
|
-
sig.return_type = "void"
|
878
|
-
end
|
871
|
+
common_relation_methods_module.create_method(method_name.to_s) do |method|
|
872
|
+
parameters.each do |name, (style, _type, default)|
|
873
|
+
# The style is always "key", but this is a safeguard to prevent confusing errors in the future.
|
874
|
+
raise "Unexpected style #{style} for #{name}" unless style == :key
|
879
875
|
|
880
|
-
method.
|
881
|
-
sig.add_param("start", "T.untyped")
|
882
|
-
sig.add_param("finish", "T.untyped")
|
883
|
-
sig.add_param("batch_size", "Integer")
|
884
|
-
sig.add_param("error_on_ignore", "T.untyped")
|
885
|
-
sig.add_param("order", "Symbol") if order
|
886
|
-
sig.return_type = "T::Enumerator[#{constant_name}]"
|
887
|
-
end
|
876
|
+
method.add_kw_opt_param(name, T.must(default))
|
888
877
|
end
|
889
|
-
|
890
|
-
order = ActiveRecord::Batches.instance_method(:find_in_batches).parameters.include?([:key, :order])
|
891
|
-
common_relation_methods_module.create_method("find_in_batches") do |method|
|
892
|
-
method.add_kw_opt_param("start", "nil")
|
893
|
-
method.add_kw_opt_param("finish", "nil")
|
894
|
-
method.add_kw_opt_param("batch_size", "1000")
|
895
|
-
method.add_kw_opt_param("error_on_ignore", "nil")
|
896
|
-
method.add_kw_opt_param("order", ":asc") if order
|
897
|
-
method.add_block_param("block")
|
898
|
-
|
899
|
-
method.add_sig do |sig|
|
900
|
-
sig.add_param("start", "T.untyped")
|
901
|
-
sig.add_param("finish", "T.untyped")
|
902
|
-
sig.add_param("batch_size", "Integer")
|
903
|
-
sig.add_param("error_on_ignore", "T.untyped")
|
904
|
-
sig.add_param("order", "Symbol") if order
|
905
|
-
sig.add_param("block", "T.proc.params(object: T::Array[#{constant_name}]).void")
|
906
|
-
sig.return_type = "void"
|
907
|
-
end
|
878
|
+
method.add_block_param("block")
|
908
879
|
|
909
|
-
|
910
|
-
|
911
|
-
sig.add_param(
|
912
|
-
sig.add_param("batch_size", "Integer")
|
913
|
-
sig.add_param("error_on_ignore", "T.untyped")
|
914
|
-
sig.add_param("order", "Symbol") if order
|
915
|
-
sig.return_type = "T::Enumerator[T::Enumerator[#{constant_name}]]"
|
880
|
+
method.add_sig do |sig|
|
881
|
+
parameters.each do |name, (_style, type, _default)|
|
882
|
+
sig.add_param(name, type)
|
916
883
|
end
|
884
|
+
sig.add_param("block", "T.proc.params(object: #{block_param}).void")
|
885
|
+
sig.return_type = "void"
|
917
886
|
end
|
918
|
-
when :in_batches
|
919
|
-
order = ActiveRecord::Batches.instance_method(:in_batches).parameters.include?([:key, :order])
|
920
|
-
use_ranges = ActiveRecord::Batches.instance_method(:in_batches).parameters.include?([:key, :use_ranges])
|
921
|
-
|
922
|
-
common_relation_methods_module.create_method("in_batches") do |method|
|
923
|
-
method.add_kw_opt_param("of", "1000")
|
924
|
-
method.add_kw_opt_param("start", "nil")
|
925
|
-
method.add_kw_opt_param("finish", "nil")
|
926
|
-
method.add_kw_opt_param("load", "false")
|
927
|
-
method.add_kw_opt_param("error_on_ignore", "nil")
|
928
|
-
method.add_kw_opt_param("order", ":asc") if order
|
929
|
-
method.add_kw_opt_param("use_ranges", "nil") if use_ranges
|
930
|
-
method.add_block_param("block")
|
931
|
-
|
932
|
-
method.add_sig do |sig|
|
933
|
-
sig.add_param("of", "Integer")
|
934
|
-
sig.add_param("start", "T.untyped")
|
935
|
-
sig.add_param("finish", "T.untyped")
|
936
|
-
sig.add_param("load", "T.untyped")
|
937
|
-
sig.add_param("error_on_ignore", "T.untyped")
|
938
|
-
sig.add_param("order", "Symbol") if order
|
939
|
-
sig.add_param("use_ranges", "T.untyped") if use_ranges
|
940
|
-
sig.add_param("block", "T.proc.params(object: #{RelationClassName}).void")
|
941
|
-
sig.return_type = "void"
|
942
|
-
end
|
943
887
|
|
944
|
-
|
945
|
-
|
946
|
-
sig.add_param(
|
947
|
-
sig.add_param("finish", "T.untyped")
|
948
|
-
sig.add_param("load", "T.untyped")
|
949
|
-
sig.add_param("error_on_ignore", "T.untyped")
|
950
|
-
sig.add_param("order", "Symbol") if order
|
951
|
-
sig.add_param("use_ranges", "T.untyped") if use_ranges
|
952
|
-
sig.return_type = "::ActiveRecord::Batches::BatchEnumerator"
|
888
|
+
method.add_sig do |sig|
|
889
|
+
parameters.each do |name, (_style, type, _default)|
|
890
|
+
sig.add_param(name, type)
|
953
891
|
end
|
892
|
+
sig.return_type = return_type
|
954
893
|
end
|
955
894
|
end
|
956
895
|
end
|
@@ -1029,6 +968,31 @@ module Tapioca
|
|
1029
968
|
end
|
1030
969
|
end
|
1031
970
|
|
971
|
+
#: (Symbol) -> [String, String, Hash[String, [Symbol, String, String?]]]?
|
972
|
+
def batch_method_configs(method_name)
|
973
|
+
block_param, return_type = case method_name
|
974
|
+
when :find_each
|
975
|
+
[constant_name, "T::Enumerator[#{constant_name}]"]
|
976
|
+
when :find_in_batches
|
977
|
+
["T::Array[#{constant_name}]", "T::Enumerator[T::Enumerator[#{constant_name}]]"]
|
978
|
+
when :in_batches
|
979
|
+
[RelationClassName, "::ActiveRecord::Batches::BatchEnumerator"]
|
980
|
+
else
|
981
|
+
return
|
982
|
+
end
|
983
|
+
|
984
|
+
parameters = {}
|
985
|
+
|
986
|
+
ActiveRecord::Batches.instance_method(method_name).parameters.each do |style, name|
|
987
|
+
type, default = BATCHES_METHODS_PARAMETERS[name]
|
988
|
+
next if type.nil?
|
989
|
+
|
990
|
+
parameters[name.to_s] = [style, type, default]
|
991
|
+
end
|
992
|
+
|
993
|
+
[block_param, return_type, parameters]
|
994
|
+
end
|
995
|
+
|
1032
996
|
#: ((Symbol | String) name, ?parameters: Array[RBI::TypedParam], ?return_type: String?) -> void
|
1033
997
|
def create_common_method(name, parameters: [], return_type: nil)
|
1034
998
|
common_relation_methods_module.create_method(
|
@@ -38,12 +38,11 @@ module Tapioca
|
|
38
38
|
# end
|
39
39
|
# end
|
40
40
|
# ~~~
|
41
|
+
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
41
42
|
class ActiveRecordScope < Compiler
|
42
43
|
extend T::Sig
|
43
44
|
include Helpers::ActiveRecordConstantsHelper
|
44
45
|
|
45
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
|
46
|
-
|
47
46
|
# @override
|
48
47
|
#: -> void
|
49
48
|
def decorate
|
@@ -32,12 +32,11 @@ module Tapioca
|
|
32
32
|
# def regenerate_auth_token; end
|
33
33
|
# end
|
34
34
|
# ~~~
|
35
|
+
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
|
35
36
|
class ActiveRecordSecureToken < Compiler
|
36
37
|
extend T::Sig
|
37
38
|
include Helpers::ActiveRecordConstantsHelper
|
38
39
|
|
39
|
-
ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
|
40
|
-
|
41
40
|
# @override
|
42
41
|
#: -> void
|
43
42
|
def decorate
|
@@ -78,12 +78,11 @@ module Tapioca
|
|
78
78
|
# end
|
79
79
|
# end
|
80
80
|
# ~~~
|
81
|
+
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
|
81
82
|
class ActiveRecordStore < Compiler
|
82
83
|
extend T::Sig
|
83
84
|
include Helpers::ActiveRecordConstantsHelper
|
84
85
|
|
85
|
-
ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
|
86
|
-
|
87
86
|
# @override
|
88
87
|
#: -> void
|
89
88
|
def decorate
|
@@ -81,11 +81,10 @@ module Tapioca
|
|
81
81
|
# end
|
82
82
|
# end
|
83
83
|
# ~~~
|
84
|
+
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
84
85
|
class ActiveRecordTypedStore < Compiler
|
85
86
|
extend T::Sig
|
86
87
|
|
87
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
|
88
|
-
|
89
88
|
# @override
|
90
89
|
#: -> void
|
91
90
|
def decorate
|
@@ -54,11 +54,10 @@ module Tapioca
|
|
54
54
|
# def year?; end
|
55
55
|
# end
|
56
56
|
# ~~~
|
57
|
+
#: [ConstantType = singleton(::ActiveResource::Base)]
|
57
58
|
class ActiveResource < Compiler
|
58
59
|
extend T::Sig
|
59
60
|
|
60
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveResource::Base) } }
|
61
|
-
|
62
61
|
# @override
|
63
62
|
#: -> void
|
64
63
|
def decorate
|
@@ -38,18 +38,10 @@ module Tapioca
|
|
38
38
|
# def photo=(attachable); end
|
39
39
|
# end
|
40
40
|
# ~~~
|
41
|
+
#: [ConstantType = (Module & ::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods)]
|
41
42
|
class ActiveStorage < Compiler
|
42
43
|
extend T::Sig
|
43
44
|
|
44
|
-
ConstantType = type_member do
|
45
|
-
{
|
46
|
-
fixed: T.all(
|
47
|
-
Module,
|
48
|
-
::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods,
|
49
|
-
),
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
45
|
# @override
|
54
46
|
#: -> void
|
55
47
|
def decorate
|
@@ -37,11 +37,10 @@ module Tapioca
|
|
37
37
|
# mixes_in_class_methods(::Foo::ClassMethods)
|
38
38
|
# end
|
39
39
|
# ~~~
|
40
|
+
#: [ConstantType = Module]
|
40
41
|
class ActiveSupportConcern < Compiler
|
41
42
|
extend T::Sig
|
42
43
|
|
43
|
-
ConstantType = type_member { { fixed: Module } }
|
44
|
-
|
45
44
|
# @override
|
46
45
|
#: -> void
|
47
46
|
def decorate
|
@@ -59,11 +59,10 @@ module Tapioca
|
|
59
59
|
# end
|
60
60
|
# end
|
61
61
|
# ~~~
|
62
|
+
#: [ConstantType = singleton(::ActiveSupport::CurrentAttributes)]
|
62
63
|
class ActiveSupportCurrentAttributes < Compiler
|
63
64
|
extend T::Sig
|
64
65
|
|
65
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveSupport::CurrentAttributes) } }
|
66
|
-
|
67
66
|
# @override
|
68
67
|
#: -> void
|
69
68
|
def decorate
|
@@ -34,11 +34,10 @@ module Tapioca
|
|
34
34
|
# end
|
35
35
|
# end
|
36
36
|
# ```
|
37
|
+
#: [ConstantType = singleton(::Time)]
|
37
38
|
class ActiveSupportTimeExt < Compiler
|
38
39
|
extend T::Sig
|
39
40
|
|
40
|
-
ConstantType = type_member { { fixed: T.class_of(::Time) } }
|
41
|
-
|
42
41
|
# @override
|
43
42
|
#: -> void
|
44
43
|
def decorate
|
@@ -40,13 +40,12 @@ module Tapioca
|
|
40
40
|
# def github=(value); end
|
41
41
|
# end
|
42
42
|
# ```
|
43
|
+
#: [ConstantType = Module]
|
43
44
|
class Config < Compiler
|
44
45
|
extend T::Sig
|
45
46
|
|
46
47
|
CONFIG_OPTIONS_SUFFIX = "ConfigOptions"
|
47
48
|
|
48
|
-
ConstantType = type_member { { fixed: Module } }
|
49
|
-
|
50
49
|
# @override
|
51
50
|
#: -> void
|
52
51
|
def decorate
|
@@ -58,11 +58,10 @@ module Tapioca
|
|
58
58
|
# end
|
59
59
|
# end
|
60
60
|
# ~~~
|
61
|
+
#: [ConstantType = (singleton(::FrozenRecord::Base) & Extensions::FrozenRecord)]
|
61
62
|
class FrozenRecord < Compiler
|
62
63
|
extend T::Sig
|
63
64
|
|
64
|
-
ConstantType = type_member { { fixed: T.all(T.class_of(::FrozenRecord::Base), Extensions::FrozenRecord) } }
|
65
|
-
|
66
65
|
# @override
|
67
66
|
#: -> void
|
68
67
|
def decorate
|
@@ -34,11 +34,10 @@ module Tapioca
|
|
34
34
|
# def post_id; end
|
35
35
|
# end
|
36
36
|
# ~~~
|
37
|
+
#: [ConstantType = singleton(GraphQL::Schema::InputObject)]
|
37
38
|
class GraphqlInputObject < Compiler
|
38
39
|
extend T::Sig
|
39
40
|
|
40
|
-
ConstantType = type_member { { fixed: T.class_of(GraphQL::Schema::InputObject) } }
|
41
|
-
|
42
41
|
# @override
|
43
42
|
#: -> void
|
44
43
|
def decorate
|
@@ -35,11 +35,10 @@ module Tapioca
|
|
35
35
|
# def resolve(body:, post_id:); end
|
36
36
|
# end
|
37
37
|
# ~~~
|
38
|
+
#: [ConstantType = singleton(GraphQL::Schema::Mutation)]
|
38
39
|
class GraphqlMutation < Compiler
|
39
40
|
extend T::Sig
|
40
41
|
|
41
|
-
ConstantType = type_member { { fixed: T.class_of(GraphQL::Schema::Mutation) } }
|
42
|
-
|
43
42
|
# @override
|
44
43
|
#: -> void
|
45
44
|
def decorate
|
@@ -55,13 +55,12 @@ module Tapioca
|
|
55
55
|
# def fetch_by_title_and_review_date(title, review_date, includes: nil); end
|
56
56
|
# end
|
57
57
|
# ~~~
|
58
|
+
#: [ConstantType = singleton(::ActiveRecord::Base)]
|
58
59
|
class IdentityCache < Compiler
|
59
60
|
extend T::Sig
|
60
61
|
|
61
62
|
COLLECTION_TYPE = ->(type) { "T::Array[::#{type}]" } #: ^((Module | String) type) -> String
|
62
63
|
|
63
|
-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
|
64
|
-
|
65
64
|
# @override
|
66
65
|
#: -> void
|
67
66
|
def decorate
|
@@ -79,11 +79,10 @@ module Tapioca
|
|
79
79
|
# end
|
80
80
|
# end
|
81
81
|
# ~~~
|
82
|
+
#: [ConstantType = singleton(::JsonApiClient::Resource)]
|
82
83
|
class JsonApiClientResource < Compiler
|
83
84
|
extend T::Sig
|
84
85
|
|
85
|
-
ConstantType = type_member { { fixed: T.class_of(::JsonApiClient::Resource) } }
|
86
|
-
|
87
86
|
# @override
|
88
87
|
#: -> void
|
89
88
|
def decorate
|
@@ -63,13 +63,10 @@ module Tapioca
|
|
63
63
|
# end
|
64
64
|
# end
|
65
65
|
# ~~~
|
66
|
+
#: [ConstantType = (Class[::Kredis::Attributes] & ::Kredis::Attributes::ClassMethods & Extensions::Kredis)]
|
66
67
|
class Kredis < Compiler
|
67
68
|
extend T::Sig
|
68
69
|
|
69
|
-
ConstantType = type_member do
|
70
|
-
{ fixed: T.all(T::Class[::Kredis::Attributes], ::Kredis::Attributes::ClassMethods, Extensions::Kredis) }
|
71
|
-
end
|
72
|
-
|
73
70
|
# @override
|
74
71
|
#: -> void
|
75
72
|
def decorate
|
@@ -64,6 +64,7 @@ module Tapioca
|
|
64
64
|
# ~~~
|
65
65
|
# --ignore=/path/to/proto/cart_pb.rb
|
66
66
|
# ~~~
|
67
|
+
#: [ConstantType = Class[top]]
|
67
68
|
class Protobuf < Compiler
|
68
69
|
class Field < T::Struct
|
69
70
|
prop :name, String
|
@@ -74,8 +75,6 @@ module Tapioca
|
|
74
75
|
|
75
76
|
extend T::Sig
|
76
77
|
|
77
|
-
ConstantType = type_member { { fixed: T::Class[T.anything] } }
|
78
|
-
|
79
78
|
FIELD_RE = /^[a-z_][a-zA-Z0-9_]*$/
|
80
79
|
|
81
80
|
# @override
|
@@ -33,13 +33,12 @@ module Tapioca
|
|
33
33
|
# def skip_comments; end
|
34
34
|
# end
|
35
35
|
# ~~~
|
36
|
+
#: [ConstantType = singleton(::Rails::Generators::Base)]
|
36
37
|
class RailsGenerators < Compiler
|
37
38
|
extend T::Sig
|
38
39
|
|
39
40
|
BUILT_IN_MATCHER = /::(ActionMailbox|ActionText|ActiveRecord|Rails)::Generators/
|
40
41
|
|
41
|
-
ConstantType = type_member { { fixed: T.class_of(::Rails::Generators::Base) } }
|
42
|
-
|
43
42
|
# @override
|
44
43
|
#: -> void
|
45
44
|
def decorate
|
@@ -41,11 +41,10 @@ module Tapioca
|
|
41
41
|
# as accepted values for the `interval` parameter:
|
42
42
|
# * `self.perform_at` will also accept a `ActiveSupport::TimeWithZone` value
|
43
43
|
# * `self.perform_in` will also accept a `ActiveSupport::Duration` value
|
44
|
+
#: [ConstantType = singleton(::Sidekiq::Worker)]
|
44
45
|
class SidekiqWorker < Compiler
|
45
46
|
extend T::Sig
|
46
47
|
|
47
|
-
ConstantType = type_member { { fixed: T.class_of(::Sidekiq::Worker) } }
|
48
|
-
|
49
48
|
# @override
|
50
49
|
#: -> void
|
51
50
|
def decorate
|
@@ -54,11 +54,10 @@ module Tapioca
|
|
54
54
|
# def enabled=(enabled); end
|
55
55
|
# end
|
56
56
|
# ~~~
|
57
|
+
#: [ConstantType = singleton(::SmartProperties)]
|
57
58
|
class SmartProperties < Compiler
|
58
59
|
extend T::Sig
|
59
60
|
|
60
|
-
ConstantType = type_member { { fixed: T.class_of(::SmartProperties) } }
|
61
|
-
|
62
61
|
# @override
|
63
62
|
#: -> void
|
64
63
|
def decorate
|
@@ -109,11 +109,10 @@ module Tapioca
|
|
109
109
|
# end
|
110
110
|
# end
|
111
111
|
# ~~~
|
112
|
+
#: [ConstantType = (Module & ::StateMachines::ClassMethods)]
|
112
113
|
class StateMachines < Compiler
|
113
114
|
extend T::Sig
|
114
115
|
|
115
|
-
ConstantType = type_member { { fixed: T.all(Module, ::StateMachines::ClassMethods) } }
|
116
|
-
|
117
116
|
# @override
|
118
117
|
#: -> void
|
119
118
|
def decorate
|
@@ -78,11 +78,10 @@ module Tapioca
|
|
78
78
|
# include GeneratedUrlHelpersModule
|
79
79
|
# end
|
80
80
|
# ~~~
|
81
|
+
#: [ConstantType = Module]
|
81
82
|
class UrlHelpers < Compiler
|
82
83
|
extend T::Sig
|
83
84
|
|
84
|
-
ConstantType = type_member { { fixed: Module } }
|
85
|
-
|
86
85
|
# @override
|
87
86
|
#: -> void
|
88
87
|
def decorate
|
data/lib/tapioca/gem/events.rb
CHANGED
@@ -3,11 +3,9 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Gem
|
6
|
+
# @abstract
|
6
7
|
class Event
|
7
8
|
extend T::Sig
|
8
|
-
extend T::Helpers
|
9
|
-
|
10
|
-
abstract!
|
11
9
|
end
|
12
10
|
|
13
11
|
class SymbolFound < Event
|
@@ -57,12 +55,10 @@ module Tapioca
|
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
58
|
+
# @abstract
|
60
59
|
class NodeAdded < Event
|
61
|
-
extend T::Helpers
|
62
60
|
extend T::Sig
|
63
61
|
|
64
|
-
abstract!
|
65
|
-
|
66
62
|
#: String
|
67
63
|
attr_reader :symbol
|
68
64
|
|
@@ -2,12 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Tapioca
|
5
|
+
# @requires_ancestor: Thor::Shell
|
5
6
|
module CliHelper
|
6
7
|
extend T::Sig
|
7
|
-
extend T::Helpers
|
8
|
-
|
9
|
-
requires_ancestor { Thor::Shell }
|
10
|
-
|
11
8
|
#: (?String message, *(Symbol | Array[Symbol]) color) -> void
|
12
9
|
def say_error(message = "", *color)
|
13
10
|
# Thor has its own `say_error` now, but it has two problems:
|
@@ -2,12 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Tapioca
|
5
|
+
# @requires_ancestor: Thor
|
5
6
|
module EnvHelper
|
6
7
|
extend T::Sig
|
7
|
-
extend T::Helpers
|
8
|
-
|
9
|
-
requires_ancestor { Thor }
|
10
|
-
|
11
8
|
#: (Hash[Symbol, untyped] options) -> void
|
12
9
|
def set_environment(options) # rubocop:disable Naming/AccessorMethodName
|
13
10
|
ENV["RAILS_ENV"] = ENV["RACK_ENV"] = options[:environment]
|
@@ -2,13 +2,10 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Tapioca
|
5
|
+
# @requires_ancestor: Thor::Shell
|
6
|
+
# @requires_ancestor: SorbetHelper
|
5
7
|
module RBIFilesHelper
|
6
8
|
extend T::Sig
|
7
|
-
extend T::Helpers
|
8
|
-
|
9
|
-
requires_ancestor { Thor::Shell }
|
10
|
-
requires_ancestor { SorbetHelper }
|
11
|
-
|
12
9
|
#: (RBI::Index index, String kind, String file) -> void
|
13
10
|
def index_rbi(index, kind, file)
|
14
11
|
return unless File.exist?(file)
|
@@ -10,16 +10,13 @@ require "tapioca/helpers/sorbet_helper"
|
|
10
10
|
module Tapioca
|
11
11
|
module Helpers
|
12
12
|
module Test
|
13
|
+
# @requires_ancestor: Kernel
|
13
14
|
module DslCompiler
|
14
15
|
extend T::Sig
|
15
|
-
extend T::Helpers
|
16
|
-
|
17
16
|
include Isolation
|
18
17
|
include Content
|
19
18
|
include Template
|
20
19
|
|
21
|
-
requires_ancestor { Kernel }
|
22
|
-
|
23
20
|
#: (singleton(Tapioca::Dsl::Compiler) compiler_class) -> void
|
24
21
|
def use_dsl_compiler(compiler_class)
|
25
22
|
@context = CompilerContext.new(compiler_class) #: CompilerContext?
|
@@ -28,12 +28,9 @@ module Tapioca
|
|
28
28
|
Marshal.load(serialized)
|
29
29
|
end
|
30
30
|
|
31
|
+
# @requires_ancestor: Kernel
|
31
32
|
module Forking
|
32
33
|
extend T::Sig
|
33
|
-
extend T::Helpers
|
34
|
-
|
35
|
-
requires_ancestor { Kernel }
|
36
|
-
|
37
34
|
#: ?{ (?) -> untyped } -> String
|
38
35
|
def run_in_isolation(&_blk)
|
39
36
|
read, write = IO.pipe
|
@@ -73,11 +70,9 @@ module Tapioca
|
|
73
70
|
end
|
74
71
|
end
|
75
72
|
|
73
|
+
# @requires_ancestor: Kernel
|
76
74
|
module Subprocess
|
77
75
|
extend T::Sig
|
78
|
-
extend T::Helpers
|
79
|
-
|
80
|
-
requires_ancestor { Kernel }
|
81
76
|
|
82
77
|
ORIG_ARGV = ARGV.dup #: Array[String]
|
83
78
|
|
@@ -4,12 +4,9 @@
|
|
4
4
|
module Tapioca
|
5
5
|
module Helpers
|
6
6
|
module Test
|
7
|
+
# @requires_ancestor: Kernel
|
7
8
|
module Template
|
8
9
|
extend T::Sig
|
9
|
-
extend T::Helpers
|
10
|
-
|
11
|
-
requires_ancestor { Kernel }
|
12
|
-
|
13
10
|
ERB_SUPPORTS_KVARGS = ::ERB.instance_method(:initialize).parameters.assoc(:key) #: [Symbol, Symbol]?
|
14
11
|
|
15
12
|
#: (String selector) -> bool
|
@@ -3,18 +3,16 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Loaders
|
6
|
+
# @abstract
|
6
7
|
class Loader
|
7
8
|
extend T::Sig
|
8
|
-
extend T::Helpers
|
9
|
-
|
10
9
|
include Thor::Base
|
11
10
|
include CliHelper
|
12
11
|
include Tapioca::GemHelper
|
13
12
|
|
14
|
-
abstract
|
15
|
-
|
16
|
-
|
17
|
-
def load; end
|
13
|
+
# @abstract
|
14
|
+
#: -> void
|
15
|
+
def load = raise NotImplementedError, "Abstract method called"
|
18
16
|
|
19
17
|
private
|
20
18
|
|
data/lib/tapioca/repo_index.rb
CHANGED
@@ -7,12 +7,9 @@ module Tapioca
|
|
7
7
|
# older than 3.2. Because the Class#attached_object method is not
|
8
8
|
# available, it implements finding the attached class of a singleton
|
9
9
|
# class by iterating through ObjectSpace.
|
10
|
+
# @requires_ancestor: Tapioca::Runtime::Reflection
|
10
11
|
module AttachedClassOf
|
11
12
|
extend T::Sig
|
12
|
-
extend T::Helpers
|
13
|
-
|
14
|
-
requires_ancestor { Tapioca::Runtime::Reflection }
|
15
|
-
|
16
13
|
#: (Class singleton_class) -> Module?
|
17
14
|
def attached_class_of(singleton_class)
|
18
15
|
# https://stackoverflow.com/a/36622320/98634
|
data/lib/tapioca/version.rb
CHANGED