aboutsummaryrefslogtreecommitdiff
path: root/vars/utils.groovy
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2019-03-20 16:39:13 -0400
committerGitHub <noreply@github.com>2019-03-20 16:39:13 -0400
commitfd66dd6dcd026ff3cc0651bd3f5e83e3f1f84e8c (patch)
treec531e6fb377bbb4fb424e928161a82af8f37f8b0 /vars/utils.groovy
parent9428317aef119d4c97d8224eeea6077d35bb0530 (diff)
downloadjscu_refactor-fd66dd6dcd026ff3cc0651bd3f5e83e3f1f84e8c.tar.gz
Convert specifiers (#38)
* Add convert_specifiers * Add convert_specifiers to README
Diffstat (limited to 'vars/utils.groovy')
-rw-r--r--vars/utils.groovy18
1 files changed, 18 insertions, 0 deletions
diff --git a/vars/utils.groovy b/vars/utils.groovy
index 5390929..7b74187 100644
--- a/vars/utils.groovy
+++ b/vars/utils.groovy
@@ -726,6 +726,24 @@ def run(configs, concurrent = true) {
}
+// Condense version triplet and replace version specifier(s) with human-readable text
+//
+// @param String s string containing version specifiers
+// @return String string with converted version specifiers
+String convert_specifiers(String s) {
+ String result = s
+ result = result.replaceAll("\\.", "") // No period
+ .replaceAll(",", "") // No comma
+ .replaceAll("<", "L") // Less than
+ .replaceAll(">", "G") // Greater than
+ .replaceAll("~=", "C") // Compatible (GE x.y && L x.*)
+ .replaceAll("=", "E") // Equal to (=, E | ==, EE)
+ .replaceAll("\\!", "N") // Not equal to
+
+ return result
+}
+
+
// Convenience function that performs a deep copy on the supplied object.
//
// @param obj Java/Groovy object to copy