Add Ruby 4.0 support - #626
Conversation
net-ssh, pulled in via specinfra, requires "logger" at load time. As of
Ruby 3.5 / 4.0 "logger" is a bundled gem rather than a default gem, so it
is no longer on the load path inside a bundle unless it is declared. Without
it, `require "serverspec"` fails on Ruby 4.0 with:
LoadError: cannot load such file -- logger
Declare logger as a runtime dependency and add Ruby 4.0 to the CI matrix.
The full suite (650 examples) passes on Ruby 4.0.6.
Signed-off-by: Tim Smith <tsmith84@proton.me>
47af679 to
9f0d98a
Compare
|
Thanks for tracking this down — the diagnosis is right, but the fix belongs in specinfra. The Note the CI matrix hunk can't be split out and merged on its own — One thing to watch in the specinfra PR: an unconditional Closing here; would you be up for opening it against mizzy/specinfra? |
Problem
require "serverspec"fails on Ruby 4.0:net-ssh(pulled in viaspecinfra) doesrequire 'logger'on its first line but does not declare the dependency. That was fine whileloggerwas a default gem — always on the load path. As of Ruby 3.5 / 4.0 it is a bundled gem, so Bundler no longer puts it on the load path unless something in the dependency graph asks for it.This is the same class of fix specinfra already made for
base64during the Ruby 3.4 cycle.Changes
loggeras a runtime dependency in the gemspec."4.0"to the CI matrix.Compatibility with the existing matrix
The unconditional dependency resolves on every Ruby currently tested, because the oldest
loggerreleases declare no Ruby floor at all:required_ruby_version: >= 0)So the Ruby 2.2 floor is unaffected.
Verification
Full suite on Ruby 4.0.6:
Before this change the same suite reported
6 errors occurred outside of examples, allcannot load such file -- logger.