changeset 107:167745cd8af9

add support for private environment files in slurper format
author smith@nwoca.org
date Mon, 04 Jun 2012 23:36:30 +0100
parents 34bb1f5b9027
children bb3fa722df51
files init.gradle
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/init.gradle	Wed May 16 18:24:23 2012 +0100
+++ b/init.gradle	Mon Jun 04 23:36:30 2012 +0100
@@ -142,16 +142,24 @@
     
     file('.').eachFileMatch(~/^environment.*\.groovy$/) { envFile ->
         def envName = envFile.name - '.groovy'
+        def privateFile = file("private" + envName - "environment" + ".groovy")
         logger.info("loading environment $envFile.name")
+
         def envCfg = slurper.parse(envFile.toURL())
         envCfg.merge(slurper.parse(developerPrivate))
+        if (privateFile.exists()) {
+            logger.info("loading private environment $privateFile")
+            envCfg.merge(slurper.parse(privateFile.toURL()))
+        }
+        
         gradle.rootProject.getProperties().find { it.key.startsWith('environment')  }.each {
             it.value.split(',').each { p ->
                 def (k,v) = p.split('=')
-                logger.info("$envName: overriding " + k + "=" + v)
+                logger.info("$envName: overriding " + k + "=" + v  + " in $it")
                 envCfg.put(k,v)
             }
         }
+        
         envOverrides.each { k,v ->
             logger.info("$envName: overriding " + k + "=" + v)
             envCfg.put(k,v)