System.out.println("- " + environment.getId() + " for " + environment.getName());
}
break;
} else {
String environmentId = args[0];
Environment environment = ini.getEnvironmentById(environmentId);
if (environment == null) {
System.out.println("Unknown environment " + environmentId);
System.out.flush();
} else {
System.out.println("Packaging deployable for " + environment.getName() + " ...");
/**
* Open output file
*/
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(ini.getOutfile()));
/**
* Copying environment-agnostic contents to output
*/
ZipInputStream contentsZip = new ZipInputStream(ClassLoader.getSystemResourceAsStream(configFileIdx + "-contents.zip"));
copyZipEntries(zipOut, contentsZip);
contentsZip.close();
/**
* Copying environment-aware contents to output
*/
InputStream configZipInputStream = ClassLoader.getSystemResourceAsStream(configFileIdx + "-config-" + environment.getId() + ".zip");
if (configZipInputStream != null) {
ZipInputStream configZip = new ZipInputStream(configZipInputStream);
copyZipEntries(zipOut, configZip);
configZip.close();
}