tapioca 0.16.11 → 0.17.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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby_lsp/tapioca/addon.rb +23 -19
  3. data/lib/ruby_lsp/tapioca/run_gem_rbi_check.rb +20 -20
  4. data/lib/tapioca/bundler_ext/auto_require_hook.rb +5 -10
  5. data/lib/tapioca/commands/abstract_dsl.rb +26 -59
  6. data/lib/tapioca/commands/abstract_gem.rb +23 -43
  7. data/lib/tapioca/commands/annotations.rb +27 -33
  8. data/lib/tapioca/commands/check_shims.rb +4 -13
  9. data/lib/tapioca/commands/command.rb +8 -20
  10. data/lib/tapioca/commands/command_without_tracker.rb +1 -1
  11. data/lib/tapioca/commands/configure.rb +11 -16
  12. data/lib/tapioca/commands/dsl_compiler_list.rb +2 -1
  13. data/lib/tapioca/commands/dsl_generate.rb +2 -1
  14. data/lib/tapioca/commands/dsl_verify.rb +2 -1
  15. data/lib/tapioca/commands/gem_generate.rb +4 -8
  16. data/lib/tapioca/commands/gem_sync.rb +2 -1
  17. data/lib/tapioca/commands/gem_verify.rb +3 -2
  18. data/lib/tapioca/commands/require.rb +3 -7
  19. data/lib/tapioca/commands/todo.rb +6 -10
  20. data/lib/tapioca/dsl/compiler.rb +28 -53
  21. data/lib/tapioca/dsl/compilers/aasm.rb +31 -41
  22. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +7 -5
  23. data/lib/tapioca/dsl/compilers/action_mailer.rb +5 -3
  24. data/lib/tapioca/dsl/compilers/action_text.rb +5 -3
  25. data/lib/tapioca/dsl/compilers/active_job.rb +5 -8
  26. data/lib/tapioca/dsl/compilers/active_model_attributes.rb +9 -7
  27. data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +4 -2
  28. data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +4 -2
  29. data/lib/tapioca/dsl/compilers/active_record_associations.rb +16 -42
  30. data/lib/tapioca/dsl/compilers/active_record_columns.rb +19 -24
  31. data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +7 -5
  32. data/lib/tapioca/dsl/compilers/active_record_enum.rb +6 -4
  33. data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +53 -61
  34. data/lib/tapioca/dsl/compilers/active_record_relations.rb +86 -119
  35. data/lib/tapioca/dsl/compilers/active_record_scope.rb +7 -11
  36. data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +4 -2
  37. data/lib/tapioca/dsl/compilers/active_record_store.rb +4 -2
  38. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +18 -26
  39. data/lib/tapioca/dsl/compilers/active_resource.rb +18 -19
  40. data/lib/tapioca/dsl/compilers/active_storage.rb +5 -5
  41. data/lib/tapioca/dsl/compilers/active_support_concern.rb +8 -6
  42. data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +7 -5
  43. data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +4 -2
  44. data/lib/tapioca/dsl/compilers/config.rb +4 -2
  45. data/lib/tapioca/dsl/compilers/frozen_record.rb +6 -9
  46. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +8 -8
  47. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +5 -8
  48. data/lib/tapioca/dsl/compilers/identity_cache.rb +10 -37
  49. data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +8 -16
  50. data/lib/tapioca/dsl/compilers/kredis.rb +6 -4
  51. data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +4 -2
  52. data/lib/tapioca/dsl/compilers/protobuf.rb +12 -24
  53. data/lib/tapioca/dsl/compilers/rails_generators.rb +8 -9
  54. data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +22 -11
  55. data/lib/tapioca/dsl/compilers/smart_properties.rb +11 -20
  56. data/lib/tapioca/dsl/compilers/state_machines.rb +14 -24
  57. data/lib/tapioca/dsl/compilers/url_helpers.rb +9 -7
  58. data/lib/tapioca/dsl/compilers.rb +4 -7
  59. data/lib/tapioca/dsl/helpers/active_model_type_helper.rb +13 -16
  60. data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +13 -28
  61. data/lib/tapioca/dsl/helpers/active_record_constants_helper.rb +19 -15
  62. data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +5 -24
  63. data/lib/tapioca/dsl/pipeline.rb +23 -55
  64. data/lib/tapioca/executor.rb +6 -12
  65. data/lib/tapioca/gem/events.rb +22 -28
  66. data/lib/tapioca/gem/listeners/base.rb +6 -6
  67. data/lib/tapioca/gem/listeners/dynamic_mixins.rb +4 -2
  68. data/lib/tapioca/gem/listeners/foreign_constants.rb +5 -7
  69. data/lib/tapioca/gem/listeners/methods.rb +15 -34
  70. data/lib/tapioca/gem/listeners/mixins.rb +6 -18
  71. data/lib/tapioca/gem/listeners/remove_empty_payload_scopes.rb +4 -2
  72. data/lib/tapioca/gem/listeners/sorbet_enums.rb +4 -2
  73. data/lib/tapioca/gem/listeners/sorbet_helpers.rb +4 -2
  74. data/lib/tapioca/gem/listeners/sorbet_props.rb +4 -2
  75. data/lib/tapioca/gem/listeners/sorbet_required_ancestors.rb +4 -2
  76. data/lib/tapioca/gem/listeners/sorbet_signatures.rb +7 -5
  77. data/lib/tapioca/gem/listeners/sorbet_type_variables.rb +6 -4
  78. data/lib/tapioca/gem/listeners/source_location.rb +7 -4
  79. data/lib/tapioca/gem/listeners/subconstants.rb +4 -2
  80. data/lib/tapioca/gem/listeners/yard_doc.rb +23 -22
  81. data/lib/tapioca/gem/pipeline.rb +57 -72
  82. data/lib/tapioca/gem_info.rb +1 -1
  83. data/lib/tapioca/gemfile.rb +64 -73
  84. data/lib/tapioca/helpers/cli_helper.rb +3 -3
  85. data/lib/tapioca/helpers/config_helper.rb +15 -24
  86. data/lib/tapioca/helpers/env_helper.rb +1 -1
  87. data/lib/tapioca/helpers/gem_helper.rb +5 -5
  88. data/lib/tapioca/helpers/git_attributes.rb +3 -3
  89. data/lib/tapioca/helpers/rbi_files_helper.rb +73 -67
  90. data/lib/tapioca/helpers/rbi_helper.rb +14 -22
  91. data/lib/tapioca/helpers/sorbet_helper.rb +9 -18
  92. data/lib/tapioca/helpers/source_uri.rb +15 -25
  93. data/lib/tapioca/helpers/test/content.rb +6 -6
  94. data/lib/tapioca/helpers/test/dsl_compiler.rb +19 -29
  95. data/lib/tapioca/helpers/test/isolation.rb +4 -4
  96. data/lib/tapioca/helpers/test/template.rb +5 -7
  97. data/lib/tapioca/internal.rb +5 -1
  98. data/lib/tapioca/loaders/dsl.rb +11 -19
  99. data/lib/tapioca/loaders/gem.rb +6 -21
  100. data/lib/tapioca/loaders/loader.rb +15 -27
  101. data/lib/tapioca/rbi_ext/model.rb +12 -37
  102. data/lib/tapioca/rbi_formatter.rb +10 -19
  103. data/lib/tapioca/rbs/rewriter.rb +55 -0
  104. data/lib/tapioca/repo_index.rb +7 -7
  105. data/lib/tapioca/runtime/attached_class_of_32.rb +1 -1
  106. data/lib/tapioca/runtime/attached_class_of_legacy.rb +1 -1
  107. data/lib/tapioca/runtime/dynamic_mixin_compiler.rb +23 -23
  108. data/lib/tapioca/runtime/generic_type_registry.rb +13 -23
  109. data/lib/tapioca/runtime/reflection.rb +48 -56
  110. data/lib/tapioca/runtime/trackers/autoload.rb +4 -8
  111. data/lib/tapioca/runtime/trackers/mixin.rb +6 -10
  112. data/lib/tapioca/runtime/trackers/required_ancestor.rb +3 -3
  113. data/lib/tapioca/runtime/trackers/tracker.rb +2 -2
  114. data/lib/tapioca/runtime/trackers.rb +4 -8
  115. data/lib/tapioca/sorbet_ext/generic_name_patch.rb +9 -15
  116. data/lib/tapioca/sorbet_ext/name_patch.rb +1 -1
  117. data/lib/tapioca/sorbet_ext/proc_bind_patch.rb +1 -1
  118. data/lib/tapioca/static/requires_compiler.rb +6 -6
  119. data/lib/tapioca/static/symbol_loader.rb +14 -16
  120. data/lib/tapioca/static/symbol_table_parser.rb +8 -8
  121. data/lib/tapioca/version.rb +1 -1
  122. data/lib/tapioca.rb +22 -29
  123. metadata +25 -10
@@ -6,15 +6,7 @@ module Tapioca
6
6
  class Annotations < CommandWithoutTracker
7
7
  extend T::Sig
8
8
 
9
- sig do
10
- params(
11
- central_repo_root_uris: T::Array[String],
12
- auth: T.nilable(String),
13
- netrc_file: T.nilable(String),
14
- central_repo_index_path: String,
15
- typed_overrides: T::Hash[String, String],
16
- ).void
17
- end
9
+ #: (central_repo_root_uris: Array[String], ?auth: String?, ?netrc_file: String?, ?central_repo_index_path: String, ?typed_overrides: Hash[String, String]) -> void
18
10
  def initialize(
19
11
  central_repo_root_uris:,
20
12
  auth: nil,
@@ -23,19 +15,20 @@ module Tapioca
23
15
  typed_overrides: {}
24
16
  )
25
17
  super()
26
- @outpath = T.let(Pathname.new(DEFAULT_ANNOTATIONS_DIR), Pathname)
18
+ @outpath = Pathname.new(DEFAULT_ANNOTATIONS_DIR) #: Pathname
27
19
  @central_repo_root_uris = central_repo_root_uris
28
20
  @auth = auth
29
21
  @netrc_file = netrc_file
30
- @netrc_info = T.let(nil, T.nilable(Netrc))
31
- @tokens = T.let(repo_tokens, T::Hash[String, T.nilable(String)])
32
- @indexes = T.let({}, T::Hash[String, RepoIndex])
22
+ @netrc_info = nil #: Netrc?
23
+ @tokens = repo_tokens #: Hash[String, String?]
24
+ @indexes = {} #: Hash[String, RepoIndex]
33
25
  @typed_overrides = typed_overrides
