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
Fix the build for ruby 3.0.x (but not 3.1.0-dev yet) #262
Conversation
webrick is no longer a bundled dependency for Ruby 3 and up.
🎉 So glad to see someone pick this up! |
490b8c0
to
1a91fe8
Compare
@bethesque heh, we tried doing this curiously on a local project and it was kind of a "hey, while this is still fresh in my head". It's still failing on |
@bethesque I've seen other projects allow failures on |
It looks like our def rfc2822(time)
wday = Time::RFC2822_DAY_NAME[time.wday]
mon = Time::RFC2822_MONTH_NAME[time.mon - 1]
time.strftime("#{wday}, %d-#{mon}-%Y %H:%M:%S GMT")
end Since I don't know the reason for the dropping of these constants (and maybe it's in error, maybe they'll come back?), we can either drop down to the |
Hm. That's a strange one.
Given the nature of a constant is, well, constant, perhaps just create a Webmachine constant with that value? Maybe they've dropped support for RFC2822_DAY_NAME in ruby-head, but haven't documented it yet. I can't find anything in the googles either. |
I'm ok with failing ruby-head personally. We can deal with it when it becomes an official release. |
The ruby-head build is already marked as "experimental" in test.yml. There's just nothing that runs after the tests to show that the failure is ignored. |
@bethesque ah, thanks. I'm quite unfamiliar with the setup of these kinds of matrix builds! I've just cloned the ruby source to try and work out why the constants have gone missing. Current hypothesis is that they're fiddling with the |
@rgarner @bethesque I created a PR in as-notifications to make it compatible with Ruby 3.0. bernd/as-notifications#3 It would be awesome if one of you could take a quick look. My Ruby got quite rusty. 😅 The tests work, so I guess it's fine. I can push a new as-notifications gem release once it has been merged. |
@bernd have commented over there. Also, hi, and thanks 😁 |
You all are the best. ❤️ 💜 💙 💚 💛 |
@rgarner I pushed as-notifications 1.0.2 to rubygems. |
1a91fe8
to
5856a4b
Compare
@bethesque hugely grateful for the thoughtful review* *spotting my terrible mistakes |
Ruby 3 is stricter about hashes being used interchangeably with keyword arguments, and will give errors like: ArgumentError: wrong number of arguments (given 2, expected 0..1) Explicitly map options hash to positional argument with ** to fix
Ruby 3 no longer supports Proc.new without a block to mean "the block that was passed to this method". Use an explicit &block instead This commit does not fix as-notifications, on this line: https://github.com/bernd/as-notifications/blob/v1.0.0/lib/as/notifications/fanout.rb#L18
5856a4b
to
13c6b18
Compare
Is this good to merge now from your perspective @rgarner? It looks fine to me. |
Since 1.0.2 is now compatible with Ruby 3.0, we have one spec we no longer have to use the Proc.new { } form with. Thanks Bernd!
13c6b18
to
c779da7
Compare
Thanks @rgarner! |
I'll put out a release when I get a moment. Not sure if adding ruby 3.0 support is a "bug fix" (patch) or a "feature" (minor) 🤔. |
@bethesque It's tricky, for sure. I'd err on the side of "minor". My reasoning is that prior to Ruby 3.0's release, there was no "bug" (and there still isn't so long as you don't upgrade Ruby), and so adding support is a sort of "feature". I think if I were wondering why something at version 1.0 didn't support Ruby 3.0 and I |
Hm, that’s a tricky one. |
Fix:
webrick
Proc.new
requires an empty block where a block is not givenDoes not fix:
gemas-notifications
will need updating as per point 3. above (though I'm not sure we actually call this in such a way that it would use the defaultProc.new
for the argument, so it's probably just a ticking time bomb)3.1.0-dev
is broken asTime::RFC_*
constants aren't there right now