From 4a6e435cda3d8cf7ced7a8eeee55f5871275d559 Mon Sep 17 00:00:00 2001 From: Peter Ledbrook Date: Thu, 27 Jan 2011 14:30:57 +0000 Subject: [PATCH] Upgraded Groovy++ plugin version, made some minor compatibility changes, and added MIXED mode to PluginService. --- grails.org/application.properties | 4 ++-- .../org/grails/plugin/PluginController.groovy | 4 ++-- .../services/org/grails/plugin/PluginService.groovy | 12 ++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/grails.org/application.properties b/grails.org/application.properties index acc00f2..36a5813 100755 --- a/grails.org/application.properties +++ b/grails.org/application.properties @@ -1,7 +1,7 @@ #Grails Metadata file -#Wed Jan 12 15:13:19 GMT 2011 +#Thu Jan 27 14:14:15 GMT 2011 app.grails.version=1.3.6 app.name=site app.servlet.version=2.4 app.version=1.0.1-SNAPSHOT -plugins.groovy-plus-plus=0.4.98 +plugins.groovy-plus-plus=0.4.152 diff --git a/grails.org/grails-app/controllers/org/grails/plugin/PluginController.groovy b/grails.org/grails-app/controllers/org/grails/plugin/PluginController.groovy index 4139763..a6a50cc 100644 --- a/grails.org/grails-app/controllers/org/grails/plugin/PluginController.groovy +++ b/grails.org/grails-app/controllers/org/grails/plugin/PluginController.groovy @@ -348,8 +348,8 @@ class PluginController extends BaseWikiController { try { def maxResults = params.int('max') ?: 10 def offset = params.int('offset') ?: 0 - def (plugins, pluginCount) = pluginService.listPluginsByTagWithTotal(params.tagName, max: maxResults, offset: offset) - return [currentPlugins: plugins, totalPlugins: pluginCount, tagName:params.tagName, max: maxResults, offset: offset] + def result = pluginService.listPluginsByTagWithTotal(params.tagName, max: maxResults, offset: offset) + return [currentPlugins: result[0], totalPlugins: result[1], tagName:params.tagName, max: maxResults, offset: offset] } catch (TagNotFoundException ex) { render view: "tagNotFound", model: [tagName: ex.tagName ?: '', msgCode: ex.code] diff --git a/grails.org/grails-app/services/org/grails/plugin/PluginService.groovy b/grails.org/grails-app/services/org/grails/plugin/PluginService.groovy index f1fbfec..2e79119 100644 --- a/grails.org/grails-app/services/org/grails/plugin/PluginService.groovy +++ b/grails.org/grails-app/services/org/grails/plugin/PluginService.groovy @@ -8,6 +8,7 @@ import org.grails.taggable.Tag import org.grails.taggable.TagLink import org.grails.wiki.WikiPage +@Typed(TypePolicy.MIXED) class PluginService { static int DEFAULT_MAX = 5 @@ -44,11 +45,11 @@ class PluginService { def listPopularPluginsWithTotal(Map args = [max: 200]) { // The Rateable plugin's query only accepts pagination arguments. - def params = [:] + def params = [cache: true] if (args["max"] != null) params["max"] = args["max"] if (args["offset"] != null) params["offset"] = args["offset"] return [ - Plugin.listOrderByAverageRating(cache:true, *:params), + Plugin.listOrderByAverageRating(params), Plugin.countRated() ] } @@ -82,7 +83,8 @@ class PluginService { result << TagLink.countByTagAndType(tag, 'plugin') } else { - result << [] << 0 + result << [] + result << 0 } return result @@ -92,6 +94,7 @@ class PluginService { translateMasterPlugins(generateMasterPlugins()) } + @Typed(TypePolicy.DYNAMIC) def generateMasterPlugins() { try { def pluginLoc = ConfigurationHolder.config?.plugins?.pluginslist @@ -273,6 +276,7 @@ class PluginService { v1Num.compareTo(v2Num) } + @Typed(TypePolicy.DYNAMIC) def getGrailsVersion(plugin) { def xmlLoc = "${ConfigurationHolder.config?.plugins?.location}/grails-${plugin.name}/tags/LATEST_RELEASE/plugin.xml" def xmlUrl = new URL(xmlLoc) @@ -395,7 +399,7 @@ class PluginService { return [sort: "lastReleased", order: "desc"] default: - return "" + return [:] } }