34
26
  end
35
27
 
36
28
  private
37
29
 
38
- sig { override.void }
30
+ # @override
31
+ #: -> void
39
32
  def execute
40
33
  @indexes = fetch_indexes
41
34
  project_gems = list_gemfile_gems
@@ -46,7 +39,7 @@ module Tapioca
46
39
  GitAttributes.create_vendored_attribute_file(@outpath)
47
40
  end
48
41
 
49
- sig { returns(T::Array[GemInfo]) }
42
+ #: -> Array[GemInfo]
50
43
  def list_gemfile_gems
51
44
  say("Listing gems from Gemfile.lock... ", [:blue, :bold])
52
45
  gemfile = Bundler.read_file("Gemfile.lock")
@@ -56,7 +49,7 @@ module Tapioca
56
49
  gem_info
57
50
  end
58
51
 
59
- sig { params(project_gems: T::Array[GemInfo]).void }
52
+ #: (Array[GemInfo] project_gems) -> void
60
53
  def remove_expired_annotations(project_gems)
61
54
  say("Removing annotations for gems that have been removed... ", [:blue, :bold])
62
55
 
@@ -77,11 +70,11 @@ module Tapioca
77
70
  say("\nDone\n\n", :green)
78
71
  end
79
72
 
80
- sig { returns(T::Hash[String, RepoIndex]) }
73
+ #: -> Hash[String, RepoIndex]
81
74
  def fetch_indexes
