Class: Tapioca::Commands::Todo
- Includes:
- SorbetHelper
- Defined in:
- lib/tapioca/commands/todo.rb
Constant Summary
Constants included from SorbetHelper
SorbetHelper::FEATURE_REQUIREMENTS, SorbetHelper::SORBET_BIN, SorbetHelper::SORBET_EXE_PATH_ENV_VAR, SorbetHelper::SORBET_GEM_SPEC
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(todo_file:, file_header:) ⇒ Todo
constructor
A new instance of Todo.
Methods included from SorbetHelper
#sorbet, #sorbet_path, #sorbet_supports?
Methods included from Tapioca::CliHelper
Constructor Details
#initialize(todo_file:, file_header:) ⇒ Todo
Returns a new instance of Todo.
15 16 17 18 19 20 |
# File 'lib/tapioca/commands/todo.rb', line 15 def initialize(todo_file:, file_header:) @todo_file = todo_file @file_header = file_header super() end |
Instance Method Details
#execute ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tapioca/commands/todo.rb', line 23 def execute say("Finding all unresolved constants, this may take a few seconds... ") # Clean all existing unresolved constants before regenerating the list # so Sorbet won't grab them as already resolved. File.delete(@todo_file) if File.exist?(@todo_file) constants = unresolved_constants if constants.empty? say("Nothing to do", :green) return end say("Done", :green) contents = rbi(constants, command: default_command(:todo)) create_file(@todo_file, contents.string, verbose: false) 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 |