diff --git a/grails-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy b/grails-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy index 9dbde36f..2eb3343a 100644 --- a/grails-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy +++ b/grails-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy @@ -3,9 +3,12 @@ package org.grails.forge.cli.command import io.micronaut.configuration.picocli.PicocliRunner import io.micronaut.context.ApplicationContext import io.micronaut.context.env.Environment +import org.grails.forge.application.ApplicationType import org.grails.forge.application.WebAvailableFeatures +import org.grails.forge.cli.CodeGenConfig import org.grails.forge.cli.CommandFixture import org.grails.forge.cli.CommandSpec +import org.grails.forge.io.ConsoleOutput import spock.lang.AutoCleanup import spock.lang.Shared diff --git a/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/GrailsApplication.java b/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/GrailsApplication.java index af11b2a9..420b8c9f 100644 --- a/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/GrailsApplication.java +++ b/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/GrailsApplication.java @@ -66,6 +66,7 @@ public void apply(GeneratorContext generatorContext) { generatorContext.addTemplate("plugin", new RockerTemplate(generatorContext.getSourcePath("/{packagePath}/{className}GrailsPlugin"), plugin.template(generatorContext.getProject(), applicationType))); } + generatorContext.addTemplate("bootStrap", new RockerTemplate("grails-app/init/{packagePath}/BootStrap.groovy", bootStrap.template(generatorContext.getProject()))); } protected boolean shouldGenerateApplicationFile(ApplicationType applicationType, GeneratorContext generatorContext) { diff --git a/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/bootStrap.rocker.raw b/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/bootStrap.rocker.raw new file mode 100644 index 00000000..1a214b29 --- /dev/null +++ b/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/bootStrap.rocker.raw @@ -0,0 +1,13 @@ +@import org.grails.forge.application.Project + +@args(Project project) + +package @project.getPackageName() + +class BootStrap { + + def init = { servletContext -> + } + def destroy = { + } +} \ No newline at end of file diff --git a/grails-forge-core/src/test/groovy/org/grails/forge/feature/lang/GrailsApplicationSpec.groovy b/grails-forge-core/src/test/groovy/org/grails/forge/feature/lang/GrailsApplicationSpec.groovy index a7e1b071..41766499 100644 --- a/grails-forge-core/src/test/groovy/org/grails/forge/feature/lang/GrailsApplicationSpec.groovy +++ b/grails-forge-core/src/test/groovy/org/grails/forge/feature/lang/GrailsApplicationSpec.groovy @@ -99,4 +99,18 @@ class GrailsApplicationSpec extends BeanContextSpec implements CommandOutputFixt expect: buildGradle.contains("war") } + + @Unroll + void "test BootStrap.groovy is present for application type #applicationType"() { + + when: + def output = generate(applicationType) + + then: + output.containsKey("grails-app/init/example/grails/BootStrap.groovy") + + where: + applicationType << ApplicationType.values().toList() + + } }