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

Upgrade Ruby to version 3.1.4 #5157

Merged
merged 5 commits into from
Sep 12, 2023
Merged

Upgrade Ruby to version 3.1.4 #5157

merged 5 commits into from
Sep 12, 2023

Commits on Sep 12, 2023

  1. Upgrade Ruby to version 3.1.4

    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
    javierm committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    e74eff2 View commit details
    Browse the repository at this point in the history
  2. Update Style/HashSyntax Rubocop rule

    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.
    javierm committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    fd9169e View commit details
    Browse the repository at this point in the history
  3. Add and apply Naming/BlockForwarding rubocop rule

    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`.
    javierm committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    f87d4b5 View commit details
    Browse the repository at this point in the history
  4. Add and apply Style/ArrayIntersect rubocop rule

    The `intersect?` method has been added in Ruby 3.1, and it's more
    readable than `(a & b).any?`.
    javierm committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    584176a View commit details
    Browse the repository at this point in the history
  5. Remove no longer needed --keep-file-descriptors option

    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
    javierm committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    dcb6450 View commit details
    Browse the repository at this point in the history