From e1e544eef3bf3759aa87e5564335f92b16febe90 Mon Sep 17 00:00:00 2001 From: giepher Date: Tue, 13 Feb 2018 21:59:48 +0800 Subject: [PATCH] Add support for BSD platforms (such as FreeBSD) --- src/main/java/jenkins/plugins/nodejs/tools/Platform.java | 9 ++++++++- .../tools/pathresolvers/LatestInstallerPathResolver.java | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/jenkins/plugins/nodejs/tools/Platform.java b/src/main/java/jenkins/plugins/nodejs/tools/Platform.java index 574812d..9443f72 100644 --- a/src/main/java/jenkins/plugins/nodejs/tools/Platform.java +++ b/src/main/java/jenkins/plugins/nodejs/tools/Platform.java @@ -11,7 +11,11 @@ * Supported platform. */ public enum Platform { - LINUX("node", "npm", "bin"), WINDOWS("node.exe", "npm.cmd", ""), OSX("node", "npm", "bin"), SUNOS("node", "npm", "bin"); + LINUX("node", "npm", "bin"), + WINDOWS("node.exe", "npm.cmd", ""), + OSX("node", "npm", "bin"), + SUNOS("node", "npm", "bin"), + BSD("node", "npm", "bin"); /** * Choose the file name suitable for the downloaded Node bundle. @@ -75,6 +79,9 @@ private static Platform detect(Map systemProperties) throws Dete if (arch.contains("sunos")) { return SUNOS; } + if (arch.contains("bsd")) { + return BSD; + } throw new DetectionFailedException("Unknown OS name: " + arch); } diff --git a/src/main/java/jenkins/plugins/nodejs/tools/pathresolvers/LatestInstallerPathResolver.java b/src/main/java/jenkins/plugins/nodejs/tools/pathresolvers/LatestInstallerPathResolver.java index b720797..4215496 100644 --- a/src/main/java/jenkins/plugins/nodejs/tools/pathresolvers/LatestInstallerPathResolver.java +++ b/src/main/java/jenkins/plugins/nodejs/tools/pathresolvers/LatestInstallerPathResolver.java @@ -57,6 +57,10 @@ public String resolvePathFor(String version, Platform platform, CPU cpu) { os = "sunos"; extension = EXTENSION; break; + case BSD: + os = "bsd"; + extension = EXTENSION; + break; default: throw new IllegalArgumentException("Unresolvable nodeJS installer for version=" + version + ", platform=" + platform.name()); } @@ -107,4 +111,4 @@ public boolean isMSI(String version) { return false; } -} \ No newline at end of file +}