forked from rails/rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load Rake tasks only once for command suggestions
Follow-up to rails#47208. `UnrecognizedCommandError` calls `printing_commands` to make "Did you mean?" suggestions. `printing_commands` calls `RakeCommand#rake_tasks`, which loads the Rake tasks if they have not been memoized. If the tasks have already been loaded by `RakeCommand#perform` (but not memoized by `RakeCommand#rake_tasks`), then the tasks will be loaded a second time. This can cause, for example, constant redefinition warnings if the task files define constants. Therefore, this commit memoizes the tasks from `RakeCommand#perform` before raising `UnrecognizedCommandError`.
- Loading branch information
1 parent
52d1920
commit a7dbd57
Showing
2 changed files
with
23 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters