tapioca 0.10.1 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/lib/tapioca/cli.rb +24 -12
- data/lib/tapioca/commands/annotations.rb +2 -2
- data/lib/tapioca/commands/check_shims.rb +13 -21
- 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 +16 -11
- 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 +48 -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 +52 -48
- 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 +21 -10
- 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/helpers/active_record_column_type_helper.rb +19 -0
- data/lib/tapioca/dsl/helpers/graphql_type_helper.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 +11 -9
- 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 +5 -13
- data/lib/tapioca/helpers/sorbet_helper.rb +3 -5
- 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 +9 -7
- data/lib/tapioca/loaders/gem.rb +2 -2
- data/lib/tapioca/loaders/loader.rb +6 -6
- data/lib/tapioca/rbi_ext/model.rb +8 -5
- data/lib/tapioca/rbi_formatter.rb +2 -2
- data/lib/tapioca/runtime/generic_type_registry.rb +22 -2
- data/lib/tapioca/runtime/reflection.rb +63 -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/static/symbol_loader.rb +3 -3
- data/lib/tapioca/static/symbol_table_parser.rb +6 -0
- data/lib/tapioca/version.rb +1 -1
- data/lib/tapioca.rb +0 -10
- metadata +8 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c5b81fee880c497fca1e34c644d6da53e4f155e45f564c95eb886f0f6c30d69
|
4
|
+
data.tar.gz: d0973ab750b577064e5891c0fbd9dd71ddeb82b54d7d8dfcabad4841052e8d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 105ab9194d3e62657fedff6d0fd78b187980b5084af80be294690c00a86ac1544b29bd9d86951f50072c895516ce1541251ac2ff05cbb3a2acbbee5d0e103b51
|
7
|
+
data.tar.gz: 612f856fd4b36301dbfee4cdd80615ee4a684447ea077037c5a72e1c7c216be7c465aae13a5b4462a8db9889929765703293d2935036d7ac1e94b8d21d4ee5fb
|
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,12 +466,15 @@ 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
|
473
474
|
# Default: development
|
474
475
|
-l, [--list-compilers], [--no-list-compilers] # List all loaded compilers
|
476
|
+
[--app-root=APP_ROOT] # The path to the Rails application
|
477
|
+
# Default: .
|
475
478
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
476
479
|
# Default: sorbet/tapioca/config.yml
|
477
480
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
@@ -634,6 +637,8 @@ There are two main parts to the DSL compiler API: `gather_constants` and `decora
|
|
634
637
|
* The `gather_constants` class method collects all classes (or modules) that should be processed by this specific DSL compiler.
|
635
638
|
* The `decorate` method defines how to generate the necessary RBI definitions for the gathered constants.
|
636
639
|
|
640
|
+
Every compiler must declare the type member `ConstantType` in order for Sorbet to understand what the return type of the `constant` attribute reader is. It needs to be assigned the correct type variable matching the type of constants that `gather_constants` returns. This generic variable allows Sorbet to type-check method calls on the `constant` reader in your `decorate` method. See the Sorbet documentation on [generics](https://sorbet.org/docs/generics) for more information.
|
641
|
+
|
637
642
|
You can now run the new RBI compiler through the normal DSL generation process (your custom compiler will be loaded automatically by Tapioca):
|
638
643
|
|
639
644
|
```shell
|
@@ -817,10 +822,11 @@ dsl:
|
|
817
822
|
exclude: []
|
818
823
|
verify: false
|
819
824
|
quiet: false
|
820
|
-
workers:
|
825
|
+
workers: 2
|
821
826
|
rbi_max_line_length: 120
|
822
827
|
environment: development
|
823
828
|
list_compilers: false
|
829
|
+
app_root: "."
|
824
830
|
gem:
|
825
831
|
outdir: sorbet/rbi/gems
|
826
832
|
file_header: true
|
data/lib/tapioca/cli.rb
CHANGED
@@ -9,6 +9,8 @@ module Tapioca
|
|
9
9
|
|
10
10
|
FILE_HEADER_OPTION_DESC = "Add a \"This file is generated\" header on top of each generated RBI file"
|
11
11
|
|
12
|
+
check_unknown_options!
|
13
|
+
|
12
14
|
class_option :config,
|
13
15
|
aliases: ["-c"],
|
14
16
|
banner: "<config file path>",
|
@@ -37,7 +39,7 @@ module Tapioca
|
|
37
39
|
command = Commands::Configure.new(
|
38
40
|
sorbet_config: SORBET_CONFIG_FILE,
|
39
41
|
tapioca_config: options[:config],
|
40
|
-
default_postrequire: options[:postrequire]
|
42
|
+
default_postrequire: options[:postrequire],
|
41
43
|
)
|
42
44
|
command.execute
|
43
45
|
end
|
@@ -47,7 +49,7 @@ module Tapioca
|
|
47
49
|
def require
|
48
50
|
command = Commands::Require.new(
|
49
51
|
requires_path: options[:postrequire],
|
50
|
-
sorbet_config_path: SORBET_CONFIG_FILE
|
52
|
+
sorbet_config_path: SORBET_CONFIG_FILE,
|
51
53
|
)
|
52
54
|
Tapioca.silence_warnings do
|
53
55
|
command.execute
|
@@ -66,7 +68,7 @@ module Tapioca
|
|
66
68
|
def todo
|
67
69
|
command = Commands::Todo.new(
|
68
70
|
todo_file: options[:todo_file],
|
69
|
-
file_header: options[:file_header]
|
71
|
+
file_header: options[:file_header],
|
70
72
|
)
|
71
73
|
Tapioca.silence_warnings do
|
72
74
|
command.execute
|
@@ -105,7 +107,8 @@ module Tapioca
|
|
105
107
|
option :workers,
|
106
108
|
aliases: ["-w"],
|
107
109
|
type: :numeric,
|
108
|
-
desc: "Number of parallel workers to use when generating RBIs (default:
|
110
|
+
desc: "Number of parallel workers to use when generating RBIs (default: 2)",
|
111
|
+
default: 2
|
109
112
|
option :rbi_max_line_length,
|
110
113
|
type: :numeric,
|
111
114
|
desc: "Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped",
|
@@ -120,6 +123,10 @@ module Tapioca
|
|
120
123
|
type: :boolean,
|
121
124
|
desc: "List all loaded compilers",
|
122
125
|
default: false
|
126
|
+
option :app_root,
|
127
|
+
type: :string,
|
128
|
+
desc: "The path to the Rails application",
|
129
|
+
default: "."
|
123
130
|
def dsl(*constants)
|
124
131
|
set_environment(options)
|
125
132
|
|
@@ -134,7 +141,8 @@ module Tapioca
|
|
134
141
|
quiet: options[:quiet],
|
135
142
|
verbose: options[:verbose],
|
136
143
|
number_of_workers: options[:workers],
|
137
|
-
rbi_formatter: rbi_formatter(options)
|
144
|
+
rbi_formatter: rbi_formatter(options),
|
145
|
+
app_root: options[:app_root],
|
138
146
|
)
|
139
147
|
|
140
148
|
Tapioca.silence_warnings do
|
@@ -241,7 +249,7 @@ module Tapioca
|
|
241
249
|
number_of_workers: options[:workers],
|
242
250
|
auto_strictness: options[:auto_strictness],
|
243
251
|
dsl_dir: options[:dsl_dir],
|
244
|
-
rbi_formatter: rbi_formatter(options)
|
252
|
+
rbi_formatter: rbi_formatter(options),
|
245
253
|
)
|
246
254
|
|
247
255
|
raise MalformattedArgumentError, "Options '--all' and '--verify' are mutually exclusive" if all && verify
|
@@ -269,8 +277,6 @@ module Tapioca
|
|
269
277
|
option :payload, type: :boolean, desc: "Check shims against Sorbet's payload", default: true
|
270
278
|
option :workers, aliases: ["-w"], type: :numeric, desc: "Number of parallel workers (default: auto)"
|
271
279
|
def check_shims
|
272
|
-
Tapioca.disable_traces
|
273
|
-
|
274
280
|
command = Commands::CheckShims.new(
|
275
281
|
gem_rbi_dir: options[:gem_rbi_dir],
|
276
282
|
dsl_rbi_dir: options[:dsl_rbi_dir],
|
@@ -278,9 +284,12 @@ module Tapioca
|
|
278
284
|
annotations_rbi_dir: options[:annotations_rbi_dir],
|
279
285
|
todo_rbi_file: options[:todo_rbi_file],
|
280
286
|
payload: options[:payload],
|
281
|
-
number_of_workers: options[:workers]
|
287
|
+
number_of_workers: options[:workers],
|
282
288
|
)
|
283
|
-
|
289
|
+
|
290
|
+
Tapioca.silence_warnings do
|
291
|
+
command.execute
|
292
|
+
end
|
284
293
|
end
|
285
294
|
|
286
295
|
desc "annotations", "Pull gem RBI annotations from remote sources"
|
@@ -304,9 +313,12 @@ module Tapioca
|
|
304
313
|
central_repo_root_uris: options[:sources],
|
305
314
|
auth: options[:auth],
|
306
315
|
netrc_file: netrc_file(options),
|
307
|
-
typed_overrides: options[:typed_overrides]
|
316
|
+
typed_overrides: options[:typed_overrides],
|
308
317
|
)
|
309
|
-
|
318
|
+
|
319
|
+
Tapioca.silence_warnings do
|
320
|
+
command.execute
|
321
|
+
end
|
310
322
|
end
|
311
323
|
|
312
324
|
map ["--version", "-v"] => :__print_version
|
@@ -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(
|
@@ -51,26 +51,18 @@ module Tapioca
|
|
51
51
|
payload_path = T.let(nil, T.nilable(String))
|
52
52
|
|
53
53
|
if @payload
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
ERROR
|
64
|
-
end
|
65
|
-
|
66
|
-
index_rbis(index, "payload", payload_path, number_of_workers: @number_of_workers)
|
54
|
+
Dir.mktmpdir do |dir|
|
55
|
+
payload_path = dir
|
56
|
+
result = sorbet("--no-config --print=payload-sources:#{payload_path}")
|
57
|
+
|
58
|
+
unless result.status
|
59
|
+
raise Thor::Error, <<~ERROR
|
60
|
+
"Sorbet failed to dump payload"
|
61
|
+
#{result.err}
|
62
|
+
ERROR
|
67
63
|
end
|
68
|
-
|
69
|
-
|
70
|
-
The version of Sorbet used in your Gemfile.lock does not support `--print=payload-sources`
|
71
|
-
Current: v#{SORBET_GEM_SPEC.version}
|
72
|
-
Required: #{FEATURE_REQUIREMENTS[:print_payload_sources]}
|
73
|
-
ERROR
|
64
|
+
|
65
|
+
index_rbis(index, "payload", payload_path, number_of_workers: @number_of_workers)
|
74
66
|
end
|
75
67
|
end
|
76
68
|
|
@@ -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,8 @@ 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
|
+
app_root: String,
|
25
26
|
).void
|
26
27
|
end
|
27
28
|
def initialize(
|
@@ -37,7 +38,8 @@ module Tapioca
|
|
37
38
|
number_of_workers: nil,
|
38
39
|
auto_strictness: true,
|
39
40
|
gem_dir: DEFAULT_GEM_DIR,
|
40
|
-
rbi_formatter: DEFAULT_RBI_FORMATTER
|
41
|
+
rbi_formatter: DEFAULT_RBI_FORMATTER,
|
42
|
+
app_root: "."
|
41
43
|
)
|
42
44
|
@requested_constants = requested_constants
|
43
45
|
@outpath = outpath
|
@@ -52,6 +54,7 @@ module Tapioca
|
|
52
54
|
@auto_strictness = auto_strictness
|
53
55
|
@gem_dir = gem_dir
|
54
56
|
@rbi_formatter = rbi_formatter
|
57
|
+
@app_root = app_root
|
55
58
|
|
56
59
|
super()
|
57
60
|
end
|
@@ -60,7 +63,8 @@ module Tapioca
|
|
60
63
|
def list_compilers
|
61
64
|
Loaders::Dsl.load_application(
|
62
65
|
tapioca_path: @tapioca_path,
|
63
|
-
eager_load: @requested_constants.empty
|
66
|
+
eager_load: @requested_constants.empty?,
|
67
|
+
app_root: @app_root,
|
64
68
|
)
|
65
69
|
|
66
70
|
pipeline = create_pipeline
|
@@ -86,7 +90,8 @@ module Tapioca
|
|
86
90
|
def execute
|
87
91
|
Loaders::Dsl.load_application(
|
88
92
|
tapioca_path: @tapioca_path,
|
89
|
-
eager_load: @requested_constants.empty
|
93
|
+
eager_load: @requested_constants.empty?,
|
94
|
+
app_root: @app_root,
|
90
95
|
)
|
91
96
|
|
92
97
|
if @should_verify
|
@@ -112,7 +117,7 @@ module Tapioca
|
|
112
117
|
constant_name,
|
113
118
|
contents,
|
114
119
|
outpath: outpath,
|
115
|
-
quiet: @should_verify || (@quiet && !@verbose)
|
120
|
+
quiet: @should_verify || (@quiet && !@verbose),
|
116
121
|
)
|
117
122
|
end
|
118
123
|
|
@@ -133,7 +138,7 @@ module Tapioca
|
|
133
138
|
gem_dir: @gem_dir,
|
134
139
|
dsl_dir: @outpath.to_s,
|
135
140
|
auto_strictness: @auto_strictness,
|
136
|
-
compilers: pipeline.active_compilers
|
141
|
+
compilers: pipeline.active_compilers,
|
137
142
|
)
|
138
143
|
end
|
139
144
|
|
@@ -153,7 +158,7 @@ module Tapioca
|
|
153
158
|
error_handler: ->(error) {
|
154
159
|
say_error(error, :bold, :red)
|
155
160
|
},
|
156
|
-
number_of_workers: @number_of_workers
|
161
|
+
number_of_workers: @number_of_workers,
|
157
162
|
)
|
158
163
|
end
|
159
164
|
|
@@ -230,7 +235,7 @@ module Tapioca
|
|
230
235
|
constant_name: String,
|
231
236
|
rbi: RBI::File,
|
232
237
|
outpath: Pathname,
|
233
|
-
quiet: T::Boolean
|
238
|
+
quiet: T::Boolean,
|
234
239
|
).returns(T.nilable(Pathname))
|
235
240
|
end
|
236
241
|
def compile_dsl_rbi(constant_name, rbi, outpath: @outpath, quiet: false)
|
@@ -241,7 +246,7 @@ module Tapioca
|
|
241
246
|
@rbi_formatter.write_header!(
|
242
247
|
rbi,
|
243
248
|
generate_command_for(constant_name),
|
244
|
-
reason: "dynamic methods in `#{constant_name}`"
|
249
|
+
reason: "dynamic methods in `#{constant_name}`",
|
245
250
|
) if @file_header
|
246
251
|
|
247
252
|
rbi_string = @rbi_formatter.print_file(rbi)
|
@@ -328,7 +333,7 @@ module Tapioca
|
|
328
333
|
|
329
334
|
raise Thor::Error, <<~ERROR
|
330
335
|
#{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
|
331
|
-
#{set_color("`#{default_command(command)}`",
|
336
|
+
#{set_color("`#{default_command(command)}`", :green, :bold)}
|
332
337
|
#{set_color("Once it is complete, be sure to commit and push any changes", :green)}
|
333
338
|
|
334
339
|
#{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
|