comparison init.gradle @ 162:29c3af8dc031

add default global deploy.mode
author Dave Smith <smith@nwoca.org>
date Tue, 14 Jan 2014 01:03:52 +0000
parents 8dd6adab9388
children c5f09d617715
comparison
equal deleted inserted replaced
161:8dd6adab9388 162:29c3af8dc031
379 379
380 println "Environment is: $gradle.env ($envOverrides)" 380 println "Environment is: $gradle.env ($envOverrides)"
381 def slurper = new ConfigSlurper(gradle.env) 381 def slurper = new ConfigSlurper(gradle.env)
382 slurper.setBinding(['gradle': gradle ]) 382 slurper.setBinding(['gradle': gradle ])
383 383
384 def environment = new ConfigObject() 384 def environment = slurper.parse (
385 '''deploy.mode="production"
386 environments {
387 test { deploy.mode="test" }
388 dev { deploy.mode="development"}
389 }''')
390 if (developerPrivate['deploy.mode']) { environment.put('deploy.mode',developerPrivate['deploy.mode']) }
391
385 def environments = [] 392 def environments = []
386 393 gradle.ext.environment = environment
387 file('.').eachFileMatch(~/^environment.*\.groovy$/) { envFile -> 394 file('.').eachFileMatch(~/^environment.*\.groovy$/) { envFile ->
388 def envName = envFile.name - '.groovy' 395 def envName = envFile.name - '.groovy'
389 def privateFile = file("private" + envName - "environment" + ".groovy") 396 def privateFile = file("private" + envName - "environment" + ".groovy")
390 logger.info("loading environment $envFile.name") 397 logger.info("loading environment $envFile.name")
391 398
418 } 425 }
419 environment.merge(slurper.parse(developerPrivate)) 426 environment.merge(slurper.parse(developerPrivate))
420 def deployMode = environment.deploy.mode ?: 'development' 427 def deployMode = environment.deploy.mode ?: 'development'
421 environments.each { gradle.ext[it].put('ssdt.deployment.mode',deployMode) } 428 environments.each { gradle.ext[it].put('ssdt.deployment.mode',deployMode) }
422 environments << 'environment' 429 environments << 'environment'
423 gradle.ext.environment = environment
424 gradle.ext.environments = environments 430 gradle.ext.environments = environments
425 431
426 } 432 }