From f79f899eb51046d1cee05ca5c55a9ab45b4461aa Mon Sep 17 00:00:00 2001 From: Goran Ehrsson Date: Mon, 9 Feb 2015 23:54:41 +0100 Subject: [PATCH 1/9] Upgraded project to Grails 2.2.4 --- .gitignore | 14 +++++ NavigationGrailsPlugin.groovy | 4 +- application.properties | 4 +- grails-app/conf/BuildConfig.groovy | 29 +++++++++ grails-app/conf/DataSource.groovy | 63 ++++++++++++-------- grails-app/services/NavigationService.groovy | 3 +- 6 files changed, 84 insertions(+), 33 deletions(-) create mode 100644 .gitignore create mode 100644 grails-app/conf/BuildConfig.groovy diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e768434 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Ignore Intellij IDEA files +.idea +*.iml + +# Ignore build artifacts +target + +# Ignore packaged plugins +*.zip + +stacktrace.log +plugin.xml + +.DS_Store diff --git a/NavigationGrailsPlugin.groovy b/NavigationGrailsPlugin.groovy index 865b850..5edab49 100644 --- a/NavigationGrailsPlugin.groovy +++ b/NavigationGrailsPlugin.groovy @@ -1,8 +1,8 @@ class NavigationGrailsPlugin { - def version = '1.3.2' + def version = '1.3.3-SNAPSHOT' // the version or versions of Grails the plugin is designed for - def grailsVersion = "1.2 > *" + def grailsVersion = "2.0 > *" def dependsOn = [controllers:"1.0 > *"] def observe = ['controllers'] diff --git a/application.properties b/application.properties index a661491..3c1c96a 100644 --- a/application.properties +++ b/application.properties @@ -1,6 +1,4 @@ #Grails Metadata file #Fri Jul 29 12:57:45 BST 2011 -app.grails.version=1.3.7 +app.grails.version=2.2.4 app.name=Navigation -plugins.hibernate=1.3.7 -plugins.tomcat=1.3.7 diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy new file mode 100644 index 0000000..254aef7 --- /dev/null +++ b/grails-app/conf/BuildConfig.groovy @@ -0,0 +1,29 @@ +grails.project.class.dir = "target/classes" +grails.project.test.class.dir = "target/test-classes" +grails.project.test.reports.dir = "target/test-reports" +grails.project.target.level = 1.6 +//grails.project.war.file = "target/${appName}-${appVersion}.war" + +grails.project.dependency.resolution = { + // inherit Grails' default dependencies + inherits("global") { + } + log "warn" + legacyResolve false + repositories { + grailsHome() + grailsCentral() + mavenCentral() + } + dependencies { + } + + plugins { + build(":tomcat:$grailsVersion", + ":release:2.2.1", + ":rest-client-builder:1.0.3" + ) { + export = false + } + } +} diff --git a/grails-app/conf/DataSource.groovy b/grails-app/conf/DataSource.groovy index be249f7..afe0e6f 100644 --- a/grails-app/conf/DataSource.groovy +++ b/grails-app/conf/DataSource.groovy @@ -1,32 +1,43 @@ dataSource { - pooled = true - driverClassName = "org.hsqldb.jdbcDriver" - username = "sa" - password = "" + pooled = true + driverClassName = "org.h2.Driver" + username = "sa" + password = "" } hibernate { - cache.use_second_level_cache=true - cache.use_query_cache=true - cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' + cache.use_second_level_cache = true + cache.use_query_cache = false + cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' } // environment specific settings environments { - development { - dataSource { - dbCreate = "create-drop" // one of 'create', 'create-drop','update' - url = "jdbc:hsqldb:mem:devDB" - } - } - test { - dataSource { - dbCreate = "create-drop" - url = "jdbc:hsqldb:mem:testDb" - } - } - production { - dataSource { - dbCreate = "update" - url = "jdbc:hsqldb:file:prodDb;shutdown=true" - } - } -} \ No newline at end of file + development { + dataSource { + dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', '' + url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000" + } + } + test { + dataSource { + dbCreate = "update" + url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000" + } + } + production { + dataSource { + dbCreate = "update" + url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000" + pooled = true + properties { + maxActive = -1 + minEvictableIdleTimeMillis=1800000 + timeBetweenEvictionRunsMillis=1800000 + numTestsPerEvictionRun=3 + testOnBorrow=true + testWhileIdle=true + testOnReturn=true + validationQuery="SELECT 1" + } + } + } +} diff --git a/grails-app/services/NavigationService.groovy b/grails-app/services/NavigationService.groovy index 1b3aeae..2a90c95 100644 --- a/grails-app/services/NavigationService.groovy +++ b/grails-app/services/NavigationService.groovy @@ -1,5 +1,4 @@ import org.codehaus.groovy.grails.commons.GrailsControllerClass -import org.codehaus.groovy.grails.commons.ConfigurationHolder import org.codehaus.groovy.grails.commons.GrailsClassUtils // @todo subItem sorting @@ -15,7 +14,7 @@ class NavigationService { def reset() { byGroup = ['*':[]] // re-add the manually defined items - ConfigurationHolder.config.navigation?.each { k, v -> + grails.util.Holders.config.navigation?.each { k, v -> doRegisterItem(k, v) } manuallyRegistered.each { item -> From da66597afa3a56ebf0b39929250ba78d9553b022 Mon Sep 17 00:00:00 2001 From: Rick Cabrera Date: Fri, 6 Jun 2014 11:48:54 -0400 Subject: [PATCH 2/9] Use new Holder class to be compatible with Grails 2.4 --- grails-app/services/NavigationService.groovy | 40 ++++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/grails-app/services/NavigationService.groovy b/grails-app/services/NavigationService.groovy index 2a90c95..d3450a5 100644 --- a/grails-app/services/NavigationService.groovy +++ b/grails-app/services/NavigationService.groovy @@ -5,12 +5,12 @@ import org.codehaus.groovy.grails.commons.GrailsClassUtils class NavigationService { static transactional = false - + def manuallyRegistered = [] def byGroup = ['*':[]] def hidden = new HashSet() def activePathByRequestArgs = [:] - + def reset() { byGroup = ['*':[]] // re-add the manually defined items @@ -51,7 +51,7 @@ class NavigationService { } return k.toString() } - + def reverseMapActivePathFor(controller, action, params) { // Try first with params def kWithParams = makeReverseMapKey(controller, action, params) @@ -62,7 +62,7 @@ class NavigationService { } return path ?: kWithParams.tokenize('/') } - + void calculatePath(pathValue, item) { if (pathValue) { item.path = pathValue instanceof List ? pathValue : pathValue.tokenize('/') @@ -75,7 +75,7 @@ class NavigationService { } } } - + def populateItem(src, item, controllerGrailsClass) { item.action = src.action ?: (controllerGrailsClass ? controllerGrailsClass.defaultAction : 'index') item.order = src.order @@ -99,15 +99,15 @@ class NavigationService { * Register a navigation item by convention */ def registerItem(GrailsControllerClass controllerGrailsClass) { - def p = [ + def p = [ controller:controllerGrailsClass.logicalPropertyName ] - def grp + def grp def navInfo = '*' if (controllerGrailsClass.clazz.metaClass.hasProperty(controllerGrailsClass.clazz, 'navigation')) { navInfo = controllerGrailsClass.clazz.navigation - if (navInfo == false) { - return + if (navInfo == false) { + return } if (navInfo == true) { navInfo = '*' @@ -118,7 +118,7 @@ class NavigationService { grp = navInfo.group } else if (navInfo instanceof List) { - // Handle lists of info + // Handle lists of info navInfo.each { info -> def params = [:] params.controller = p.controller @@ -140,7 +140,7 @@ class NavigationService { } doRegisterItem(grp, p) } - + /** * Manually register a navigation item */ @@ -148,24 +148,24 @@ class NavigationService { def item = doRegisterItem(group, params) manuallyRegistered << [group:group, info:item] } - + protected doRegisterItem(String group, Collection v) { v.eachWithIndex { item, n -> doRegisterItem(group, item, n) } } - + protected doRegisterItem(String group, Map params, defaultOrderValue = null) { params.action = params.action ?: 'index' // @todo should be default action of controller - + def item = [:] item.controller = params.controller if (!params.order) { params.order = defaultOrderValue } populateItem(params, item, null) - + def k = makeReverseMapKey(item.controller, item.action, item.params) activePathByRequestArgs[ k ] = item.path - + if (!group) group = '*' def catInfo = byGroup[group] @@ -176,21 +176,21 @@ class NavigationService { if (group != '*') { byGroup['*'] << item } - + return item } - + def hide(String controller) { hidden << controller } - + /** * Must be called after you have registered your items, to enforce ordering */ def updated() { byGroup.keySet().each { k -> byGroup[k] = byGroup[k].findAll { info -> !hidden.contains(info.controller) } - byGroup[k] = byGroup[k]?.sort { a, b -> + byGroup[k] = byGroup[k]?.sort { a, b -> if (b.order) { return a.order?.compareTo(b.order) ?: 0 } else return +1 // items with no ordering come last From c74144ce7cfdad91d0c7ace00711da4a4dad4d2d Mon Sep 17 00:00:00 2001 From: Rick Cabrera Date: Fri, 6 Jun 2014 17:28:34 -0400 Subject: [PATCH 3/9] Update grails version to 2.4.0 and references to plugins --- application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.properties b/application.properties index 3c1c96a..77ea2ed 100644 --- a/application.properties +++ b/application.properties @@ -1,4 +1,4 @@ #Grails Metadata file #Fri Jul 29 12:57:45 BST 2011 -app.grails.version=2.2.4 +app.grails.version=2.4.4 app.name=Navigation From 1259ed6001164724ba4c379edf4d810a18fcff18 Mon Sep 17 00:00:00 2001 From: Rick Cabrera Date: Fri, 6 Jun 2014 17:29:54 -0400 Subject: [PATCH 4/9] Update version and supported Grails version --- NavigationGrailsPlugin.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NavigationGrailsPlugin.groovy b/NavigationGrailsPlugin.groovy index 5edab49..dbab55b 100644 --- a/NavigationGrailsPlugin.groovy +++ b/NavigationGrailsPlugin.groovy @@ -2,7 +2,7 @@ class NavigationGrailsPlugin { def version = '1.3.3-SNAPSHOT' // the version or versions of Grails the plugin is designed for - def grailsVersion = "2.0 > *" + def grailsVersion = "2.4 > *" def dependsOn = [controllers:"1.0 > *"] def observe = ['controllers'] From 6382038d0c1292dc80c0fe795c0e21fb8149e523 Mon Sep 17 00:00:00 2001 From: Rick Cabrera Date: Fri, 6 Jun 2014 18:19:49 -0400 Subject: [PATCH 5/9] Fix Holders import and class usage --- grails-app/services/NavigationService.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grails-app/services/NavigationService.groovy b/grails-app/services/NavigationService.groovy index d3450a5..c0fb657 100644 --- a/grails-app/services/NavigationService.groovy +++ b/grails-app/services/NavigationService.groovy @@ -14,7 +14,7 @@ class NavigationService { def reset() { byGroup = ['*':[]] // re-add the manually defined items - grails.util.Holders.config.navigation?.each { k, v -> + Holders.config.navigation?.each { k, v -> doRegisterItem(k, v) } manuallyRegistered.each { item -> From 04ae039e199c0eccf2f3050aa48f77ff01a83ef6 Mon Sep 17 00:00:00 2001 From: Luca Orlandi Date: Thu, 31 Jul 2014 17:44:30 +0200 Subject: [PATCH 6/9] Added release to locally deploy artifact --- grails-app/conf/BuildConfig.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index 254aef7..a5a9b0f 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -2,27 +2,27 @@ grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.project.target.level = 1.6 -//grails.project.war.file = "target/${appName}-${appVersion}.war" +grails.project.fork = false + +grails.project.dependency.resolver = "maven" grails.project.dependency.resolution = { - // inherit Grails' default dependencies - inherits("global") { - } - log "warn" - legacyResolve false + + inherits("global") + repositories { - grailsHome() grailsCentral() + mavenLocal() mavenCentral() } dependencies { + // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. + + // runtime 'mysql:mysql-connector-java:5.1.5' } plugins { - build(":tomcat:$grailsVersion", - ":release:2.2.1", - ":rest-client-builder:1.0.3" - ) { + build ':release:3.0.1', { export = false } } From 0893e0a4257ff68a98350731e2a93a7a6fa7897c Mon Sep 17 00:00:00 2001 From: Luca Orlandi Date: Thu, 31 Jul 2014 17:44:44 +0200 Subject: [PATCH 7/9] Updated grails version --- application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.properties b/application.properties index 77ea2ed..024782a 100644 --- a/application.properties +++ b/application.properties @@ -1,4 +1,4 @@ #Grails Metadata file #Fri Jul 29 12:57:45 BST 2011 -app.grails.version=2.4.4 +app.grails.version=2.4.2 app.name=Navigation From 133883604c23ce6467e18bedae01e8eaab598224 Mon Sep 17 00:00:00 2001 From: Luca Orlandi Date: Thu, 31 Jul 2014 17:45:06 +0200 Subject: [PATCH 8/9] Incremented version number + SNAPSHOT --- NavigationGrailsPlugin.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NavigationGrailsPlugin.groovy b/NavigationGrailsPlugin.groovy index dbab55b..91c63b0 100644 --- a/NavigationGrailsPlugin.groovy +++ b/NavigationGrailsPlugin.groovy @@ -1,5 +1,5 @@ class NavigationGrailsPlugin { - def version = '1.3.3-SNAPSHOT' + def version = '1.4.0-SNAPSHOT' // the version or versions of Grails the plugin is designed for def grailsVersion = "2.4 > *" From 7507ef7130d5ca82471c75e6f18bb916a39a9180 Mon Sep 17 00:00:00 2001 From: Goran Ehrsson Date: Tue, 10 Feb 2015 00:23:25 +0100 Subject: [PATCH 9/9] Upgraded project to Grails 2.4.4 --- application.properties | 2 +- grails-app/services/NavigationService.groovy | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/application.properties b/application.properties index 024782a..77ea2ed 100644 --- a/application.properties +++ b/application.properties @@ -1,4 +1,4 @@ #Grails Metadata file #Fri Jul 29 12:57:45 BST 2011 -app.grails.version=2.4.2 +app.grails.version=2.4.4 app.name=Navigation diff --git a/grails-app/services/NavigationService.groovy b/grails-app/services/NavigationService.groovy index c0fb657..d6acadd 100644 --- a/grails-app/services/NavigationService.groovy +++ b/grails-app/services/NavigationService.groovy @@ -6,6 +6,8 @@ class NavigationService { static transactional = false + def grailsApplication + def manuallyRegistered = [] def byGroup = ['*':[]] def hidden = new HashSet() @@ -14,7 +16,7 @@ class NavigationService { def reset() { byGroup = ['*':[]] // re-add the manually defined items - Holders.config.navigation?.each { k, v -> + grailsApplication.config.navigation?.each { k, v -> doRegisterItem(k, v) } manuallyRegistered.each { item ->