Search in sources :

Example 31 with RockerTemplate

use of io.micronaut.starter.template.RockerTemplate in project micronaut-starter by micronaut-projects.

the class JavaApplication method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    JavaApplicationFeature.super.apply(generatorContext);
    if (shouldGenerateApplicationFile(generatorContext)) {
        generatorContext.addTemplate("application", new RockerTemplate(getPath(), application.template(generatorContext.getProject(), generatorContext.getFeatures())));
        TestFramework testFramework = generatorContext.getTestFramework();
        String testSourcePath = generatorContext.getTestSourcePath("/{packagePath}/{className}");
        Project project = generatorContext.getProject();
        TestRockerModelProvider provider = new DefaultTestRockerModelProvider(spock.template(project), javaJunit.template(project), javaJunit.template(project), javaJunit.template(project), koTest.template(project));
        generatorContext.addTemplate("applicationTest", new RockerTemplate(testSourcePath, provider.findModel(generatorContext.getLanguage(), testFramework)));
    }
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) Project(io.micronaut.starter.application.Project) TestFramework(io.micronaut.starter.options.TestFramework) TestRockerModelProvider(io.micronaut.starter.options.TestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider)

Example 32 with RockerTemplate

use of io.micronaut.starter.template.RockerTemplate in project micronaut-starter by micronaut-projects.

the class Logback method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    OperatingSystem operatingSystem = generatorContext.getOperatingSystem();
    boolean jansi = false;
    if (operatingSystem != OperatingSystem.WINDOWS) {
        jansi = true;
    }
    generatorContext.addTemplate("loggingConfig", new RockerTemplate("src/main/resources/logback.xml", logback.template(jansi)));
}
Also used : OperatingSystem(io.micronaut.starter.application.OperatingSystem) RockerTemplate(io.micronaut.starter.template.RockerTemplate)

Aggregations

RockerTemplate (io.micronaut.starter.template.RockerTemplate)32 Project (io.micronaut.starter.application.Project)23 TemplateRenderer (io.micronaut.starter.template.TemplateRenderer)19 RenderResult (io.micronaut.starter.template.RenderResult)18 RockerModel (com.fizzed.rocker.RockerModel)14 TestRockerModelProvider (io.micronaut.starter.options.TestRockerModelProvider)6 DefaultTestRockerModelProvider (io.micronaut.starter.options.DefaultTestRockerModelProvider)5 Language (io.micronaut.starter.options.Language)5 TestFramework (io.micronaut.starter.options.TestFramework)3 ApplicationType (io.micronaut.starter.application.ApplicationType)2 BuildTool (io.micronaut.starter.options.BuildTool)2 BinaryTemplate (io.micronaut.starter.template.BinaryTemplate)2 URLTemplate (io.micronaut.starter.template.URLTemplate)2 Parameter (io.micronaut.context.annotation.Parameter)1 Prototype (io.micronaut.context.annotation.Prototype)1 ReflectiveAccess (io.micronaut.core.annotation.ReflectiveAccess)1 ThrowingSupplier (io.micronaut.core.util.functional.ThrowingSupplier)1 OperatingSystem (io.micronaut.starter.application.OperatingSystem)1 CodeGenConfig (io.micronaut.starter.cli.CodeGenConfig)1 CodeGenCommand (io.micronaut.starter.cli.command.CodeGenCommand)1