use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class CreateJobCommand method call.
@Override
public Integer call() throws Exception {
Project project = getProject(jobName);
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 = javaJob.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyJob.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinJob.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered job 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 CreateNatsListener method call.
@Override
public Integer call() throws Exception {
Project project = getProject(listenerName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
String path = "/{packagePath}/{className}";
path = config.getSourceLanguage().getSourcePath(path);
RenderResult renderResult = null;
RockerModel rockerModel = null;
if (config.getSourceLanguage() == Language.JAVA) {
rockerModel = javaListener.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyListener.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinListener.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered Nats listener 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 CreateRabbitMQListener method call.
@Override
public Integer call() throws Exception {
Project project = getProject(listenerName);
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 = javaListener.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyListener.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinListener.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered RabbitMQ listener 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 CreateClientCommand method call.
@Override
public Integer call() throws Exception {
Project project = getProject(clientName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
RenderResult renderResult = null;
if (config.getSourceLanguage() == Language.JAVA) {
renderResult = templateRenderer.render(new RockerTemplate("src/main/java/{packagePath}/{className}Client.java", javaClient.template(project)), overwrite);
} else if (config.getSourceLanguage() == Language.GROOVY) {
renderResult = templateRenderer.render(new RockerTemplate("src/main/groovy/{packagePath}/{className}Client.groovy", groovyClient.template(project)), overwrite);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
renderResult = templateRenderer.render(new RockerTemplate("src/main/kotlin/{packagePath}/{className}Client.kt", kotlinClient.template(project)), overwrite);
}
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered client 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 FeatureDiffCommand method call.
@Override
public Integer call() throws Exception {
String appName = FileSystemOutputHandler.getDefaultBaseDirectory().getName();
Project project = NameUtils.parse(config.getDefaultPackage() + "." + appName);
Options options = new Options(config.getSourceLanguage(), config.getTestFramework(), config.getBuildTool());
ApplicationType applicationType = config.getApplicationType();
List<String> features = this.features;
ProjectGenerator projectGenerator = this.projectGenerator;
featureDiffer.produceDiff(projectGenerator, project, applicationType, options, getOperatingSystem(), features, this);
return 0;
}
Aggregations