diff --git a/lib/cocoapods-core/version.rb b/lib/cocoapods-core/version.rb index b65b3cae..f2a12e69 100644 --- a/lib/cocoapods-core/version.rb +++ b/lib/cocoapods-core/version.rb @@ -225,6 +225,9 @@ def compare_segments(other) if comparison = lhs <=> rhs return comparison + else + return -1 if lhs.is_a?(Numeric) && rhs.is_a?(String) + return 1 if rhs.is_a?(Numeric) && lhs.is_a?(String) end end end diff --git a/spec/version_spec.rb b/spec/version_spec.rb index 725bda11..45103318 100644 --- a/spec/version_spec.rb +++ b/spec/version_spec.rb @@ -145,6 +145,9 @@ module Pod # Example from CocoaPods/CocoaPods#5718 Version.new('1.0-beta.8').should.be < Version.new('1.0-beta.8a') + + # Example from section 11.4.3 on semver.org + Version.new('1.0.0-beta.3rd.1').should.not.be >= Version.new('1.0.0-beta.ios17.1') end end