Skip to content

Commit 5162bad

Browse files
authored
Merge pull request #381 from ysb33r/twiddle-wakka-issue-380
Handle single-digit twiddle-wakka (#380)
2 parents e5c0b8f + aa21783 commit 5162bad

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,26 @@ class IvyXmlProxyServerIntegrationSpec extends Specification {
188188
findFiles (~/^asciidoctor-pdf.*\.gem$/).size() == 3
189189
}
190190

191+
@Issue('https://github.com/jruby-gradle/jruby-gradle-plugin/issues/380')
192+
void 'Resolve transitive which contains a single digit twiddle-wakka'() {
193+
setup:
194+
withBuildFile '''
195+
dependencies {
196+
something 'rubygems:asciidoctor-bibtex:0.3.1'
197+
something 'rubygems:bibtex-ruby:4.4.7', {
198+
force = true
199+
}
200+
}
201+
'''
202+
203+
when:
204+
build()
205+
206+
then:
207+
findFiles ~/^asciidoctor-bibtex-0.3.1.gem$/
208+
findFiles ~/^bibtex-ruby-4.4.7.gem$/
209+
}
210+
191211
private List<File> findFiles(Pattern pat) {
192212
new File(projectDir, 'build/something').listFiles(new FilenameFilter() {
193213
@Override

core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,21 @@ class GemVersion implements Comparable<GemVersion> {
432432
private static GemVersion parseTwiddleWakka(String singleRequirement) {
433433
String base = getVersionFromRequirement(singleRequirement, TWIDDLE_WAKKA)
434434
List<String> parts = base.tokenize(VERSION_SPLIT)
435-
if (1 == parts) {
435+
if (1 == parts.size()) {
436+
if (base =~ ONLY_DIGITS) {
437+
return new GemVersion(
438+
INCLUSIVE,
439+
base,
440+
null,
441+
OPEN_ENDED
442+
)
443+
}
444+
436445
throw new GemVersionException(
437-
"'${singleRequirement}' does not look like a correctly formattedGEM twiddle-wakka requirement"
446+
"'${singleRequirement}' does not look like a correctly formatted GEM twiddle-wakka"
438447
)
439448
}
449+
440450
String lastNumberPart = parts[0..-2].reverse().find {
441451
it =~ ONLY_DIGITS
442452
}

0 commit comments

Comments
 (0)