Skip to content

Instantly share code, notes, and snippets.

View keithel's full-sized avatar

Keith Kyzivat keithel

  • New Hampshire, USA
View GitHub Profile
@keithel
keithel / VersionComparator.groovy
Last active September 16, 2022 13:59 — forked from founddrama/VersionComparator.groovy
a version comparator (e.g., "1.0.2" < "1.0.10")
def versions = []
def f = new File('mock-version-tags.txt')
f.eachLine { versions << it }
def versionComparator = { a, b ->
def VALID_TOKENS = /._/
a = a.tokenize(VALID_TOKENS)
b = b.tokenize(VALID_TOKENS)
for (i in 0..<Math.max(a.size(), b.size())) {