Permalink
Browse files

fix for GRAILS-4243

  • Loading branch information...
1 parent 76295c2 commit dd84a794b89aa31068b26577a6e6b4262454cb86 @graemerocher graemerocher committed Jul 22, 2009
Showing with 73 additions and 73 deletions.
  1. +0 −71 grails/scripts/_GrailsPlugins.groovy
  2. +73 −2 grails/scripts/_PluginDependencies.groovy
@@ -43,77 +43,6 @@ target(cachePlugin:"Implementation target") {
fullPluginName = cacheKnownPlugin(pluginName, pluginRelease)
}
-
-doInstallPluginFromURL = { URL url ->
- withPluginInstall {
- downloadRemotePlugin(url, pluginsBase)
- }
-}
-
-doInstallPluginZip = { File file ->
- withPluginInstall {
- cacheLocalPlugin(file)
- }
-}
-
-doInstallPlugin = { name, version = null ->
- withPluginInstall {
- cacheKnownPlugin(name,version)
- }
-}
-
-doInstallPluginFromGrailsHomeOrRepository = { name, version = null ->
- withPluginInstall {
- boolean hasVersion = name && version
- File pluginZip
- if(hasVersion) {
- def zipName = "grails-${name}-${version}"
- pluginZip = new File("${grailsSettings.grailsHome}/plugins/${zipName}.zip")
- if(!pluginZip.exists()) {
- pluginZip = new File("${grailsSettings.grailsWorkDir}/plugins/${zipName}.zip")
- }
- }
- else {
- def zipNameNoVersion = "grails-${name}"
- pluginZip = findZip(zipNameNoVersion,"${grailsSettings.grailsHome}/plugins")
- if(!pluginZip?.exists()) {
- pluginZip = findZip(zipNameNoVersion,"${grailsSettings.grailsWorkDir}/plugins")
- }
- }
-
-
- if(pluginZip?.exists()) {
- cacheLocalPlugin(pluginZip)
- }
- else {
- cacheKnownPlugin(name,version)
- }
- }
-}
-
-File findZip(String name, String dir) {
- new File(dir).listFiles().find {it.name.startsWith(name)}
-}
-
-private withPluginInstall(Closure callable) {
- try {
- fullPluginName = callable.call()
- completePluginInstall(fullPluginName)
- }
- catch (e) {
- logError("Error installing plugin: ${e.message}", e)
- exit(1)
- }
-}
-
-
-private completePluginInstall (fullPluginName) {
- classpath ()
- println "Installing plug-in $fullPluginName"
- installPluginForName(fullPluginName)
-}
-
-
target(installPlugin:"Installs a plug-in for the given URL or name and version") {
depends(checkVersion, parseArguments, configureProxy)
try {
@@ -303,8 +303,7 @@ target(resolveDependencies:"Resolve plugin dependencies") {
if(!pluginLoc?.exists()) {
println "Plugin [${fullName}] not installed, resolving.."
- cacheKnownPlugin(name, version)
- installPluginForName(fullName)
+ doInstallPluginFromGrailsHomeOrRepository name, version
installedPlugins = true
}
}
@@ -1022,6 +1021,78 @@ installPluginForName = { String fullPluginName ->
}
}
+
+doInstallPluginFromURL = { URL url ->
+ withPluginInstall {
+ downloadRemotePlugin(url, pluginsBase)
+ }
+}
+
+doInstallPluginZip = { File file ->
+ withPluginInstall {
+ cacheLocalPlugin(file)
+ }
+}
+
+doInstallPlugin = { name, version = null ->
+ withPluginInstall {
+ cacheKnownPlugin(name,version)
+ }
+}
+
+doInstallPluginFromGrailsHomeOrRepository = { name, version = null ->
+ withPluginInstall {
+ boolean hasVersion = name && version
+ File pluginZip
+ if(hasVersion) {
+ def zipName = "grails-${name}-${version}"
+ pluginZip = new File("${grailsSettings.grailsHome}/plugins/${zipName}.zip")
+ if(!pluginZip.exists()) {
+ pluginZip = new File("${grailsSettings.grailsWorkDir}/plugins/${zipName}.zip")
+ }
+ }
+ else {
+ def zipNameNoVersion = "grails-${name}"
+ pluginZip = findZip(zipNameNoVersion,"${grailsSettings.grailsHome}/plugins")
+ if(!pluginZip?.exists()) {
+ pluginZip = findZip(zipNameNoVersion,"${grailsSettings.grailsWorkDir}/plugins")
+ }
+ }
+
+
+ if(pluginZip?.exists()) {
+ cacheLocalPlugin(pluginZip)
+ }
+ else {
+ cacheKnownPlugin(name,version)
+ }
+ }
+}
+
+File findZip(String name, String dir) {
+ new File(dir).listFiles().find {it.name.startsWith(name)}
+}
+
+private withPluginInstall(Closure callable) {
+ try {
+ fullPluginName = callable.call()
+ completePluginInstall(fullPluginName)
+ }
+ catch (e) {
+ logError("Error installing plugin: ${e.message}", e)
+ exit(1)
+ }
+}
+
+
+private completePluginInstall (fullPluginName) {
+ classpath ()
+ println "Installing plug-in $fullPluginName"
+ installPluginForName(fullPluginName)
+}
+
+
+
def registerPluginWithMetadata(String pluginName, pluginVersion) {
metadata['plugins.' + pluginName] = pluginVersion
metadata.persist()

0 comments on commit dd84a79

Please sign in to comment.