-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Upgrade Ruby to version 3.1.4 #5157
Merged
Conversation
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
db/migrate/20210924190648_create_active_storage_variant_records.active_storage.rb
Outdated
Show resolved
Hide resolved
javierm
force-pushed
the
ruby3.1
branch
3 times, most recently
from
September 6, 2023 11:07
353d4e3
to
3fad249
Compare
javierm
force-pushed
the
rails_6.1
branch
2 times, most recently
from
September 7, 2023 19:53
9c79657
to
405f6c4
Compare
Note we updated the `mail` gem in commit 1037428, which is necesary for Ruby 3.1 because it adds the net-smtp dependency. The net-smtp library was removed from Ruby in Ruby 3.1, and if we don't include it, we get an error: ``` cannot load such file -- net/smtp (LoadError) ``` We're also updating the Bundler version in the Gemfile.lock so it's the one included in Ruby 3.1. Without updating it, we get a warning: ``` Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_nam e, spell_checker)' instead. ``` Finally, in order to make Capistrano work, we need to add a couple more changes: * Make the net-ssh gem compatible with SSL 3.0; done in commit b2eec08 * Explicitly allow aliases in the `deploy-secrets.yml` file because Psych 4.x (included in Ruby 3.1) doesn't load aliases without this option
Ruby 3.1 adds the option for hash shortcuts, so it's possible to write `{ user: , poll: }` instead of `{ user: user, poll: poll }`. By default, Rubocop expects the new syntax in Ruby 3.1. While right now I absolutely hate this new syntax, we're allowing both the old and the new styles because we might start adopting it once we get used to it.
This syntax has been added in Ruby 3.1. Not using a variable name might not be very descriptive, but it's just as descriptive as using "block" as a variable name. Using just `&` we get the same amount of information than using `&block`: that we're passing a block. We're still using `&action` in `around_action` methods because here we aren't using a generic name for the variable, so (at least for now) we aren't running this cop on controllers using `around_action`.
The `intersect?` method has been added in Ruby 3.1, and it's more readable than `(a & b).any?`.
We added this option in commit d17b252, but Bundler now keeps descriptors by default. While this behavior was backported to Ruby 3.0.x, we're changing it now because, we've only noticed it now that we're upgrading to Ruby 3.1.x, since it was first developed for that version [1]. [1] rubygems/rubygems@88b7a3e7e2
taitus
approved these changes
Sep 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Objectives
Notes
I've tried to replace the
byebug
gem with thedebug
gem that is now included in Ruby 3.1, but GitHub Actions hangs (or takes forever to run the tests) when doing so. Since it hangs on the job running the machine learning model tests, and the messageDEBUGGER: Attaching after process X fork to child process Y
appears in this case, it might be related to the fact that the debugger gem attaches to the processes created by theProcess.fork
method, which is called in the machine learning tests.