/** * Returns the list of commands used to install support for an archive with the given name. */ public static List<String> installCommands(String fileName) { List<String> commands = new LinkedList<String>(); switch (ArchiveType.of(fileName)) { case TAR: case TGZ: case TBZ: commands.add(BashCommands.INSTALL_TAR); break; case ZIP: commands.add(BashCommands.INSTALL_UNZIP); break; case JAR: case WAR: case EAR: case UNKNOWN: break; } return commands; }
/** * Set the location of the generated archive file. */ public ArchiveBuilder named(String name) { checkNotNull(name); String ext = Files.getFileExtension(name); if (ext.isEmpty()) { name = name + "." + type.toString(); } else if (type != ArchiveType.of(name)) { throw new IllegalArgumentException(String.format("Extension for '%s' did not match archive type of %s", ext, type)); } this.archive = new File(Os.tidyPath(name)); return this; }
commands.add("cd " + targetDir); String sourcePath = Os.mergePathsUnix(sourceDir, fileName); switch (ArchiveType.of(fileName)) { case TAR: commands.add("tar xvf " + sourcePath);
throw new IllegalStateException(format("Failed to expand archive %s on %s", archiveUrl, machine)); return ArchiveType.of(destFile)!=ArchiveType.UNKNOWN; } finally { machine.releaseMutex("installing");
if (ArchiveType.of(cookbookArchiveUrl)==ArchiveType.UNKNOWN) { destName = cookbookName + ".tgz"; log.debug("Assuming TGZ type for chef cookbook url "+cookbookArchiveUrl+"; it will be downloaded as "+destName);
if (ArchiveType.of(cookbookArchiveUrl)==ArchiveType.UNKNOWN) { destName = cookbookName + ".tgz"; log.debug("Assuming TGZ type for chef cookbook url "+cookbookArchiveUrl+"; it will be downloaded as "+destName);
String imageId; String imageDir = Os.mergePaths(getRunDir(), name); if (!ArchiveType.UNKNOWN.equals(ArchiveType.of(dockerfile)) || Urls.isDirectory(dockerfile)) { ArchiveUtils.deploy(dockerfile, getMachine(), imageDir); imageId = buildDockerfileDirectory(name);
private ArchiveBuilder(String filename) { this(ArchiveType.of(filename)); named(filename); }