use of io.micronaut.starter.io.FileSystemOutputHandler in project micronaut-starter by micronaut-projects.
the class CreateCommand method call.
@Override
public Integer call() throws Exception {
if (listFeatures) {
new ListFeatures(availableFeatures, new Options(lang, test, build, getJdkVersion()), applicationType, getOperatingSystem(), contextFactory).output(this);
return 0;
}
Project project;
try {
project = NameUtils.parse(name);
} catch (IllegalArgumentException e) {
throw new CommandLine.ParameterException(this.spec.commandLine(), StringUtils.isEmpty(name) ? "Specify an application name or use --inplace to create an application in the current directory" : e.getMessage());
}
OutputHandler outputHandler = new FileSystemOutputHandler(project, inplace, this);
generate(project, outputHandler);
out("@|blue ||@ Application created at " + outputHandler.getOutputLocation());
return 0;
}
use of io.micronaut.starter.io.FileSystemOutputHandler in project micronaut-starter by micronaut-projects.
the class GitHubCreateService method generateAppLocally.
/**
* Generates the micronaut application into specified {@code repoPath} directory
*
* @param generatorContext context
* @param repoPath path
* @throws IOException
*/
protected void generateAppLocally(@NotNull GeneratorContext generatorContext, @NotNull Path repoPath) throws IOException {
try {
if (!Files.isDirectory(repoPath)) {
throw new IllegalArgumentException(String.format("The path %s must be a directory!", repoPath.toString()));
}
OutputHandler outputHandler = new FileSystemOutputHandler(repoPath.toFile(), ConsoleOutput.NOOP);
projectGenerator.generate(generatorContext.getApplicationType(), generatorContext.getProject(), outputHandler, generatorContext);
} catch (Exception e) {
LOG.error("Error generating application: " + e.getMessage(), e);
throw new IOException(e.getMessage(), e);
}
}
Aggregations