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

Allow http 5-x #55

Merged
merged 5 commits into from May 27, 2021
Merged

Allow http 5-x #55

merged 5 commits into from May 27, 2021

Conversation

mgrunberg
Copy link
Contributor

@mgrunberg mgrunberg commented May 17, 2021

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.

@mgrunberg mgrunberg marked this pull request as draft May 17, 2021 14:57
@mgrunberg mgrunberg marked this pull request as ready for review May 17, 2021 15:17
@jrochkind
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@mgrunberg
Copy link
Contributor Author

mgrunberg commented May 17, 2021

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 ?

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.
5.0 gemspec ruby_version is >= 2.5.

@jrochkind
Copy link
Collaborator

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.

@jrochkind
Copy link
Collaborator

httprb/http#666

@mgrunberg
Copy link
Contributor Author

mgrunberg commented May 17, 2021

OK thanks, I'm going to file a PR to their CHANGELOG adding that then.... seems important to be in changelog.

Thanks for that

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.

I'm answering your other comment but I need some time to order my ideas and do a proper explanation 😄

@mgrunberg mgrunberg mentioned this pull request May 26, 2021
@janko
Copy link
Owner

janko commented May 27, 2021

Looks good, thanks for the patch!

@janko janko merged commit fb14ff4 into janko:master May 27, 2021
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.

None yet

3 participants