-
Notifications
You must be signed in to change notification settings - Fork 983
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
Remove EM-HTTP SSL patch duplication #1202
Conversation
And, thanks for contributing a PR! |
Happy to help! Thanks for being a maintainer. This library is the backbone of so many gems/projects that I use, I figure the least I can do is submit a little patch 😉 |
You can learn a bit more about the ins and outs of begin-rescue-else-ensure-end in Jonan's article here: And, I think you can run the RuboCop linting locally, too. Here's a not-complete example of the structure I was thinking of when I said "body of the begin
# ...
rescue
# ...
else
if something
# do that require
end
end |
Seems there is an error loading the version from `EventMachine::HttpRequest::VERSION' The version looks to be in this spot there when looking at the gem though: Any ideas? |
Perhaps we have yet to actually load the dependency. In this adapter, we have the call That method can also be used like this: dependency do
require 'em-http'
# And: Do other things, like the thing you want to do
end
Here's the source code for `dependency`:
https://github.com/lostisland/faraday/blob/01c25e880c94ef65d488019da44c39eb7823772c/lib/faraday/dependency_loader.rb#L12
Perhaps this inspires other ways to get this working? |
I'm a bit out of my element on this (haven't done much work on gems) but as I was digging around inside the 'em-http-request' gem, it doesn't seem as though When I change the
If that's the case, would the long-term fix actually be to include the version file in the https://github.com/igrigorik/em-http-request/blob/master/lib/em-http.rb If so I'm happy to open a PR on that library as well to get it fixed. |
No. That's not issue in library. Library itself is NOT responsible to define version. |
I've updated the conditional to require the version files if we get to that step. All tests seem to be passing. |
Ok I think we might have it this time - thanks for your patience as I work through this! |
Cool, now we reached the place where the whole patch logic (the whole test for "do we need it?" and the patch file require) needs to attempt to move into the dependency block - a time and place where we know we have access to the loaded em_http/version.rb file. Faraday must avoid non-runtime dependencies on its optional gems, which leads to these shenanigans. You're well on the way! |
Thanks @olleolleolle - I just pushed an update that moves that logic into the dependency block and only requires the version file if we get to that step |
@kylekeesling Awesome work! Let's get this merged! |
Release? |
Description
This PR is meant to address the duplication of an SSL patch call. Fixes #1201
Please let let me know if there are any changes/updates necessary!