Skip to content

Support for Ruby 3.4#186

Merged
mkon merged 9 commits intomkon:mainfrom
klausmeyer:ruby-3.4
Feb 19, 2025
Merged

Support for Ruby 3.4#186
mkon merged 9 commits intomkon:mainfrom
klausmeyer:ruby-3.4

Conversation

@klausmeyer
Copy link
Contributor

No description provided.

@klausmeyer
Copy link
Contributor Author

@mkon please have a look ;)

ja2r.gemspec Outdated
s.files = Dir['{app,config,db,lib}/**/*', 'LICENSE', 'README.md']

s.add_dependency 'activesupport', '>= 6.1', '< 8.0'
s.add_dependency 'logger', '~> 1.6'
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need logger as dependency? I did not find any use of logger. I removed it and tests worked just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't look like it. I've pushed a commit to remove it.

Not sure what I was doing yesterday :)

lib/ja2r.rb Outdated
@@ -1,3 +1,5 @@
require 'logger' # Required for combination of old activesupport (< 7.1) and new ruby (> 3.3)
Copy link
Owner

Choose a reason for hiding this comment

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

I think if someone uses old activesupport with new ruby they should require logger themself. It's not our dependency so we cannot require it.

Copy link
Contributor Author

@klausmeyer klausmeyer Feb 19, 2025

Choose a reason for hiding this comment

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

Totally agree.

I'm just adding this here to have the test matrix pass in that combination.

This happens when I remove it:

[ kmeyer at AM-FVFHF184Q05N in ja2r ] ruby-3.4.2@ja2r (branch:ruby-3.4*)
» ruby -v
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24]
[ kmeyer at AM-FVFHF184Q05N in ja2r ] ruby-3.4.2@ja2r (branch:ruby-3.4*)
» bundle list | grep activesupport
  * activesupport (6.1.7.10)
[ kmeyer at AM-FVFHF184Q05N in ja2r ] ruby-3.4.2@ja2r (branch:ruby-3.4*)
» bundle exec rspec

An error occurred while loading spec_helper.
Failure/Error: require 'active_support'

NameError:
  uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
# /Users/kmeyer/.rvm/gems/ruby-3.4.2@ja2r/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:16:in '<module:LoggerThreadSafeLevel>'
# /Users/kmeyer/.rvm/gems/ruby-3.4.2@ja2r/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:9:in '<module:ActiveSupport>'
# /Users/kmeyer/.rvm/gems/ruby-3.4.2@ja2r/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:8:in '<top (required)>'
# /Users/kmeyer/.rvm/gems/ruby-3.4.2@ja2r/gems/activesupport-6.1.7.10/lib/active_support/logger_silence.rb:5:in '<top (required)>'
# /Users/kmeyer/.rvm/gems/ruby-3.4.2@ja2r/gems/activesupport-6.1.7.10/lib/active_support/logger.rb:3:in '<top (required)>'
# /Users/kmeyer/.rvm/gems/ruby-3.4.2@ja2r/gems/activesupport-6.1.7.10/lib/active_support.rb:29:in '<top (required)>'
# ./lib/ja2r.rb:1:in '<top (required)>'
# ./spec/spec_helper.rb:5:in '<top (required)>'
No examples found.

Finished in 0.00002 seconds (files took 0.12414 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

Do you have another idea how to solve it? Should we blacklist some combinations in the test-matrix or maybe drop old active-support versions?

Copy link
Owner

Choose a reason for hiding this comment

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

You can maybe put it in the Gemfile (above gemspec), then it should be required automatically.
Alternatively just put the require in the spec helper also above Bundler.require

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright. I've added it to the Gemfile. With just requiring it manually it printed a warning as the gem will no longer be part of the default gems starting from Ruby 3.5

@mkon mkon merged commit 5cfc448 into mkon:main Feb 19, 2025
17 checks passed
@klausmeyer klausmeyer deleted the ruby-3.4 branch February 19, 2025 18:50
@klausmeyer
Copy link
Contributor Author

Thanks :)

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.

2 participants