public

Code that you can add to your app's BuildConfig to enable you to specify in-place plugins outside of source controlled files

  • Download Gist
ExternalInPlacePlugin_BuildConfig.groovy
Groovy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
def buildConfigFile = new File("${userHome}/.grails/${appName}-buildConfig.groovy")
if (buildConfigFile.exists()) {
println "Processing external build config at $buildConfigFile"
def slurpedBuildConfig = new ConfigSlurper().parse(buildConfigFile.toURL())
slurpedBuildConfig.grails.plugin.location.each { k, v ->
if (!new File(v).exists()) {
println "WARNING: Cannot load in-place plugin from ${v} as that directory does not exist."
} else {
println "Loading in-place plugin $k from $v"
grails.plugin.location."$k" = v
}
if (grailsSettings.projectPluginsDir?.exists()) {
grailsSettings.projectPluginsDir.eachDirMatch(~/${k}.*/) {dir ->
println "WARNING: Found a plugin directory at $dir that is a possible conflict and may prevent grails from using the in-place $k plugin."
}
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.