82
75
  multiple_repos = @central_repo_root_uris.size > 1
83
76
  repo_number = 1
84
- indexes = T.let({}, T::Hash[String, RepoIndex])
77
+ indexes = {} #: Hash[String, RepoIndex]
85
78
 
86
79
  @central_repo_root_uris.each do |uri|
87
80
  index = fetch_index(uri, repo_number: multiple_repos ? repo_number : nil)
@@ -98,7 +91,7 @@ module Tapioca
98
91
  indexes
99
92
  end
100
93
 
101
- sig { params(repo_uri: String, repo_number: T.nilable(Integer)).returns(T.nilable(RepoIndex)) }
94
+ #: (String repo_uri, repo_number: Integer?) -> RepoIndex?
102
95
  def fetch_index(repo_uri, repo_number:)
103
96
  say("Retrieving index from central repository#{repo_number ? " ##{repo_number}" : ""}... ", [:blue, :bold])
104
97
  content = fetch_file(repo_uri, CENTRAL_REPO_INDEX_PATH)
@@ -109,10 +102,10 @@ module Tapioca
109
102
  index
110
103
  end
111
104
 
112
- sig { params(project_gems: T::Array[GemInfo]).returns(T::Array[String]) }
105
+ #: (Array[GemInfo] project_gems) -> Array[String]
113
106
  def fetch_annotations(project_gems)
114
107
  say("Fetching gem annotations from central repository... ", [:blue, :bold])
115
- fetchable_gems = T.let(Hash.new { |h, k| h[k] = [] }, T::Hash[GemInfo, T::Array[String]])
108
+ fetchable_gems = Hash.new { |h, k| h[k] = [] } #: Hash[GemInfo, Array[String]]
116
109
 
117
110
  project_gems.each_with_object(fetchable_gems) do |gem_info, hash|
118
111
  @indexes.each do |uri, index|
@@ -132,7 +125,7 @@ module Tapioca
132
125
  fetched_gems.keys.map(&:name).sort
133
126
  end
134
127
 
135
- sig { params(repo_uris: T::Array[String], gem_info: GemInfo).void }
128
+ sig { params(repo_uris: T::Array[String], gem_info: GemInfo).returns(T::Boolean) }
136
129
  def fetch_annotation(repo_uris, gem_info)
137
130
  gem_name = gem_info.name
138
131
  gem_version = gem_info.version
@@ -142,7 +135,7 @@ module Tapioca
142
135
  end
143
136
 
144
137
  content = merge_files(gem_name, contents.compact)
145
- return unless content
138
+ return false unless content
146
139
 
147
140
  content = apply_typed_override(gem_name, content)
148
141
  content = filter_versions(gem_version, content)
@@ -150,9 +143,10 @@ module Tapioca
150
143
 
151
144
  say("\n Fetched #{set_color(gem_name, :yellow, :bold)}", :green)
152
145
  create_file(@outpath.join("#{gem_name}.rbi"), content)
146
+ true
153
147
  end
154
148
 
155
- sig { params(repo_uri: String, path: String).returns(T.nilable(String)) }
149
+ #: (String repo_uri, String path) -> String?
156
150
  def fetch_file(repo_uri, path)
157
151
  if repo_uri.start_with?(%r{https?://})
158
152
  fetch_http_file(repo_uri, path)
@@ -161,7 +155,7 @@ module Tapioca
161
155
  end
162
156
  end
163
157
 
164
- sig { params(repo_uri: String, path: String).returns(T.nilable(String)) }
158
+ #: (String repo_uri, String path) -> String?
165
159
  def fetch_local_file(repo_uri, path)
166
160
  File.read("#{repo_uri}/#{path}")
167
161
  rescue => e
@@ -169,7 +163,7 @@ module Tapioca
169
163
  nil
170
164
  end
171
165
 
172
- sig { params(repo_uri: String, path: String).returns(T.nilable(String)) }
166
+ #: (String repo_uri, String path) -> String?
173
167
  def fetch_http_file(repo_uri, path)
174
168
  auth = @tokens[repo_uri]
175
169
  uri = URI("#{repo_uri}/#{path}")
@@ -193,7 +187,7 @@ module Tapioca
193
187
  nil
194
188
  end
195
189
 
196
- sig { params(name: String, content: String).returns(String) }
190
+ #: (String name, String content) -> String
197
191
  def add_header(name, content)
198
192
  # WARNING: Changing this header could impact how GitHub determines if the file should be hidden:
199
193
  # https://github.com/github/linguist/pull/6143
@@ -213,7 +207,7 @@ module Tapioca
213
207
  end
214
208
  end
215
209
 
216
- sig { params(name: String, content: String).returns(String) }
210
+ #: (String name, String content) -> String
217
211
  def apply_typed_override(name, content)
218
212
  strictness = @typed_overrides[name]
219
213
  return content unless strictness
@@ -225,7 +219,7 @@ module Tapioca
225
219
  Spoom::Sorbet::Sigils.update_sigil(content, strictness)
226
220
  end
227
221
 
228
- sig { params(gem_version: ::Gem::Version, content: String).returns(String) }
222
+ #: (::Gem::Version gem_version, String content) -> String
229
223
  def filter_versions(gem_version, content)
230
224
  rbi = RBI::Parser.parse_string(content)
231
225
  rbi.filter_versions!(gem_version)
@@ -233,7 +227,7 @@ module Tapioca
233
227
  rbi.string
234
228
  end
235
229
 
236
- sig { params(gem_name: String, contents: T::Array[String]).returns(T.nilable(String)) }
230
+ #: (String gem_name, Array[String] contents) -> String?
237
231
  def merge_files(gem_name, contents)
238
232
  return if contents.empty?
239
233
 
@@ -260,7 +254,7 @@ module Tapioca
260
254
  nil
261
255
  end
262
256
 
263
- sig { returns(T::Hash[String, T.nilable(String)]) }
257
+ #: -> Hash[String, String?]
264
258
  def repo_tokens
265
259
  @netrc_info = Netrc.read(@netrc_file) if @netrc_file
266
260
  @central_repo_root_uris.filter_map do |uri|
@@ -272,7 +266,7 @@ module Tapioca
272
266
  end.to_h
273
267
  end
274
268
 
275
- sig { params(repo_uri: String).returns(T.nilable(String)) }
269
+ #: (String repo_uri) -> String?
276
270
  def token_for(repo_uri)
277
271
  return unless @netrc_info
278
272
 
@@ -288,7 +282,7 @@ module Tapioca
288
282
  "token #{token}"
289
283
  end
290
284
 
291
- sig { params(path: String, repo_uri: String, message: String).void }
285
+ #: (String path, String repo_uri, message: String) -> void
292
286
  def say_http_error(path, repo_uri, message:)
293
287
  say_error("\nCan't fetch file `#{path}` from #{repo_uri} (#{message})\n\n", :bold, :red)
294
288
  say_error(<<~ERROR)
@@ -8,17 +8,7 @@ module Tapioca
8
8
  include SorbetHelper
9
9
  include RBIFilesHelper
10
10
 
11
- sig do
12
- params(
13
- gem_rbi_dir: String,
14
- dsl_rbi_dir: String,
15
- annotations_rbi_dir: String,
16
- shim_rbi_dir: String,
17
- todo_rbi_file: String,
18
- payload: T::Boolean,
19
- number_of_workers: T.nilable(Integer),
20
- ).void
21
- end
11
+ #: (gem_rbi_dir: String, dsl_rbi_dir: String, annotations_rbi_dir: String, shim_rbi_dir: String, todo_rbi_file: String, payload: bool, number_of_workers: Integer?) -> void
22
12
  def initialize(
23
13
  gem_rbi_dir:,
24
14
  dsl_rbi_dir:,
@@ -40,7 +30,8 @@ module Tapioca
40
30
 
41
31
  private
42
32
 
43
- sig { override.void }
33
+ # @override
34
+ #: -> void
44
35
  def execute
45
36
  index = RBI::Index.new
46
37
 
@@ -50,7 +41,7 @@ module Tapioca
50
41
  return
51
42
  end
52
43
 
53
- payload_path = T.let(nil, T.nilable(String))
44
+ payload_path = nil #: String?
54
45
 
55
46
  if @payload
56
47
  Dir.mktmpdir do |dir|
@@ -16,12 +16,13 @@ module Tapioca
16
16
 
17
17
  abstract!
18
18
 
19
- sig { void }
19
+ #: -> void
20
20
  def initialize
21
- @file_writer = T.let(FileWriter.new, Thor::Actions)
21
+ @file_writer = FileWriter.new #: Thor::Actions
22
22
  end
23
23
 
24
- sig(:final) { void }
24
+ # @final
25
+ #: -> void
25
26
  def run
26
27
  Tapioca.silence_warnings do
27
28
  execute
@@ -33,33 +34,20 @@ module Tapioca
33
34
  sig { abstract.void }
34
35
  def execute; end
35
36
 
36
- sig { params(command: Symbol, args: String).returns(String) }
37
+ #: (Symbol command, *String args) -> String
37
38
  def default_command(command, *args)
38
39
  [Tapioca::BINARY_FILE, command.to_s, *args].join(" ")
39
40
  end
40
41
 
41
- sig { returns(Thor::Actions) }
42
+ #: Thor::Actions
42
43
  attr_reader :file_writer
43
44
 
44
- sig do
45
- params(
46
- path: T.any(String, Pathname),
47
- content: String,
48
- force: T::Boolean,
49
- skip: T::Boolean,
50
- verbose: T::Boolean,
51
- ).void
52
- end
45
+ #: ((String | Pathname) path, String content, ?force: bool, ?skip: bool, ?verbose: bool) -> void
53
46
  def create_file(path, content, force: true, skip: false, verbose: true)
54
47
  file_writer.create_file(path, force: force, skip: skip, verbose: verbose) { content }
55
48
  end
56
49
 
57
- sig do
58
- params(
59
- path: T.any(String, Pathname),
60
- verbose: T::Boolean,
61
- ).void
62
- end
50
+ #: ((String | Pathname) path, ?verbose: bool) -> void
63
51
  def remove_file(path, verbose: true)
64
52
  file_writer.remove_file(path, verbose: verbose)
65
53
  end
@@ -8,7 +8,7 @@ module Tapioca
8
8
 
9
9
  abstract!
10
10
 
11
- sig { void }
11
+ #: -> void
12
12
  def initialize
13
13
  Tapioca::Runtime::Trackers.disable_all!
14
14
  super
@@ -4,13 +4,7 @@
4
4
  module Tapioca
5
5
  module Commands
6
6
  class Configure < CommandWithoutTracker
7
- sig do
8
- params(
9
- sorbet_config: String,
10
- tapioca_config: String,
11
- default_postrequire: String,
12
- ).void
13
- end
7
+ #: (sorbet_config: String, tapioca_config: String, default_postrequire: String) -> void
14
8
  def initialize(
15
9
  sorbet_config:,
16
10
  tapioca_config:,
@@ -22,13 +16,14 @@ module Tapioca
22
16
 
23
17
  super()
24
18
 
25
- @installer = T.let(nil, T.nilable(Bundler::Installer))
26
- @spec = T.let(nil, T.nilable(Bundler::StubSpecification))
19
+ @installer = nil #: Bundler::Installer?
20
+ @spec = nil #: Bundler::StubSpecification?
27
21
  end
28
22
 
29
23
  private
30
24
 
31
- sig { override.void }
25
+ # @override
26
+ #: -> void
32
27
  def execute
33
28
  create_sorbet_config
34
29
  create_tapioca_config
@@ -36,7 +31,7 @@ module Tapioca
36
31
  create_binstub
37
32
  end
38
33
 
39
- sig { void }
34
+ #: -> void
40
35
  def create_sorbet_config
41
36
  create_file(@sorbet_config, <<~CONTENT, skip: true, force: false)
42
37
  --dir
@@ -46,7 +41,7 @@ module Tapioca
46
41
  CONTENT
47
42
  end
48
43
 
49
- sig { void }
44
+ #: -> void
50
45
  def create_tapioca_config
51
46
  create_file(@tapioca_config, <<~YAML, skip: true, force: false)
52
47
  gem:
@@ -65,7 +60,7 @@ module Tapioca
65
60
  YAML
66
61
  end
67
62
 
68
- sig { void }
63
+ #: -> void
69
64
  def create_post_require
70
65
  create_file(@default_postrequire, <<~CONTENT, skip: true, force: false)
71
66
  # typed: true
@@ -75,7 +70,7 @@ module Tapioca
75
70
  CONTENT
76
71
  end
77
72
 
78
- sig { void }
73
+ #: -> void
79
74
  def create_binstub
80
75
  force = File.exist?(Tapioca::BINARY_FILE)
81
76
 
@@ -88,12 +83,12 @@ module Tapioca
88
83
  )
89
84
  end
90
85
 
91
- sig { returns(Bundler::Installer) }
86
+ #: -> Bundler::Installer
92
87
  def installer
93
88
  @installer ||= Bundler::Installer.new(Bundler.root, Bundler.definition)
94
89
  end
95
90
 
96
- sig { returns(T.any(Bundler::StubSpecification, ::Gem::Specification)) }
91
+ #: -> (Bundler::StubSpecification | ::Gem::Specification)
97
92
  def spec
98
93
  @spec ||= Bundler.definition.specs.find { |s| s.name == "tapioca" }
99
94
  end
@@ -6,7 +6,8 @@ module Tapioca
6
6
  class DslCompilerList < AbstractDsl
7
7
  private
8
8
 
9
- sig { override.void }
9
+ # @override
10
+ #: -> void
10
11
  def execute
11
12
  load_application
12
13
 
@@ -6,7 +6,8 @@ module Tapioca
6
6
  class DslGenerate < AbstractDsl
7
7
  private
8
8
 
9
- sig { override.void }
9
+ # @override
10
+ #: -> void
10
11
  def execute
11
12
  load_application
12
13
 
@@ -6,7 +6,8 @@ module Tapioca
6
6
  class DslVerify < AbstractDsl
7
7
  private
8
8
 
9
- sig { override.void }
9
+ # @override
10
+ #: -> void
10
11
  def execute
11
12
  load_application
12
13
 
@@ -6,7 +6,8 @@ module Tapioca
6
6
  class GemGenerate < AbstractGem
7
7
  private
8
8
 
9
- sig { override.void }
9
+ # @override
10
+ #: -> void
10
11
  def execute
11
12
  Loaders::Gem.load_application(
12
13
  bundle: @bundle,
@@ -47,7 +48,7 @@ module Tapioca
47
48
  GitAttributes.create_generated_attribute_file(@outpath)
48
49
  end
49
50
 
50
- sig { params(gem_names: T::Array[String]).returns(T::Array[Gemfile::GemSpec]) }
51
+ #: (Array[String] gem_names) -> Array[Gemfile::GemSpec]
51
52
  def gems_to_generate(gem_names)
52
53
  return @bundle.dependencies if gem_names.empty?
53
54
 
@@ -65,12 +66,7 @@ module Tapioca
65
66
  end
66
67
  end
67
68
 
68
- sig do
69
- params(
70
- gem: Gemfile::GemSpec,
71
- dependencies: T::Array[Gemfile::GemSpec],
72
- ).returns(T::Array[Gemfile::GemSpec])
73
- end
69
+ #: (Gemfile::GemSpec gem, ?Array[Gemfile::GemSpec] dependencies) -> Array[Gemfile::GemSpec]
74
70
  def gem_dependencies(gem, dependencies = [])
75
71
  direct_dependencies = gem.dependencies.filter_map { |dependency| @bundle.gem(dependency.name) }
76
72
  gems = dependencies | direct_dependencies
@@ -6,7 +6,8 @@ module Tapioca
6
6
  class GemSync < AbstractGem
7
7
  private
8
8
 
9
- sig { override.void }
9
+ # @override
10
+ #: -> void
10
11
  def execute
11
12
  anything_done = [
12
13
  perform_removals,
@@ -6,14 +6,15 @@ module Tapioca
6
6
  class GemVerify < AbstractGem
7
7
  private
8
8
 
9
- sig { override.void }
9
+ # @override
10
+ #: -> void
10
11
  def execute
11
12
  say("Checking for out-of-date RBIs...")
12
13
  say("")
13
14
  perform_sync_verification
14
15
  end
15
16
 
16
- sig { void }
17
+ #: -> void
17
18
  def perform_sync_verification
18
19
  diff = {}
19
20
 
@@ -4,12 +4,7 @@
4
4
  module Tapioca
5
5
  module Commands
6
6
  class Require < CommandWithoutTracker
7
- sig do
8
- params(
9
- requires_path: String,
10
- sorbet_config_path: String,
11
- ).void
12
- end
7
+ #: (requires_path: String, sorbet_config_path: String) -> void
13
8
  def initialize(requires_path:, sorbet_config_path:)
14
9
  @requires_path = requires_path
15
10
  @sorbet_config_path = sorbet_config_path
@@ -19,7 +14,8 @@ module Tapioca
19
14
 
20
15
  private
21
16
 
22
- sig { override.void }
17
+ # @override
18
+ #: -> void
23
19
  def execute
24
20
  compiler = Static::RequiresCompiler.new(@sorbet_config_path)
25
21
  name = set_color(@requires_path, :yellow, :bold)
@@ -17,12 +17,7 @@ module Tapioca
17
17
  4. Manually create an RBI shim defining the missing constants
18
18
  DEPRECATION
19
19
 
20
- sig do
21
- params(
22
- todo_file: String,
23
- file_header: T::Boolean,
24
- ).void
25
- end
20
+ #: (todo_file: String, file_header: bool) -> void
26
21
  def initialize(todo_file:, file_header:)
27
22
  @todo_file = todo_file
28
23
  @file_header = file_header
@@ -30,7 +25,7 @@ module Tapioca
30
25
  super()
31
26
  end
32
27
 
33
- sig { void }
28
+ #: -> void
34
29
  def run_with_deprecation
35
30
  say(DEPRECATION_MESSAGE, :red)
36
31
  say("")
@@ -40,7 +35,8 @@ module Tapioca
40
35
 
41
36
  private
42
37
 
43
- sig { override.void }
38
+ # @override
39
+ #: -> void
44
40
  def execute
45
41
  say("Finding all unresolved constants, this may take a few seconds... ")
46
42
 
@@ -64,7 +60,7 @@ module Tapioca
64
60
  say("Please review changes and commit them.", [:green, :bold])
65
61
  end
66
62
 
67
- sig { params(constants: T::Array[String], command: String).returns(RBI::File) }
63
+ #: (Array[String] constants, command: String) -> RBI::File
68
64
  def rbi(constants, command:)
69
65
  file = RBI::File.new
70
66
 
@@ -84,7 +80,7 @@ module Tapioca
84
80
  file
85
81
  end
86
82
 
87
- sig { returns(T::Array[String]) }
83
+ #: -> Array[String]
88
84
  def unresolved_constants
89
85
  # Taken from https://github.com/sorbet/sorbet/blob/master/gems/sorbet/lib/todo-rbi.rb
90
86
  sorbet("--print=missing-constants", "--quiet", "--stdout-hup-hack", "--no-error-count")