Instead of generating our own "Maybe you meant ..." message, when a
generator or a server isn't found, use DidYouMean::Correctable.
This commit adds a generic CorrectableError in the Command namespace
that could be used for corrections for other commands.
By using DidYouMean we can delete the Command::Spellchecker.
Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
Fixes https://github.com/rails/rails/issues/42196
Now, `rails new` will display the same error message that `rails` and `rails help new` does.
To test:
- Pull this branch
- Uninstall your local rails copy using `gem uninstall rails`
- Move into the root directory where you pulled down the rails code, then install: `rake install`
- In another directory run `rails new`
Follow-up to #38495.
Similar to #40994, but for all Rails commands. Programmatic and CLI
invocations of Rails commands will still behave identically, and `ARGV`
will still be isolated between invocations.
Reverts #40994.
Follow-up to #38463.
By isolating ARGV, we guard against commands inadvertently depending on
prior ARGV contents. Any such command will now behave consistently when
run via `Rails::Command.invoke`, whether coming from the Rails CLI or
from library code. Likewise, any ARGV mutations done by a command will
not affect code that executes after `Rails::Command.invoke`.
Now that we require Ruby over `2.3`, we can replace the current
suggestion methods we have with tooling from the `did_you_mean` gem.
There is a small user visible change and this is that we now offer a
single suggestion for misspelled options. We are suggesting fixes during
generator invocation and during a mistyped rails server rack handler. In
both cases, if we don't make a proper prediction on the first match, we
won't do so in the second or third one, so in my mind, this is okay.
When secrets confirmed with the `secrets:edit` command, `secrets.yml.enc`
will change without updating the secrets.
Therefore, even if only want to check secrets, the difference will come
out. This is a little inconvenient.
In order to solve this problem, added the `secrets:show` command.
If just want to check secrets, no difference will occur use this command.