Permalink
Browse files

fix for GRAILS-6970 "Cannot use 'import' statement in Grails Config"

  • Loading branch information...
1 parent bb4aca1 commit 6abd749af4a2ad27231ece08e1f09b44c22d3fdf @graemerocher graemerocher committed Dec 14, 2010
Showing with 9 additions and 12 deletions.
  1. +9 −12 scripts/Upgrade.groovy
@@ -149,18 +149,15 @@ move it to the new location of '${basedir}/test/integration'. Please move the di
// add reasonable defaults for them
def configFile = new File(baseFile, '/grails-app/conf/Config.groovy')
if (configFile.exists()) {
- def configSlurper = new ConfigSlurper()
- def configObject = configSlurper.parse(configFile.toURI().toURL())
- def defaultCodec = configObject.grails.views.default.codec
- def gspEncoding = configObject.grails.views.gsp.encoding
-
- if (!defaultCodec || !gspEncoding) {
- configFile.withWriterAppend {
- it.writeLine '\n// The following properties have been added by the Upgrade process...'
- if (!defaultCodec) it.writeLine 'grails.views.default.codec="none" // none, html, base64'
- if (!gspEncoding) it.writeLine 'grails.views.gsp.encoding="UTF-8"'
- }
- }
+ def configText = configFile.text
+ configFile.withWriterAppend {
+ if(!configText.contains("grails.views.default.codec") ) {
+ it.writeLine 'grails.views.default.codec="none" // none, html, base64'
+ }
+ if(!configText.contains("grails.views.gsp.encoding") ) {
+ it.writeLine 'grails.views.gsp.encoding="UTF-8"'
+ }
+ }
}
if (new File("${basedir}/spring").exists()) {

0 comments on commit 6abd749

Please sign in to comment.