Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention "rake" less in guides #47610

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Mention "rake" less in guides #47610

merged 1 commit into from
Mar 28, 2023

Conversation

ghiculescu
Copy link
Member

@ghiculescu ghiculescu commented Mar 8, 2023

This blog post is about the confusion between bin/rake and bin/rails commands. The two have mostly been aliases since Rails 5, but this means there's all sorts of advice floating around the internet about which command to use. Is rake db:migrate the same as bin/rails db:migrate? I know that it is, but I can see why it's confusing for a first timer.

The blog post's suggestion was to have a section in the guides that introduces rake and talks about this distinction. I'm not sure about this. I think if we take up too much space too early in the guide discussing this, it risks confusing people even earlier. But if the advice is hidden away too much, nobody will find it.

Something I think we should do, though, is mention rake as little as possible in the guides. Mentions in upgrade guides and release notes are fine, but elsewhere we should avoid using it in places where bin/rails does an equivalent job. This PR removes a few rake mentions from the guides. Before doing this, I was expecting there to be a lot more, so this PR turned out to be a bit smaller than expected. Still, every little bit helps I think.

cc @youngbloodcyb

@rails-bot rails-bot bot added the docs label Mar 8, 2023
@matthewd
Copy link
Member

matthewd commented Mar 9, 2023

Agree the mentions of builtins should all use bin/rails and not mention rake.

For custom tasks, though, IMO rake remains the right choice. For a start, the end-user has to define them, so they clearly need to understand that they are rake tasks, and any way that we suggest or imply the usual Rake documentation doesn't apply is a disservice (and/or transfers documentation burden to us).

I don't think we have a discussed-and-established endgame policy, but at least in my head, the long-term goal would be to separate the two commands again. I see the "try for a rake task" fallback behaviour of bin/rails as a transitional mechanism until we eventually get all the built-ins promoted to Rails Commands (which we want, among other things, for the improved ability to take flags and arguments)... after that, I envision a deprecation of the fallback, and ultimately removal.

[This blog post](https://dev.to/youngbloodcyb/rake-junior-rails-review-13cc) is about the confusion between `bin/rake` and `bin/rails` commands. The two have mostly [been aliases since Rails 5](rails@3d252a0#diff-f5ff9aa07f44111a79d56c09ec37d774b462d97aff68f32490c2e56e74c95783R162), but this means there's all sorts of advice floating around the internet about which command to use. Is `rake db:migrate` the same as `bin/rails db:migrate`? I know that it is, but I can see why it's confusing for a first timer.

The blog post's suggestion was to have a section in the guides that introduces rake and talks about this distinction. I'm not sure about this. I think if we take up too much space too early in the guide discussing this, it risks confusing people even earlier. But if the advice is hidden away too much, nobody will find it.

Something I think we should do, though, is mention `rake` as little as possible in the guides. Mentions in upgrade guides and release notes are fine, but elsewhere we should avoid using it in places where `bin/rails` does an equivalent job. This PR removes a few `rake` mentions from the guides. Before doing this, I was expecting there to be a lot more, so this PR turned out to be a bit smaller than expected. Still, every little bit helps I think.
@ghiculescu
Copy link
Member Author

@matthewd roger that. I undid the changes to the "custom rake tasks" section. How does the rest look?

@p8
Copy link
Member

p8 commented Mar 9, 2023

I see the "try for a rake task" fallback behaviour of bin/rails as a transitional mechanism until we eventually get all the built-ins promoted to Rails Commands (which we want, among other things, for the improved ability to take flags and arguments)...

@matthewd I've always wondered if the plan was to migrate all build-ins to Thor.
I agree we should migrate those Thor.
For some of the simpler Rake tasks I've created PRs.

And I gather I can close: #47589 ?

@ghiculescu
Copy link
Member Author

And I gather I can close: #47589 ?

I like this PR too.

@p8
Copy link
Member

p8 commented Mar 9, 2023

I like this PR too.

But if we want to have a clear seperation between Rails commands and Rake tasks, is it still beneficial?

@ghiculescu
Copy link
Member Author

Oh, right. Maybe that should be reworded, I'll make a suggestion.

@ghiculescu
Copy link
Member Author

@matthewd is this fine to get merged?

JuanVqz added a commit to JuanVqz/rails that referenced this pull request Mar 16, 2023
I saw @p8 is moving some task to use Thor here rails#47610
thought I probably may help with it.

This migrates the `tmp:cache:clear` task to Thor
@p8 p8 merged commit e6884f8 into rails:main Mar 28, 2023
@ghiculescu ghiculescu deleted the less-rake branch March 28, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants