Skip to content

Commit

Permalink
Merge pull request #232 from matrei/matrei/issue-229
Browse files Browse the repository at this point in the history
Replace hard-coded values for info.app.name, info.app.version and inf…
  • Loading branch information
puneetbehl authored Nov 13, 2023
2 parents a581c22 + 9fd15b7 commit 0fcca99
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.grails.forge.feature.Feature;
import org.grails.forge.feature.FeaturePhase;
import org.grails.forge.options.Options;
import org.grails.forge.util.VersionInfo;

import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -53,9 +52,9 @@ public boolean isVisible() {
@Override
public void apply(GeneratorContext generatorContext) {
Map<String, Object> appNameConfig = generatorContext.getConfiguration();
appNameConfig.put("info.app.name", generatorContext.getProject().getPropertyName());
appNameConfig.put("info.app.version", "0.1");
appNameConfig.put("info.app.grailsVersion", VersionInfo.getGrailsVersion());
appNameConfig.put("info.app.name", "@info.app.name@");
appNameConfig.put("info.app.version", "@info.app.version@");
appNameConfig.put("info.app.grailsVersion", "@info.app.grailsVersion@");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PropertiesSpec extends BeanContextSpec implements CommandOutputFixture {
def output = generate(ApplicationType.WEB, generatorContext)

then:
output["grails-app/conf/application.properties"].readLines().find {it == 'info.app.name=foo' }
output["grails-app/conf/application.properties"].readLines().find {it == 'info.app.name=@info.app.name@' }
output["grails-app/conf/bootstrap.properties"].readLines().find { it == 'abc=123' }
output["src/test/resources/application-test.properties"].readLines().find { it == 'abc=456' }
output["grails-app/conf/application-prod.properties"].readLines().find { it == 'abc=789' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class YamlSpec extends BeanContextSpec implements CommandOutputFixture {
output["grails-app/conf/application.yml"].contains '''\
info:
app:
name: foo
name: '@info.app.name@'
'''
output["grails-app/conf/bootstrap.yml"] == '''\
abc: 123
Expand Down

0 comments on commit 0fcca99

Please sign in to comment.