use of io.micronaut.starter.application.Project 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.application.Project in project micronaut-starter by micronaut-projects.
the class CreateBeanCommand method call.
@Override
public Integer call() throws Exception {
Project project = getProject(beanName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
RenderResult renderResult = null;
String path = "/{packagePath}/{className}";
path = config.getSourceLanguage().getSourcePath(path);
RockerModel rockerModel = null;
if (config.getSourceLanguage() == Language.JAVA) {
rockerModel = javaBean.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyBean.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinBean.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered bean to " + renderResult.getPath());
} else if (renderResult.isSkipped()) {
warning("Rendering skipped for " + renderResult.getPath() + " because it already exists. Run again with -f to overwrite.");
} else if (renderResult.getError() != null) {
throw renderResult.getError();
}
}
return 0;
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class AwsLambda method apply.
@Override
public void apply(GeneratorContext generatorContext) {
Project project = generatorContext.getProject();
if (shouldGenerateSources(generatorContext)) {
addBook(generatorContext, project);
addBookSaved(generatorContext, project);
ApplicationType applicationType = generatorContext.getApplicationType();
if (applicationType == DEFAULT || applicationType == FUNCTION) {
if (applicationType == DEFAULT) {
addBookController(generatorContext, project);
addBookControllerTest(generatorContext, project);
} else {
addRequestHandler(generatorContext, project);
addTest(generatorContext, project);
}
DocumentationLink link = new DocumentationLink(LINK_TITLE, LINK_URL);
generatorContext.addHelpTemplate(new RockerWritable(readmeRockerModel(this, generatorContext, link)));
}
}
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class OracleRawFunction method apply.
@Override
public void apply(GeneratorContext generatorContext) {
ApplicationType type = generatorContext.getApplicationType();
if (type == ApplicationType.FUNCTION) {
applyFunction(generatorContext, type);
Language language = generatorContext.getLanguage();
Project project = generatorContext.getProject();
String sourceFile = generatorContext.getSourcePath("/{packagePath}/Function");
switch(language) {
case GROOVY:
generatorContext.addTemplate("function", new RockerTemplate(sourceFile, oracleRawFunctionGroovy.template(project)));
break;
case KOTLIN:
generatorContext.addTemplate("function", new RockerTemplate(sourceFile, oracleRawFunctionKotlin.template(project)));
break;
case JAVA:
default:
generatorContext.addTemplate("function", new RockerTemplate(sourceFile, oracleRawFunctionJava.template(project)));
}
applyTestTemplate(generatorContext, project, "Function");
}
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class GoogleCloudRawFunction method apply.
@Override
public void apply(GeneratorContext generatorContext) {
ApplicationType type = generatorContext.getApplicationType();
applyFunction(generatorContext, type);
if (type == ApplicationType.FUNCTION) {
Language language = generatorContext.getLanguage();
Project project = generatorContext.getProject();
String sourceFile = generatorContext.getSourcePath("/{packagePath}/Function");
switch(language) {
case GROOVY:
generatorContext.addTemplate("function", new RockerTemplate(sourceFile, gcpRawBackgroundFunctionGroovy.template(project)));
break;
case KOTLIN:
generatorContext.addTemplate("function", new RockerTemplate(sourceFile, gcpRawBackgroundFunctionKotlin.template(project)));
break;
case JAVA:
default:
generatorContext.addTemplate("function", new RockerTemplate(sourceFile, gcpRawBackgroundFunctionJava.template(project)));
}
applyTestTemplate(generatorContext, project, "Function");
}
}
Aggregations