-
Notifications
You must be signed in to change notification settings - Fork 53
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
Allow http 5-x #55
Allow http 5-x #55
Conversation
82ba6a9
to
28a2343
Compare
28a2343
to
9d2d92f
Compare
Does http 5.x not work with ruby 2.4 and 2.3? Ah, i see the change log for http says it's dropped ruby 2.3.0 support with http 5.0. Is there also an issue with ruby 2.4, @mgrunberg ? |
spec.add_development_dependency "http", "~> 5.0" | ||
else | ||
spec.add_development_dependency "http", "~> 4.3" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually work to do what you want, I'm afraid.
Logic in a gemspec is executed at build time, so which of these gets included will depend on what version of ruby the releaser was using.
There isn't any way to do conditional logic in a gemspec like this that applies at runtime/execution time different for different apps.
However... I'm confused that this is only a development dependency not an actual runtime dependency... maybe this is ok? Is this really only about CI? But it's very confusing/misleading, and will result in a gem released to rubygems whose development_dependency
for http depends on what version of ruby the releaser was running...
I am not sure what to do, but I think ideally there is a different solution than this. Or at least some very explicit comments. Because this sort of thing is an error people make in gemspecs a lot, and 99% of the time it is an error, and causes big problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually work to do what you want, I'm afraid.
Logic in a gemspec is executed at build time, so which of these gets included will depend on what version of ruby the releaser was using.
There isn't any way to do conditional logic in a gemspec like this that applies at runtime/execution time different for different apps.
However... I'm confused that this is only a development dependency not an actual runtime dependency... maybe this is ok? Is this really only about CI? But it's very confusing/misleading, and will result in a gem released to rubygems whose
development_dependency
for http depends on what version of ruby the releaser was running...I am not sure what to do, but I think ideally there is a different solution than this. Or at least some very explicit comments. Because this sort of thing is an error people make in gemspecs a lot, and 99% of the time it is an error, and causes big problems.
I will try to do my best to explain what lead me to this solution.
down
has several backends (readme). You don't always need http
gem to use down
. If you use the default backend, there is no point in adding http
to your system. This is by, as I understand, it's not a gemspec dependency
.
It's needed as a development_dependency
to test Down::Http
backend. But also because some specs use it to build the expected result (example) and because test_helper
uses it to wait for a service.
Since http
drop ruby 2.3 and 2.4 support down
could do the same. That's fair. But users running old rubies (2.3 and 2.4 have reached EOL) can still use Down::Http
if they use 4.x
version. Drop old rubies support is not a requirement to use http 5.0, so I took the conservative alternative and let specs run with 4.x on old rubies (asserting that this works).
Why the condition logic is in the gemspec and not in another place (Gemfile for example)? Because there are already some development_dependencies
handled that way.
They also drop support for ruby 2.4. It's not on the changelog but this is the commit where they bump 2.4 to 2.5. |
OK thanks, I'm going to file a PR to their CHANGELOG adding that then.... seems important to be in changelog. Not sure the right way to handle this over here, as per my comment I'm concerned about the way you are doing it, but maybe I'm wrong? Curious for maintainer opinion. |
Thanks for that
I'm answering your other comment but I need some time to order my ideas and do a proper explanation 😄 |
Looks good, thanks for the patch! |
http
5.0.0 has released a few days ago.The PR adds support for 5.x.
http
drop Ruby 2.3 and 2.4 support (httprb/http#571 and this commit). That's why I'm using 4.x on CI when ruby is lower than 2.5.0.