File archive = this.config.getCacheResolver().resolve(cacheDescriptor);
private void installYarn() throws InstallationException { try { logger.info("Installing Yarn version {}", yarnVersion); String downloadUrl = yarnDownloadRoot + yarnVersion; String extension = "tar.gz"; String fileending = "/yarn-" + yarnVersion + "." + extension; downloadUrl += fileending; CacheDescriptor cacheDescriptor = new CacheDescriptor("yarn", yarnVersion, extension); File archive = config.getCacheResolver().resolve(cacheDescriptor); downloadFileIfMissing(downloadUrl, archive, userName, password); File installDirectory = getInstallDirectory(); // We need to delete the existing yarn directory first so we clean out any old files, and // so we can rename the package directory below. try { if (installDirectory.isDirectory()) { FileUtils.deleteDirectory(installDirectory); } } catch (IOException e) { logger.warn("Failed to delete existing Yarn installation."); } extractFile(archive, installDirectory); ensureCorrectYarnRootDirectory(installDirectory, yarnVersion); logger.info("Installed Yarn locally."); } catch (DownloadException e) { throw new InstallationException("Could not download Yarn", e); } catch (ArchiveExtractionException | IOException e) { throw new InstallationException("Could not extract the Yarn archive", e); } }
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); } }
this.config.getPlatform().getArchiveExtension()); File archive = this.config.getCacheResolver().resolve(cacheDescriptor);
this.config.getPlatform().getArchiveExtension()); File archive = this.config.getCacheResolver().resolve(cacheDescriptor);