[jrubyscripting] Allow multiple version specifiers for gems (#13779)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
jimtng
2022-11-29 08:51:19 +10:00
committed by GitHub
parent 3912487305
commit 735089a7c7
2 changed files with 23 additions and 13 deletions

View File

@@ -171,11 +171,11 @@ public class JRubyScriptEngineConfiguration {
int validGems = 0;
for (String gem : gems) {
gem = gem.trim();
String version = "";
String[] versions = {};
if (gem.contains("=")) {
String[] gemParts = gem.split("=");
String[] gemParts = gem.split("=", 2);
gem = gemParts[0].trim();
version = gemParts[1].trim();
versions = gemParts[1].split(";");
}
if (gem.isEmpty()) {
@@ -183,8 +183,11 @@ public class JRubyScriptEngineConfiguration {
}
gemCommand += " gem '" + gem + "'";
if (!version.isEmpty()) {
gemCommand += ", '" + version + "'";
for (String version : versions) {
version = version.trim();
if (!version.isEmpty()) {
gemCommand += ", '" + version + "'";
}
}
gemCommand += ", require: false\n";
validGems += 1;