Skip to content

Commit 23d71a8

Browse files
authored
Merge pull request #331 from jruby-gradle/version-resolve-workaround
use workaround an upstream bug in version range
2 parents 45635ac + 2f8d44d commit 23d71a8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

jruby-gradle-base-plugin/src/main/groovy/com/github/jrubygradle/internal/GemVersion.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class GemVersion {
6767
* @param String version
6868
*/
6969
GemVersion(String version) {
70+
// workaround a bug in gem proxy which can not handle != operators
71+
version = version.replace('=', '')
7072
if (version.contains('+')) {
7173
low = ZEROS.matcher(PLUS.matcher(DOT_PLUS.matcher(version).replaceFirst('.0')).replaceFirst('')).replaceFirst('')
7274
high = DIGITS_PLUS.matcher(DOT_PLUS.matcher(version).replaceFirst('.99999')).replaceFirst(MAX_VERSION)

jruby-gradle-base-plugin/src/test/groovy/com/github/jrubygradle/internal/GemVersionSpec.groovy

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,22 @@ class GemVersionSpec extends Specification {
163163
subject.intersect('[0,)').toString() == '[0.9,0.9.99999]'
164164
}
165165

166-
def "intersects two versions special one"() {
166+
def "intersects two versions with special full range"() {
167167
given:
168168
GemVersion subject = new GemVersion('[0,)')
169169

170170
expect:
171171
subject.intersect('[0.9.0,0.9.99999]').toString() == '[0.9,0.9.99999]'
172172
}
173173

174+
def "intersects two versions with workaround due to upstream bug"() {
175+
given:
176+
GemVersion subject = new GemVersion('(=2.5.1.1,99999)')
177+
178+
expect:
179+
subject.intersect('(=2.5.1.1,)').toString() == '(2.5.1.1,99999)'
180+
}
181+
174182
def "intersects with conflict"() {
175183
given:
176184
GemVersion subject = new GemVersion('[1.2.1, 1.2.3]')

0 commit comments

Comments
 (0)