-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Use ruby file: ".ruby-version"
for new apps
#49360
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
Conversation
Drafted because rubygems/rubygems#6985 hasn't quite been released yet |
@skipkayhil rails/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt Lines 42 to 46 in d99e355
|
Indeed this is one of the caveats of |
198fcb1
to
66c79c4
Compare
Did you find a way to address the Dockerfile as well? |
Yes I was wrapping it up yesterday, let me push it up Edit: unless you mean can the Dockerfile also read the .ruby-version for the image version, in which case I have not addressed that |
Also, do we need the version split if Ruby 3.1+ is now required? |
535d876
to
6cbdc3f
Compare
We do definitely need the split on using |
6cbdc3f
to
bfeb8e3
Compare
Although I wonder if we couldn't just force Bundler 2.4+ with the install of Rails? |
Also, shouldn't "ruby file: ".ruby-version"" just be the default in bundler? |
bfeb8e3
to
8bc27bc
Compare
Previously, new apps would have a Ruby version set in both the Gemfile and the .ruby-version file. This duplication makes it more difficult to quickly change an application's ruby version as users must remember to update multiple files. This commit updates the app generator's Gemfile to read the Ruby version from the .ruby-version file. Since this feature was introduced in the latest version of Bundler, it will only be enabled if a supported version of Bundler is used. Alternatively, another solution mentioned on the original PR adding .ruby-version was that the .ruby-version file could be removed once rvm/rbenv support reading the Ruby version from the Gemfile. This has a downside that many other tools like chruby do not have plans to support reading a Ruby version from the Gemfile, and so users of those tools would have a worse experience if the .ruby-version file is removed. Co-authored-by: Takumi Shotoku <sinsoku.listy@gmail.com>
8bc27bc
to
a1c6e27
Compare
@dhh this should be ready to go 👍 |
This reverts commit 6985c3b, reversing changes made to 3163bb7. Reason: While we want to apply this change, it make bundle being more strict about the ruby version. This is particularly problematic for the devcontainer images that don't support defining which patch version of ruby to install. Right now, you can only say you want Ruby 3.2, which could mean 3.2.3 or 3.2.0. If for some reason the devcontainer image doesn't match the patch version on `.ruby-version` it will fail to install. We are planning to solve this problem by publishing our own ruby images that allow defining the patch level, but until that we can't apply this change.
…y-file" This reverts commit 6985c3b, reversing changes made to 3163bb7. Reason: While we want to apply this change, it make bundle being more strict about the ruby version. This is particularly problematic for the devcontainer images that don't support defining which patch version of ruby to install. Right now, you can only say you want Ruby 3.2, which could mean 3.2.3 or 3.2.0. If for some reason the devcontainer image doesn't match the patch version on `.ruby-version` it will fail to install. We are planning to solve this problem by publishing our own ruby images that allow defining the patch level, but until that we can't apply this change.
…y-file" This reverts commit 6985c3b, reversing changes made to 3163bb7. Reason: While we want to apply this change, it make bundle being more strict about the ruby version. This is particularly problematic for the devcontainer images that don't support defining which patch version of ruby to install. Right now, you can only say you want Ruby 3.2, which could mean 3.2.3 or 3.2.0. If for some reason the devcontainer image doesn't match the patch version on `.ruby-version` it will fail to install. We are planning to solve this problem by publishing our own ruby images that allow defining the patch level, but until that we can't apply this change.
…y-file" This reverts commit 6985c3b, reversing changes made to 3163bb7. Reason: While we want to apply this change, it make bundle being more strict about the ruby version. This is particularly problematic for the devcontainer images that don't support defining which patch version of ruby to install. Right now, you can only say you want Ruby 3.2, which could mean 3.2.3 or 3.2.0. If for some reason the devcontainer image doesn't match the patch version on `.ruby-version` it will fail to install. We are planning to solve this problem by publishing our own ruby images that allow defining the patch level, but until that we can't apply this change.
…y-file" This reverts commit 6985c3b, reversing changes made to 3163bb7. Reason: While we want to apply this change, it make bundle being more strict about the ruby version. This is particularly problematic for the devcontainer images that don't support defining which patch version of ruby to install. Right now, you can only say you want Ruby 3.2, which could mean 3.2.3 or 3.2.0. If for some reason the devcontainer image doesn't match the patch version on `.ruby-version` it will fail to install. We are planning to solve this problem by publishing our own ruby images that allow defining the patch level, but until that we can't apply this change.
Motivation / Background
Fixes #51014
Fixes #51089
Previously, new apps would have a Ruby version set in both the Gemfile and the .ruby-version file. This duplication makes it more difficult to quickly change an application's ruby version as users must remember to update multiple files.
Detail
This commit updates the app generator's Gemfile to read the Ruby version from the .ruby-version file. Since this feature was introduced in the latest version of Bundler, it will only be enabled if a supported version of Bundler is used.
Additional information
Alternatively, another solution mentioned on the original PR adding .ruby-version was that the .ruby-version file could be removed once rvm/rbenv support reading the Ruby version from the Gemfile. This has a downside that many other tools like chruby do not have plans to support reading a Ruby version from the Gemfile, and so users of those tools would have a worse experience if the .ruby-version file is removed.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]