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
Encourage use of bin/rails over rails where needed #33203
Encourage use of bin/rails over rails where needed #33203
Conversation
This commit prefixes rails command with 'bin/' where bin/rails should be preferred over rails. Occurrences like rails new and rails plugin haven't been updated because they aren't a use case of bin/rails
r? @sgrif (@rails-bot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
Why is this necessary? AFAIK these should only differ if people don't have Am I forgetting a common situation where |
The point is not that it doesn't work, but that the correct version is used. |
Why do you provide the binstubs with the application then? |
Exactly @deivid-rodriguez, thanks, you answered first ❤️ @matthewd on top of that I also think it is better that we encourage using the version we think is better. At the moment we are mixing both and that can be confusing. |
If it works, I'm not sure I follow how it's not "the correct version".
I can ask stand-offish questions too: how do you think @albertoalmagro I guess my question becomes whether/why we think the longer spelling is the better version. Standardizing on a consistent spelling seems sensible, but I'd think we'd default to the one that's easier to type. |
Yeah, I didn't use the proper wording, I'll try again. The point is not that |
I definitely did not mean this as "stand-offish", I'm sorry if it came off like that. Online async communication is tough, specially when not in your native language. The good news is that I learnt a new word :) |
Ah yes, sorry, I misinterpreted your point about the version.
So when you run a 5.2, or 4.0, or whatever, |
😮 I didn't know that, in that case yeah, I'm not sure about this PR. I have a question though. How would my app break if I use a |
Specifically I tried |
It then ignores your binstub, and hopes it's right about what would be in |
Aaah, you're right again, and explains why my tests just work. What I mean is, could those three lines live inside the application loader in the general case (not only for the fallback), and leave the binstub that lives inside the application only for bundler to do its thing? Not sure if I communicated the idea correctly. |
@matthewd This explanation is gold, I had understood the same as @deivid-rodriguez, thanks for the lesson 📖 👏 !!! Knowing this I think we should make the opposite to avoid this confusion. That is replacing |
My point is to unify this to be consistent., things like recommending here to run
While here only rails :rails/railties/lib/rails/application.rb Line 585 in c47c289
Thanks |
@deivid-rodriguez I worked out why that doesn't work [in the general case]: when we use that fallback behaviour, we're not assuming the app's Rails version can be booted in the same way the latest version can be (as I claimed above) -- we're booting the latest version (that is, the version that the path-found If you've run it under bundler (or via said bundler binstub), then the chosen "latest" version will in fact be the right version for the app, and you'll be fine... but if you're using a truly bare @albertoalmagro yeah, I originally understood this to be essentially a bug report that the "magic |
@matthewd Thanks, then if you don't mind I will close this PR and will open a new PR (which references this one) with the corrected spelling, OK? |
@matthewd @deivid-rodriguez I'm closing this PR and opening #33229 I would be very happy to see you there. Thanks for your reviews and your comments here! |
@matthewd Thanks once again for your helpful explanations ❤️ So if I understood correctly, my idea would work only if Rails didn't intend to fully support running |
Summary
While reading Rails code I noted that in some places we used
bin/rails
while in others we kept referring torails
when running tasks. This PR prefixesrails
command withbin/
wherebin/rails
should be preferred overrails
. Occurrences likerails new
haven't been updated because they aren't a use case ofbin/rails
.Additional information
Test cases for generators usage have also been updated.