String appZipName = parsedArgs.getString("app-zip");
String newAppName = parsedArgs.getString("new-app-name");
String newAppNamespace = parsedArgs.getString("new-app-require-prefix");
File appZip = (new File(appZipName).exists()) ? new File(appZipName) : new File(brjs.file("sdk"), appZipName);
App app = brjs.app(newAppName);
if(!appZip.exists()) throw new CommandArgumentsException("Couldn't find zip file at '" + appZipName + "'.", this);
if(app.dirExists()) throw new NodeAlreadyExistsException(app, this);
try
{
NameValidator.assertValidDirectoryName(app);
NameValidator.assertValidRootPackageName(app, newAppNamespace);
NodeImporter.importAppFromZip(new ZipFile(appZip), app, newAppNamespace);
app.deploy();
logger.println("Successfully imported '" + new File(appZipName).getName() + "' as new application '" + newAppName + "'");
logger.println(" " + app.dir().getAbsolutePath());
}
catch(InvalidDirectoryNameException | InvalidRootPackageNameException e) {
throw new CommandArgumentsException("Failed to import application from zip '" + appZipName + "'.", e, this);
}
catch (Exception e)