lib/tapioca/commands/todo.rb in tapioca-0.11.8 vs lib/tapioca/commands/todo.rb in tapioca-0.11.9
- old
+ new
@@ -4,10 +4,21 @@
module Tapioca
module Commands
class Todo < CommandWithoutTracker
include SorbetHelper
+ DEPRECATION_MESSAGE = T.let(<<~DEPRECATION, String)
+ The `todo` command is deprecated and will be removed in a future release.
+
+ If your project is still missing type definitions for constants, try the following:
+ 1. Regenerate gem RBIs by running `bin/tapioca gem --all` and `bin/tapioca annotations`
+ 2. Generate RBIs for DSLs by running `bin/tapioca dsl`
+ 3. If the missing constants are defined in files that a gem does not load by default,
+ manually require those files in `sorbet/tapioca/require.rb` and regenerate gem RBIs
+ 4. Manually create an RBI shim defining the missing constants
+ DEPRECATION
+
sig do
params(
todo_file: String,
file_header: T::Boolean,
).void
@@ -17,10 +28,20 @@
@file_header = file_header
super()
end
+ sig { void }
+ def run_with_deprecation
+ say(DEPRECATION_MESSAGE, :red)
+ say("")
+
+ run
+ end
+
+ private
+
sig { override.void }
def execute
say("Finding all unresolved constants, this may take a few seconds... ")
# Clean all existing unresolved constants before regenerating the list
@@ -40,11 +61,9 @@
name = set_color(@todo_file, :yellow, :bold)
say("\nAll unresolved constants have been written to #{name}.", [:green, :bold])
say("Please review changes and commit them.", [:green, :bold])
end
-
- private
sig { params(constants: T::Array[String], command: String).returns(RBI::File) }
def rbi(constants, command:)
file = RBI::File.new