tapioca 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/tapioca/cli.rb +9 -10
- data/lib/tapioca/commands/annotations.rb +2 -2
- data/lib/tapioca/commands/check_shims.rb +2 -2
- data/lib/tapioca/commands/command.rb +2 -2
- data/lib/tapioca/commands/command_without_tracker.rb +18 -0
- data/lib/tapioca/commands/configure.rb +3 -3
- data/lib/tapioca/commands/dsl.rb +10 -10
- data/lib/tapioca/commands/gem.rb +5 -5
- data/lib/tapioca/commands/require.rb +2 -2
- data/lib/tapioca/commands/todo.rb +2 -2
- data/lib/tapioca/commands.rb +1 -0
- data/lib/tapioca/dsl/compiler.rb +3 -3
- data/lib/tapioca/dsl/compilers/aasm.rb +4 -4
- data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -1
- data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_job.rb +2 -2
- data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_associations.rb +13 -13
- data/lib/tapioca/dsl/compilers/active_record_columns.rb +22 -22
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +49 -39
- data/lib/tapioca/dsl/compilers/active_record_scope.rb +3 -3
- data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +2 -2
- data/lib/tapioca/dsl/compilers/active_storage.rb +2 -2
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -1
- data/lib/tapioca/dsl/compilers/config.rb +2 -2
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -0
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -0
- data/lib/tapioca/dsl/compilers/identity_cache.rb +12 -12
- data/lib/tapioca/dsl/compilers/protobuf.rb +9 -9
- data/lib/tapioca/dsl/compilers/rails_generators.rb +2 -2
- data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -1
- data/lib/tapioca/dsl/compilers/smart_properties.rb +2 -2
- data/lib/tapioca/dsl/compilers/state_machines.rb +24 -24
- data/lib/tapioca/dsl/compilers/url_helpers.rb +1 -1
- data/lib/tapioca/dsl/compilers.rb +1 -1
- data/lib/tapioca/dsl/pipeline.rb +5 -4
- data/lib/tapioca/executor.rb +2 -2
- data/lib/tapioca/gem/events.rb +1 -1
- data/lib/tapioca/gem/listeners/foreign_constants.rb +3 -2
- data/lib/tapioca/gem/listeners/methods.rb +3 -3
- data/lib/tapioca/gem/listeners/mixins.rb +3 -7
- data/lib/tapioca/gem/listeners/source_location.rb +1 -1
- data/lib/tapioca/gem/listeners/subconstants.rb +1 -1
- data/lib/tapioca/gem/listeners/yard_doc.rb +1 -1
- data/lib/tapioca/gem/pipeline.rb +7 -3
- data/lib/tapioca/gemfile.rb +4 -4
- data/lib/tapioca/helpers/config_helper.rb +4 -4
- data/lib/tapioca/helpers/env_helper.rb +1 -0
- data/lib/tapioca/helpers/gem_helper.rb +17 -5
- data/lib/tapioca/helpers/rbi_files_helper.rb +3 -3
- data/lib/tapioca/helpers/rbi_helper.rb +1 -1
- data/lib/tapioca/helpers/sorbet_helper.rb +2 -2
- data/lib/tapioca/helpers/source_uri.rb +1 -1
- data/lib/tapioca/helpers/test/dsl_compiler.rb +1 -1
- data/lib/tapioca/loaders/dsl.rb +1 -1
- data/lib/tapioca/loaders/gem.rb +2 -2
- data/lib/tapioca/loaders/loader.rb +1 -1
- data/lib/tapioca/rbi_ext/model.rb +3 -3
- data/lib/tapioca/rbi_formatter.rb +2 -2
- data/lib/tapioca/runtime/generic_type_registry.rb +22 -2
- data/lib/tapioca/runtime/reflection.rb +8 -2
- data/lib/tapioca/runtime/trackers/autoload.rb +3 -0
- data/lib/tapioca/runtime/trackers/constant_definition.rb +13 -5
- data/lib/tapioca/runtime/trackers/mixin.rb +37 -36
- data/lib/tapioca/runtime/trackers/required_ancestor.rb +17 -4
- data/lib/tapioca/runtime/trackers/tracker.rb +45 -0
- data/lib/tapioca/runtime/trackers.rb +27 -1
- data/lib/tapioca/sorbet_ext/generic_name_patch.rb +17 -6
- data/lib/tapioca/version.rb +1 -1
- data/lib/tapioca.rb +0 -10
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f969345b0846479b6ab150b42641cbe90a746c59f4d995f10b4cb2dbdcaf588
|
4
|
+
data.tar.gz: a3dcf9bc8b505fb6be05da572b00a0efbb3f544ce7dd2303a55ed2119b34deef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 103484877f92cdb0c43d74b2b92462a977082b959ad26a2ed198895941e2e066961884f207eb167db8d6f86b941075b1216bac13d99f69ff6eb85e7bef3f7760
|
7
|
+
data.tar.gz: 2c11680ac5c9be37fb25b8c944e641f471c59bcb95e0e7f427d5839b56702730468e7afc71f8db22efefcad4f04ffad7a66ad15a981a9097b7217df51ca89d2b
|
data/README.md
CHANGED
@@ -198,7 +198,7 @@ generate RBIs from gems
|
|
198
198
|
```
|
199
199
|
<!-- END_HELP_COMMAND_GEM -->
|
200
200
|
|
201
|
-
By default, running `tapioca gem` will only generate the RBI files for gems that have been added to or removed from the project's `Gemfile` this means that Tapioca will not regenerate the RBI files for untouched gems. However, when changing Tapioca configuration or bumping its version, it may be useful to force the regeneration of the RBI files
|
201
|
+
By default, running `tapioca gem` will only generate the RBI files for gems that have been added to or removed from the project's `Gemfile` this means that Tapioca will not regenerate the RBI files for untouched gems. However, when changing Tapioca configuration or bumping its version, it may be useful to force the regeneration of the RBI files previously generated. This can be done with the `--all` option:
|
202
202
|
|
203
203
|
```shell
|
204
204
|
bin/tapioca gems --all
|
@@ -466,7 +466,8 @@ Options:
|
|
466
466
|
[--exclude=compiler [compiler ...]] # Exclude supplied DSL compiler(s)
|
467
467
|
[--verify], [--no-verify] # Verifies RBIs are up-to-date
|
468
468
|
-q, [--quiet], [--no-quiet] # Suppresses file creation output
|
469
|
-
-w, [--workers=N] # Number of parallel workers to use when generating RBIs (default:
|
469
|
+
-w, [--workers=N] # Number of parallel workers to use when generating RBIs (default: 2)
|
470
|
+
# Default: 2
|
470
471
|
[--rbi-max-line-length=N] # Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped
|
471
472
|
# Default: 120
|
472
473
|
-e, [--environment=ENVIRONMENT] # The Rack/Rails environment to use when generating RBIs
|
@@ -817,7 +818,7 @@ dsl:
|
|
817
818
|
exclude: []
|
818
819
|
verify: false
|
819
820
|
quiet: false
|
820
|
-
workers:
|
821
|
+
workers: 2
|
821
822
|
rbi_max_line_length: 120
|
822
823
|
environment: development
|
823
824
|
list_compilers: false
|
data/lib/tapioca/cli.rb
CHANGED
@@ -37,7 +37,7 @@ module Tapioca
|
|
37
37
|
command = Commands::Configure.new(
|
38
38
|
sorbet_config: SORBET_CONFIG_FILE,
|
39
39
|
tapioca_config: options[:config],
|
40
|
-
default_postrequire: options[:postrequire]
|
40
|
+
default_postrequire: options[:postrequire],
|
41
41
|
)
|
42
42
|
command.execute
|
43
43
|
end
|
@@ -47,7 +47,7 @@ module Tapioca
|
|
47
47
|
def require
|
48
48
|
command = Commands::Require.new(
|
49
49
|
requires_path: options[:postrequire],
|
50
|
-
sorbet_config_path: SORBET_CONFIG_FILE
|
50
|
+
sorbet_config_path: SORBET_CONFIG_FILE,
|
51
51
|
)
|
52
52
|
Tapioca.silence_warnings do
|
53
53
|
command.execute
|
@@ -66,7 +66,7 @@ module Tapioca
|
|
66
66
|
def todo
|
67
67
|
command = Commands::Todo.new(
|
68
68
|
todo_file: options[:todo_file],
|
69
|
-
file_header: options[:file_header]
|
69
|
+
file_header: options[:file_header],
|
70
70
|
)
|
71
71
|
Tapioca.silence_warnings do
|
72
72
|
command.execute
|
@@ -105,7 +105,8 @@ module Tapioca
|
|
105
105
|
option :workers,
|
106
106
|
aliases: ["-w"],
|
107
107
|
type: :numeric,
|
108
|
-
desc: "Number of parallel workers to use when generating RBIs (default:
|
108
|
+
desc: "Number of parallel workers to use when generating RBIs (default: 2)",
|
109
|
+
default: 2
|
109
110
|
option :rbi_max_line_length,
|
110
111
|
type: :numeric,
|
111
112
|
desc: "Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped",
|
@@ -134,7 +135,7 @@ module Tapioca
|
|
134
135
|
quiet: options[:quiet],
|
135
136
|
verbose: options[:verbose],
|
136
137
|
number_of_workers: options[:workers],
|
137
|
-
rbi_formatter: rbi_formatter(options)
|
138
|
+
rbi_formatter: rbi_formatter(options),
|
138
139
|
)
|
139
140
|
|
140
141
|
Tapioca.silence_warnings do
|
@@ -241,7 +242,7 @@ module Tapioca
|
|
241
242
|
number_of_workers: options[:workers],
|
242
243
|
auto_strictness: options[:auto_strictness],
|
243
244
|
dsl_dir: options[:dsl_dir],
|
244
|
-
rbi_formatter: rbi_formatter(options)
|
245
|
+
rbi_formatter: rbi_formatter(options),
|
245
246
|
)
|
246
247
|
|
247
248
|
raise MalformattedArgumentError, "Options '--all' and '--verify' are mutually exclusive" if all && verify
|
@@ -269,8 +270,6 @@ module Tapioca
|
|
269
270
|
option :payload, type: :boolean, desc: "Check shims against Sorbet's payload", default: true
|
270
271
|
option :workers, aliases: ["-w"], type: :numeric, desc: "Number of parallel workers (default: auto)"
|
271
272
|
def check_shims
|
272
|
-
Tapioca.disable_traces
|
273
|
-
|
274
273
|
command = Commands::CheckShims.new(
|
275
274
|
gem_rbi_dir: options[:gem_rbi_dir],
|
276
275
|
dsl_rbi_dir: options[:dsl_rbi_dir],
|
@@ -278,7 +277,7 @@ module Tapioca
|
|
278
277
|
annotations_rbi_dir: options[:annotations_rbi_dir],
|
279
278
|
todo_rbi_file: options[:todo_rbi_file],
|
280
279
|
payload: options[:payload],
|
281
|
-
number_of_workers: options[:workers]
|
280
|
+
number_of_workers: options[:workers],
|
282
281
|
)
|
283
282
|
command.execute
|
284
283
|
end
|
@@ -304,7 +303,7 @@ module Tapioca
|
|
304
303
|
central_repo_root_uris: options[:sources],
|
305
304
|
auth: options[:auth],
|
306
305
|
netrc_file: netrc_file(options),
|
307
|
-
typed_overrides: options[:typed_overrides]
|
306
|
+
typed_overrides: options[:typed_overrides],
|
308
307
|
)
|
309
308
|
command.execute
|
310
309
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
-
class Annotations <
|
6
|
+
class Annotations < CommandWithoutTracker
|
7
7
|
extend T::Sig
|
8
8
|
|
9
9
|
sig do
|
@@ -12,7 +12,7 @@ module Tapioca
|
|
12
12
|
auth: T.nilable(String),
|
13
13
|
netrc_file: T.nilable(String),
|
14
14
|
central_repo_index_path: String,
|
15
|
-
typed_overrides: T::Hash[String, String]
|
15
|
+
typed_overrides: T::Hash[String, String],
|
16
16
|
).void
|
17
17
|
end
|
18
18
|
def initialize(
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
-
class CheckShims <
|
6
|
+
class CheckShims < CommandWithoutTracker
|
7
7
|
extend T::Sig
|
8
8
|
include SorbetHelper
|
9
9
|
include RBIFilesHelper
|
@@ -16,7 +16,7 @@ module Tapioca
|
|
16
16
|
shim_rbi_dir: String,
|
17
17
|
todo_rbi_file: String,
|
18
18
|
payload: T::Boolean,
|
19
|
-
number_of_workers: T.nilable(Integer)
|
19
|
+
number_of_workers: T.nilable(Integer),
|
20
20
|
).void
|
21
21
|
end
|
22
22
|
def initialize(
|
@@ -40,7 +40,7 @@ module Tapioca
|
|
40
40
|
content: String,
|
41
41
|
force: T::Boolean,
|
42
42
|
skip: T::Boolean,
|
43
|
-
verbose: T::Boolean
|
43
|
+
verbose: T::Boolean,
|
44
44
|
).void
|
45
45
|
end
|
46
46
|
def create_file(path, content, force: true, skip: false, verbose: true)
|
@@ -50,7 +50,7 @@ module Tapioca
|
|
50
50
|
sig do
|
51
51
|
params(
|
52
52
|
path: T.any(String, Pathname),
|
53
|
-
verbose: T::Boolean
|
53
|
+
verbose: T::Boolean,
|
54
54
|
).void
|
55
55
|
end
|
56
56
|
def remove_file(path, verbose: true)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Tapioca
|
5
|
+
module Commands
|
6
|
+
class CommandWithoutTracker < Command
|
7
|
+
extend T::Helpers
|
8
|
+
|
9
|
+
abstract!
|
10
|
+
|
11
|
+
sig { void }
|
12
|
+
def initialize
|
13
|
+
Tapioca::Runtime::Trackers.disable_all!
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
-
class Configure <
|
6
|
+
class Configure < CommandWithoutTracker
|
7
7
|
sig do
|
8
8
|
params(
|
9
9
|
sorbet_config: String,
|
10
10
|
tapioca_config: String,
|
11
|
-
default_postrequire: String
|
11
|
+
default_postrequire: String,
|
12
12
|
).void
|
13
13
|
end
|
14
14
|
def initialize(
|
@@ -83,7 +83,7 @@ module Tapioca
|
|
83
83
|
say_status(
|
84
84
|
force ? :force : :create,
|
85
85
|
Tapioca::BINARY_FILE,
|
86
|
-
force ? :yellow : :green
|
86
|
+
force ? :yellow : :green,
|
87
87
|
)
|
88
88
|
end
|
89
89
|
|
data/lib/tapioca/commands/dsl.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
-
class Dsl <
|
6
|
+
class Dsl < CommandWithoutTracker
|
7
7
|
include SorbetHelper
|
8
8
|
include RBIFilesHelper
|
9
9
|
|
@@ -21,7 +21,7 @@ module Tapioca
|
|
21
21
|
number_of_workers: T.nilable(Integer),
|
22
22
|
auto_strictness: T::Boolean,
|
23
23
|
gem_dir: String,
|
24
|
-
rbi_formatter: RBIFormatter
|
24
|
+
rbi_formatter: RBIFormatter,
|
25
25
|
).void
|
26
26
|
end
|
27
27
|
def initialize(
|
@@ -60,7 +60,7 @@ module Tapioca
|
|
60
60
|
def list_compilers
|
61
61
|
Loaders::Dsl.load_application(
|
62
62
|
tapioca_path: @tapioca_path,
|
63
|
-
eager_load: @requested_constants.empty
|
63
|
+
eager_load: @requested_constants.empty?,
|
64
64
|
)
|
65
65
|
|
66
66
|
pipeline = create_pipeline
|
@@ -86,7 +86,7 @@ module Tapioca
|
|
86
86
|
def execute
|
87
87
|
Loaders::Dsl.load_application(
|
88
88
|
tapioca_path: @tapioca_path,
|
89
|
-
eager_load: @requested_constants.empty
|
89
|
+
eager_load: @requested_constants.empty?,
|
90
90
|
)
|
91
91
|
|
92
92
|
if @should_verify
|
@@ -112,7 +112,7 @@ module Tapioca
|
|
112
112
|
constant_name,
|
113
113
|
contents,
|
114
114
|
outpath: outpath,
|
115
|
-
quiet: @should_verify || (@quiet && !@verbose)
|
115
|
+
quiet: @should_verify || (@quiet && !@verbose),
|
116
116
|
)
|
117
117
|
end
|
118
118
|
|
@@ -133,7 +133,7 @@ module Tapioca
|
|
133
133
|
gem_dir: @gem_dir,
|
134
134
|
dsl_dir: @outpath.to_s,
|
135
135
|
auto_strictness: @auto_strictness,
|
136
|
-
compilers: pipeline.active_compilers
|
136
|
+
compilers: pipeline.active_compilers,
|
137
137
|
)
|
138
138
|
end
|
139
139
|
|
@@ -153,7 +153,7 @@ module Tapioca
|
|
153
153
|
error_handler: ->(error) {
|
154
154
|
say_error(error, :bold, :red)
|
155
155
|
},
|
156
|
-
number_of_workers: @number_of_workers
|
156
|
+
number_of_workers: @number_of_workers,
|
157
157
|
)
|
158
158
|
end
|
159
159
|
|
@@ -230,7 +230,7 @@ module Tapioca
|
|
230
230
|
constant_name: String,
|
231
231
|
rbi: RBI::File,
|
232
232
|
outpath: Pathname,
|
233
|
-
quiet: T::Boolean
|
233
|
+
quiet: T::Boolean,
|
234
234
|
).returns(T.nilable(Pathname))
|
235
235
|
end
|
236
236
|
def compile_dsl_rbi(constant_name, rbi, outpath: @outpath, quiet: false)
|
@@ -241,7 +241,7 @@ module Tapioca
|
|
241
241
|
@rbi_formatter.write_header!(
|
242
242
|
rbi,
|
243
243
|
generate_command_for(constant_name),
|
244
|
-
reason: "dynamic methods in `#{constant_name}`"
|
244
|
+
reason: "dynamic methods in `#{constant_name}`",
|
245
245
|
) if @file_header
|
246
246
|
|
247
247
|
rbi_string = @rbi_formatter.print_file(rbi)
|
@@ -328,7 +328,7 @@ module Tapioca
|
|
328
328
|
|
329
329
|
raise Thor::Error, <<~ERROR
|
330
330
|
#{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
|
331
|
-
#{set_color("`#{default_command(command)}`",
|
331
|
+
#{set_color("`#{default_command(command)}`", :green, :bold)}
|
332
332
|
#{set_color("Once it is complete, be sure to commit and push any changes", :green)}
|
333
333
|
|
334
334
|
#{set_color("Reason:", :red)}
|
data/lib/tapioca/commands/gem.rb
CHANGED
@@ -22,7 +22,7 @@ module Tapioca
|
|
22
22
|
number_of_workers: T.nilable(Integer),
|
23
23
|
auto_strictness: T::Boolean,
|
24
24
|
dsl_dir: String,
|
25
|
-
rbi_formatter: RBIFormatter
|
25
|
+
rbi_formatter: RBIFormatter,
|
26
26
|
).void
|
27
27
|
end
|
28
28
|
def initialize(
|
@@ -91,7 +91,7 @@ module Tapioca
|
|
91
91
|
gem_dir: @outpath.to_s,
|
92
92
|
dsl_dir: @dsl_dir,
|
93
93
|
auto_strictness: @auto_strictness,
|
94
|
-
gems: @bundle.dependencies
|
94
|
+
gems: @bundle.dependencies,
|
95
95
|
)
|
96
96
|
|
97
97
|
say("All operations performed in working directory.", [:green, :bold])
|
@@ -121,7 +121,7 @@ module Tapioca
|
|
121
121
|
gem_dir: @outpath.to_s,
|
122
122
|
dsl_dir: @dsl_dir,
|
123
123
|
auto_strictness: @auto_strictness,
|
124
|
-
gems: @bundle.dependencies
|
124
|
+
gems: @bundle.dependencies,
|
125
125
|
)
|
126
126
|
|
127
127
|
say("All operations performed in working directory.", [:green, :bold])
|
@@ -158,7 +158,7 @@ module Tapioca
|
|
158
158
|
|
159
159
|
@rbi_formatter.write_header!(rbi,
|
160
160
|
default_command(:gem, gem.name),
|
161
|
-
reason: "types exported from the `#{gem.name}` gem"
|
161
|
+
reason: "types exported from the `#{gem.name}` gem") if @file_header
|
162
162
|
|
163
163
|
rbi.root = Tapioca::Gem::Pipeline.new(gem, include_doc: @include_doc, include_loc: @include_loc).compile
|
164
164
|
|
@@ -305,7 +305,7 @@ module Tapioca
|
|
305
305
|
|
306
306
|
raise Thor::Error, <<~ERROR
|
307
307
|
#{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
|
308
|
-
#{set_color("`#{default_command(command)}`",
|
308
|
+
#{set_color("`#{default_command(command)}`", :green, :bold)}
|
309
309
|
#{set_color("Once it is complete, be sure to commit and push any changes", :green)}
|
310
310
|
|
311
311
|
#{set_color("Reason:", :red)}
|
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
-
class Require <
|
6
|
+
class Require < CommandWithoutTracker
|
7
7
|
sig do
|
8
8
|
params(
|
9
9
|
requires_path: String,
|
10
|
-
sorbet_config_path: String
|
10
|
+
sorbet_config_path: String,
|
11
11
|
).void
|
12
12
|
end
|
13
13
|
def initialize(requires_path:, sorbet_config_path:)
|
@@ -3,13 +3,13 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
|
-
class Todo <
|
6
|
+
class Todo < CommandWithoutTracker
|
7
7
|
include SorbetHelper
|
8
8
|
|
9
9
|
sig do
|
10
10
|
params(
|
11
11
|
todo_file: String,
|
12
|
-
file_header: T::Boolean
|
12
|
+
file_header: T::Boolean,
|
13
13
|
).void
|
14
14
|
end
|
15
15
|
def initialize(todo_file:, file_header:)
|
data/lib/tapioca/commands.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
module Tapioca
|
5
5
|
module Commands
|
6
6
|
autoload :Command, "tapioca/commands/command"
|
7
|
+
autoload :CommandWithoutTracker, "tapioca/commands/command_without_tracker"
|
7
8
|
autoload :Annotations, "tapioca/commands/annotations"
|
8
9
|
autoload :CheckShims, "tapioca/commands/check_shims"
|
9
10
|
autoload :Dsl, "tapioca/commands/dsl"
|
data/lib/tapioca/dsl/compiler.rb
CHANGED
@@ -37,7 +37,7 @@ module Tapioca
|
|
37
37
|
def processable_constants
|
38
38
|
@processable_constants ||= T.let(
|
39
39
|
T::Set[Module].new(gather_constants).compare_by_identity,
|
40
|
-
T.nilable(T::Set[Module])
|
40
|
+
T.nilable(T::Set[Module]),
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
@@ -84,7 +84,7 @@ module Tapioca
|
|
84
84
|
sig do
|
85
85
|
params(
|
86
86
|
method_def: T.any(Method, UnboundMethod),
|
87
|
-
signature: T.untyped # as `T::Private::Methods::Signature` is private
|
87
|
+
signature: T.untyped, # as `T::Private::Methods::Signature` is private
|
88
88
|
).returns(T::Array[String])
|
89
89
|
end
|
90
90
|
def parameters_types_from_signature(method_def, signature)
|
@@ -115,7 +115,7 @@ module Tapioca
|
|
115
115
|
method_def.name.to_s,
|
116
116
|
parameters: compile_method_parameters_to_rbi(method_def),
|
117
117
|
return_type: compile_method_return_type_to_rbi(method_def),
|
118
|
-
class_method: class_method
|
118
|
+
class_method: class_method,
|
119
119
|
)
|
120
120
|
end
|
121
121
|
|
@@ -46,7 +46,7 @@ module Tapioca
|
|
46
46
|
T.let(
|
47
47
|
["after", "after_commit", "after_transaction", "before", "before_transaction", "ensure", "error",
|
48
48
|
"before_success", "success",].freeze,
|
49
|
-
T::Array[String]
|
49
|
+
T::Array[String],
|
50
50
|
)
|
51
51
|
|
52
52
|
ConstantType = type_member { { fixed: T.all(::AASM::ClassMethods, Class) } }
|
@@ -81,7 +81,7 @@ module Tapioca
|
|
81
81
|
create_block_param("block", type: "T.nilable(T.proc.bind(PrivateAASMMachine).void)"),
|
82
82
|
],
|
83
83
|
return_type: "PrivateAASMMachine",
|
84
|
-
class_method: true
|
84
|
+
class_method: true,
|
85
85
|
)
|
86
86
|
|
87
87
|
# Create a private machine class that we can pass around for the
|
@@ -94,7 +94,7 @@ module Tapioca
|
|
94
94
|
create_param("name", type: "T.untyped"),
|
95
95
|
create_opt_param("options", default: "nil", type: "T.untyped"),
|
96
96
|
create_block_param("block", type: "T.proc.bind(PrivateAASMEvent).void"),
|
97
|
-
]
|
97
|
+
],
|
98
98
|
)
|
99
99
|
|
100
100
|
# Create a private event class that we can pass around for the
|
@@ -107,7 +107,7 @@ module Tapioca
|
|
107
107
|
parameters: [
|
108
108
|
create_opt_param("symbol", type: "T.nilable(Symbol)", default: "nil"),
|
109
109
|
create_block_param("block", type: "T.nilable(T.proc.bind(#{name_of(constant)}).void)"),
|
110
|
-
]
|
110
|
+
],
|
111
111
|
)
|
112
112
|
end
|
113
113
|
end
|
@@ -55,14 +55,14 @@ module Tapioca
|
|
55
55
|
"perform_later",
|
56
56
|
parameters: parameters,
|
57
57
|
return_type: "T.any(#{name_of(constant)}, FalseClass)",
|
58
|
-
class_method: true
|
58
|
+
class_method: true,
|
59
59
|
)
|
60
60
|
|
61
61
|
job.create_method(
|
62
62
|
"perform_now",
|
63
63
|
parameters: parameters,
|
64
64
|
return_type: return_type,
|
65
|
-
class_method: true
|
65
|
+
class_method: true,
|
66
66
|
)
|
67
67
|
end
|
68
68
|
end
|
@@ -152,7 +152,7 @@ module Tapioca
|
|
152
152
|
mod.create_method(
|
153
153
|
"#{association_name}_attributes=",
|
154
154
|
parameters: [create_param("attributes", type: "T.untyped")],
|
155
|
-
return_type: "T.untyped"
|
155
|
+
return_type: "T.untyped",
|
156
156
|
)
|
157
157
|
end
|
158
158
|
end
|
@@ -180,7 +180,7 @@ module Tapioca
|
|
180
180
|
params(
|
181
181
|
klass: RBI::Scope,
|
182
182
|
association_name: T.any(String, Symbol),
|
183
|
-
reflection: ReflectionType
|
183
|
+
reflection: ReflectionType,
|
184
184
|
).void
|
185
185
|
end
|
186
186
|
def populate_single_assoc_getter_setter(klass, association_name, reflection)
|
@@ -194,7 +194,7 @@ module Tapioca
|
|
194
194
|
klass.create_method(
|
195
195
|
"#{association_name}=",
|
196
196
|
parameters: [create_param("value", type: association_type)],
|
197
|
-
return_type: "void"
|
197
|
+
return_type: "void",
|
198
198
|
)
|
199
199
|
klass.create_method(
|
200
200
|
"reload_#{association_name}",
|
@@ -207,7 +207,7 @@ module Tapioca
|
|
207
207
|
create_rest_param("args", type: "T.untyped"),
|
208
208
|
create_block_param("blk", type: "T.untyped"),
|
209
209
|
],
|
210
|
-
return_type: association_class
|
210
|
+
return_type: association_class,
|
211
211
|
)
|
212
212
|
klass.create_method(
|
213
213
|
"create_#{association_name}",
|
@@ -215,7 +215,7 @@ module Tapioca
|
|
215
215
|
create_rest_param("args", type: "T.untyped"),
|
216
216
|
create_block_param("blk", type: "T.untyped"),
|
217
217
|
],
|
218
|
-
return_type: association_class
|
218
|
+
return_type: association_class,
|
219
219
|
)
|
220
220
|
klass.create_method(
|
221
221
|
"create_#{association_name}!",
|
@@ -223,7 +223,7 @@ module Tapioca
|
|
223
223
|
create_rest_param("args", type: "T.untyped"),
|
224
224
|
create_block_param("blk", type: "T.untyped"),
|
225
225
|
],
|
226
|
-
return_type: association_class
|
226
|
+
return_type: association_class,
|
227
227
|
)
|
228
228
|
end
|
229
229
|
end
|
@@ -232,7 +232,7 @@ module Tapioca
|
|
232
232
|
params(
|
233
233
|
klass: RBI::Scope,
|
234
234
|
association_name: T.any(String, Symbol),
|
235
|
-
reflection: ReflectionType
|
235
|
+
reflection: ReflectionType,
|
236
236
|
).void
|
237
237
|
end
|
238
238
|
def populate_collection_assoc_getter_setter(klass, association_name, reflection)
|
@@ -250,18 +250,18 @@ module Tapioca
|
|
250
250
|
)
|
251
251
|
klass.create_method(
|
252
252
|
"#{association_name.to_s.singularize}_ids",
|
253
|
-
return_type: "T::Array[T.untyped]"
|
253
|
+
return_type: "T::Array[T.untyped]",
|
254
254
|
)
|
255
255
|
klass.create_method(
|
256
256
|
"#{association_name.to_s.singularize}_ids=",
|
257
257
|
parameters: [create_param("ids", type: "T::Array[T.untyped]")],
|
258
|
-
return_type: "T::Array[T.untyped]"
|
258
|
+
return_type: "T::Array[T.untyped]",
|
259
259
|
)
|
260
260
|
end
|
261
261
|
|
262
262
|
sig do
|
263
263
|
params(
|
264
|
-
reflection: ReflectionType
|
264
|
+
reflection: ReflectionType,
|
265
265
|
).returns(String)
|
266
266
|
end
|
267
267
|
def type_for(reflection)
|
@@ -274,7 +274,7 @@ module Tapioca
|
|
274
274
|
|
275
275
|
sig do
|
276
276
|
params(
|
277
|
-
reflection: ReflectionType
|
277
|
+
reflection: ReflectionType,
|
278
278
|
).void
|
279
279
|
end
|
280
280
|
def validate_reflection!(reflection)
|
@@ -322,7 +322,7 @@ module Tapioca
|
|
322
322
|
|
323
323
|
sig do
|
324
324
|
params(
|
325
|
-
reflection: ReflectionType
|
325
|
+
reflection: ReflectionType,
|
326
326
|
).returns(String)
|
327
327
|
end
|
328
328
|
def relation_type_for(reflection)
|
@@ -346,7 +346,7 @@ module Tapioca
|
|
346
346
|
|
347
347
|
sig do
|
348
348
|
params(
|
349
|
-
reflection: ReflectionType
|
349
|
+
reflection: ReflectionType,
|
350
350
|
).returns(T::Boolean)
|
351
351
|
end
|
352
352
|
def polymorphic_association?(reflection)
|