Skip to content

Commit baea3ac

Browse files
author
graeme
committed
fix for problem running upgrade when no plugin directory
git-svn-id: https://svn.codehaus.org/grails/trunk@5263 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
1 parent efa3840 commit baea3ac

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

scripts/Upgrade.groovy

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,25 @@ move it to the new location of '${basedir}/test/integration'. Please move the di
157157

158158
// proceed plugin-specific upgrade logic contained in 'scripts/_Upgrade.groovy' under plugin's root
159159
def plugins = new File("${basedir}/plugins/")
160-
plugins.eachFile { f ->
161-
if(f.isDirectory() && f.name != 'core' ) {
162-
// fix for Windows-style path with backslashes
163-
164-
def pluginBase = "${basedir}/plugins/${f.name}".toString().replaceAll("\\\\","/")
165-
// proceed _Upgrade.groovy plugin script if exists
166-
def upgradeScript = new File ( "${pluginBase}/scripts/_Upgrade.groovy" )
167-
if( upgradeScript.exists() ) {
168-
event("StatusUpdate", [ "Executing ${f.name} plugin upgrade script"])
169-
// instrumenting plugin scripts adding 'pluginBasedir' variable
170-
def instrumentedUpgradeScript = "def pluginBasedir = '${pluginBase}'\n" + upgradeScript.text
171-
// we are using text form of script here to prevent Gant caching
172-
includeTargets << instrumentedUpgradeScript
173-
}
174-
}
175-
}
160+
if(plugins.exists()) {
161+
plugins.eachFile { f ->
162+
if(f.isDirectory() && f.name != 'core' ) {
163+
// fix for Windows-style path with backslashes
164+
165+
def pluginBase = "${basedir}/plugins/${f.name}".toString().replaceAll("\\\\","/")
166+
// proceed _Upgrade.groovy plugin script if exists
167+
def upgradeScript = new File ( "${pluginBase}/scripts/_Upgrade.groovy" )
168+
if( upgradeScript.exists() ) {
169+
event("StatusUpdate", [ "Executing ${f.name} plugin upgrade script"])
170+
// instrumenting plugin scripts adding 'pluginBasedir' variable
171+
def instrumentedUpgradeScript = "def pluginBasedir = '${pluginBase}'\n" + upgradeScript.text
172+
// we are using text form of script here to prevent Gant caching
173+
includeTargets << instrumentedUpgradeScript
174+
}
175+
}
176+
}
177+
178+
}
176179

177180
event("StatusUpdate", [ "Please make sure you view the README for important information about changes to your source code."])
178181

0 commit comments

Comments
 (0)