@Override public String asInDownloadPath() { return _latest.asInDownloadPath(); } }
@Override public String asInDownloadPath() { return _latest.asInDownloadPath(); } }
protected static String getVersionPart(IVersion version) { return version.asInDownloadPath(); } }
@Override public String asInDownloadPath() { return _version.asInDownloadPath(); }
@Override public String toString() { return "GenericFeatureAwareVersion{" + _version.asInDownloadPath() + "}"; }
protected static String getVersionPart(IVersion version) { return version.asInDownloadPath(); }
protected static String getVersionPart(IVersion version) { return version.asInDownloadPath(); }
protected static String getVersionPart(IVersion version) { return version.asInDownloadPath(); }
public PostgresFilesToExtract(IDirectory dirFactory, ITempNaming executableNaming, FileSet fileSet, Distribution distribution) { super(dirFactory, executableNaming, fileSet); this.fileSet = fileSet; if (dirFactory.asFile() != null) { final File file = new File(dirFactory.asFile(), "pgsql-" + distribution.getVersion().asInDownloadPath()); if (!file.exists()) { //noinspection ResultOfMethodCallIgnored file.mkdir(); } this.extractBasePath = file.getPath(); } else { this.extractBasePath = null; } }
static String asPath(Distribution distribution) { return new StringBuilder() .append(distribution.getPlatform().name()) .append("-") .append(distribution.getBitsize().name()) .append("--") .append(distribution.getVersion().asInDownloadPath()) .toString(); }
@Override public String getPath(Distribution distribution) { String downloadPath = distribution.getVersion().asInDownloadPath(); BitSize bs = distribution.getBitsize(); switch (distribution.getPlatform()) { case OS_X: return format("%s-x86%s.tar.gz", downloadPath, bs == B32 ? "" : "_64"); case Linux: return format("%s-%s.tar.gz", downloadPath, bs == B32 ? "i686" : "x86_64"); case Windows: return format("%s-win%s.zip", downloadPath, bs == B32 ? "32" : "x64"); default: throw new RuntimeException("Not implemented for: " + distribution.getPlatform()); } } }
@Override public IExtractedFileSet extractFileSet(Distribution distribution) throws IOException { try { final File dir = this.eDir.asFile(); final FileSet filesSet = downloadConfig.getPackageResolver().getFileSet(distribution); final Path path = get(dir.getPath(), "pgsql" + "-" + distribution.getVersion().asInDownloadPath(), "pgsql"); if (exists(path)) { final Builder extracted = builder(dir).baseDirIsGenerated(false); iterateFiles(path.toFile(), TRUE, TRUE).forEachRemaining(file -> { FileType type = Library; if (filesSet.entries().stream() .anyMatch(entry -> entry.matchingPattern().matcher(file.getPath()).matches())) { type = Executable; } extracted.file(type, file); }); return extracted.build(); } else { return super.extractFileSet(distribution); } } catch (Exception e) { LOGGER.error("Failed to extract file set", e); return new EmptyFileSet(); } } }