@Override public Platform getPlatform() { return installConfig.getPlatform(); } }
@Override public Platform getPlatform() { return installConfig.getPlatform(); } }
private void installNodeForWindows() throws InstallationException { final String downloadUrl = this.nodeDownloadRoot + this.config.getPlatform().getNodeDownloadFilename(this.nodeVersion, false); try { File destinationDirectory = getInstallDirectory(); File destination = new File(destinationDirectory, "node.exe"); String classifier = this.config.getPlatform().getNodeClassifier(); CacheDescriptor cacheDescriptor = new CacheDescriptor("node", this.nodeVersion, classifier, "exe"); File binary = this.config.getCacheResolver().resolve(cacheDescriptor); downloadFileIfMissing(downloadUrl, binary, this.userName, this.password); this.logger.info("Copying node binary from {} to {}", binary, destination); FileUtils.copyFile(binary, destination); this.logger.info("Installed node locally."); } catch (DownloadException e) { throw new InstallationException("Could not download Node.js from: " + downloadUrl, e); } catch (IOException e) { throw new InstallationException("Could not install Node.js", e); } }
public void install() throws InstallationException { // use static lock object for a synchronized block synchronized (LOCK) { if (this.nodeDownloadRoot == null || this.nodeDownloadRoot.isEmpty()) { this.nodeDownloadRoot = DEFAULT_NODEJS_DOWNLOAD_ROOT; } if (!nodeIsAlreadyInstalled()) { this.logger.info("Installing node version {}", this.nodeVersion); if (!this.nodeVersion.startsWith("v")) { this.logger.warn("Node version does not start with naming convention 'v'."); } if (this.config.getPlatform().isWindows()) { if (npmProvided()) { installNodeWithNpmForWindows(); } else { installNodeForWindows(); } } else { installNodeDefault(); } } } }
private void installNodeWithNpmForWindows() throws InstallationException { try { final String longNodeFilename = this.config.getPlatform().getLongNodeFilename(this.nodeVersion, true); String downloadUrl = this.nodeDownloadRoot + this.config.getPlatform().getNodeDownloadFilename(this.nodeVersion, true); String classifier = this.config.getPlatform().getNodeClassifier(); this.config.getPlatform().getArchiveExtension());
private void installNodeDefault() throws InstallationException { try { final String longNodeFilename = this.config.getPlatform().getLongNodeFilename(this.nodeVersion, false); String downloadUrl = this.nodeDownloadRoot + this.config.getPlatform().getNodeDownloadFilename(this.nodeVersion, false); String classifier = this.config.getPlatform().getNodeClassifier(); this.config.getPlatform().getArchiveExtension());