use workaround an upstream bug in version range

fixes #328
This commit is contained in:
Christian Meier 2018-08-12 20:09:47 +02:00
parent 45635ac0b7
commit 2f8d44d18f
2 changed files with 11 additions and 1 deletions

View File

@ -67,6 +67,8 @@ class GemVersion {
* @param String version
*/
GemVersion(String version) {
// workaround a bug in gem proxy which can not handle != operators
version = version.replace('=', '')
if (version.contains('+')) {
low = ZEROS.matcher(PLUS.matcher(DOT_PLUS.matcher(version).replaceFirst('.0')).replaceFirst('')).replaceFirst('')
high = DIGITS_PLUS.matcher(DOT_PLUS.matcher(version).replaceFirst('.99999')).replaceFirst(MAX_VERSION)

View File

@ -163,7 +163,7 @@ class GemVersionSpec extends Specification {
subject.intersect('[0,)').toString() == '[0.9,0.9.99999]'
}
def "intersects two versions special one"() {
def "intersects two versions with special full range"() {
given:
GemVersion subject = new GemVersion('[0,)')
@ -171,6 +171,14 @@ class GemVersionSpec extends Specification {
subject.intersect('[0.9.0,0.9.99999]').toString() == '[0.9,0.9.99999]'
}
def "intersects two versions with workaround due to upstream bug"() {
given:
GemVersion subject = new GemVersion('(=2.5.1.1,99999)')
expect:
subject.intersect('(=2.5.1.1,)').toString() == '(2.5.1.1,99999)'
}
def "intersects with conflict"() {
given:
GemVersion subject = new GemVersion('[1.2.1, 1.2.3]')