-
Notifications
You must be signed in to change notification settings - Fork 349
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
Account for missing numeric segments while comparing Pod Versions #256
Conversation
@@ -138,6 +138,51 @@ def minor | |||
# | |||
def patch | |||
numeric_segments[2].to_i | |||
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.
alignment here is off
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.
good catch, thanks
This generally looks good, but please take a look at the spec failures? https://travis-ci.org/CocoaPods/Core/jobs/72843992#L1216 |
@gabro Would it be possible to use a |
@floere I though about it but I didn't come up with an elegant solution.
|
# @note Attempts to compare something that's not a {Version} return nil | ||
# | ||
def <=> other | ||
return unless Pod::Version === other |
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.
Should this be Gem::Version
?
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.
Possibly. Do we want to allow comparison between Gem
and Pod
versions?
@gabro Thanks! I see the issue – the method is too large in |
Good question. In a world where only I was possibly thinking of Liskov when asking this. @segiddins @gabro In any case, with succeeding specs I am happy to pull :) |
Ok, this is trickier than I thought and somewhat related to the The reason specs are failing is that I should have fixed it in my latest commit, although it's not pretty (code duplication). |
Looks from the failing specs like you might need to override |
Yes, I was looking into it right now. |
Ok, almost there. There were a few style issues: I fixed most of them, but two of them I chose to ignore:
|
thanks so much, @gabro! I'm going to make a few tweaks and add a few more tests, and then merge! Great work! |
Thanks to you guys for the great work! I'm glad I could give a little contribution! |
Manually merged via 74f8fdc. |
As discussed in CocoaPods/cocoapods.org#185 (comment)
Long story short, now
I haven't been too creative: I simply handled major, minor and patch explicitly then just used the same comparison algorithm as
Gem::Version
for the remaining segments.@floere I tried to write some tests for the "funky" versions you pointed me at (http://search.cocoapods.org/api/v1/pods.facets.json?include=version&only=version&counts=false) but apparently
Version.new("20aa2b2b15b6f8db350ec07b6041e4951bb255d0")
is not a validPod::Version
(the initializer fails)Same goes for other version strings such as
"beta.9"
,"2-beta"
and similar.