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

Add ruby 3.2 and remove 2.4 #135

Merged
merged 14 commits into from
Sep 27, 2024
Merged

Conversation

KinWang-2013
Copy link
Contributor

This PR adds ruby 3.2 and remove 2.4

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Trung Lê <[email protected]>
Copy link
Collaborator

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this.

.github/workflows/ruby.yml Show resolved Hide resolved
.github/workflows/ruby.yml Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@KinWang-2013
Copy link
Contributor Author

@dblock @runlevel5 please check again, made the changes

Copy link
Collaborator

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be removing tests for all versions of Rails and not for Ruby 3. Can we bring back the Rails Gemfiles on a newer version of Ruby? Also see if we can get 2.7 to work.

@KinWang-2013
Copy link
Contributor Author

I don't think we should be removing tests for all versions of Rails and not for Ruby 3. Can we bring back the Rails Gemfiles on a newer version of Ruby? Also see if we can get 2.7 to work.

you mean we keep ruby 2.7 onwards ?

@dblock
Copy link
Collaborator

dblock commented Sep 24, 2024

you mean we keep ruby 2.7 onwards ?

Yes, just to have support for 2.x, unless it's difficult.

@KinWang-2013
Copy link
Contributor Author

you mean we keep ruby 2.7 onwards ?

Yes, just to have support for 2.x, unless it's difficult.

okay I will try once

@KinWang-2013
Copy link
Contributor Author

KinWang-2013 commented Sep 25, 2024

@dblock I made the updates, currently with ruby 3.2, rails 5.x tests are failing, narrowed down to

# file: lib/dotiw/methods.rb
 141		I18n.with_options locale: options[:locale], scope: i18n_scope do |locale|
 142			phrases = hash.map { |key, value| locale.t(key, count: value) }
 143  	end

this block which calls I18n.t method

I am still looking into the issue, if you have any advice, it would be helpful

@dblock
Copy link
Collaborator

dblock commented Sep 25, 2024

@dblock I made the updates, currently with ruby 3.2, rails 5.x tests are failing, narrowed down to

# file: lib/dotiw/methods.rb
 141		I18n.with_options locale: options[:locale], scope: i18n_scope do |locale|
 142			phrases = hash.map { |key, value| locale.t(key, count: value) }
 143  	end

this block which calls I18n.t method

I am still looking into the issue, if you have any advice, it would be helpful

I spent some time on this and I am as puzzled as you. It's some combination of Ruby 3.x keyword arguments with the way this method is declared that's not adding up.

It works with Ruby 2.7, so keep Rails 5 with just Ruby 2.7 tests and we should be good.

@KinWang-2013
Copy link
Contributor Author

@dblock I made the updates, currently with ruby 3.2, rails 5.x tests are failing, narrowed down to

# file: lib/dotiw/methods.rb
 141		I18n.with_options locale: options[:locale], scope: i18n_scope do |locale|
 142			phrases = hash.map { |key, value| locale.t(key, count: value) }
 143  	end

this block which calls I18n.t method
I am still looking into the issue, if you have any advice, it would be helpful

I spent some time on this and I am as puzzled as you. It's some combination of Ruby 3.x keyword arguments with the way this method is declared that's not adding up.

It works with Ruby 2.7, so keep Rails 5 with just Ruby 2.7 tests and we should be good.

okay cool I can do that.

BTW I also spent some time to debug the issue and found out that it is related to with_options method in the file active_support/core_ext/object/with_options.rb from ActiveSupport. Upon further inspection, it seems like when we use with options, it passes the options as a hash parameter when we call locale.t hence the ArgumentError from I18n gem. I tried to remove the with_options and call the method directly but some tests are failing (ActionView tests) because the ActionView date helper uses similar code in line 104 of file action_view/helpers/date_helper.rb (V5.0.7.2), so I did left it as is.

@KinWang-2013
Copy link
Contributor Author

@dblock made the suggested changes, all builds are passing as of now, please check

CHANGELOG.md Outdated
* [#135](https://github.com/radar/distance_of_time_in_words/pull/135): Add support for Ruby 2.7 - [@KinWang-2013](https://github.com/KinWang-2013).
* [#135](https://github.com/radar/distance_of_time_in_words/pull/135): Add test for Rails 6.0 with Ruby 3.2 - [@KinWang-2013](https://github.com/KinWang-2013).
* [#135](https://github.com/radar/distance_of_time_in_words/pull/135): Add test for Rails 5.X with Ruby 2.7 - [@KinWang-2013](https://github.com/KinWang-2013).
* [#135](https://github.com/radar/distance_of_time_in_words/pull/135): Remove support for Rails 4 - [@KinWang-2013](https://github.com/KinWang-2013).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we collapse these?

- Add support for Ruby 2.7 and 3.2, removed support for ruby 2.4, 2.5, 2.6 and Rails 4

No need to mention that we added tests.

@dblock
Copy link
Collaborator

dblock commented Sep 25, 2024

@dblock made the suggested changes, all builds are passing as of now, please check

Looks good, just one more annoying ask from me on CHANGELOG, thanks for hanging in here with me!

@KinWang-2013
Copy link
Contributor Author

@dblock made the suggested changes, all builds are passing as of now, please check

Looks good, just one more annoying ask from me on CHANGELOG, thanks for hanging in here with me!

no worries, made the changes, please check

@dblock dblock merged commit b03a73a into radar:master Sep 27, 2024
8 checks passed
@dblock
Copy link
Collaborator

dblock commented Sep 27, 2024

Good work, merged. Add Rails 7 in another PR?

@KinWang-2013
Copy link
Contributor Author

Good work, merged. Add Rails 7 in another PR?

okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants