Grails

Allow scripts to define default environment

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.1
  • Fix Version/s: 1.0.2
  • Component/s: None
  • Labels:
    None

Description

Grails is currently hard-coded to use default environments for the scripts provided with the distribution. Any scripts provided by a plugin or a project default to 'dev'. However, a script like 'TestAppCobertura' provided by the code coverage plugin should default to the 'test' environment. So, we need some way of specifying the default environment for a script, either via a naming convention or a property in the script.

Issue Links

Activity

Hide
Peter Ledbrook added a comment -

This is similar to the enhancement to allow other scripts as 'outside of project' ones, so they may best be tackled together.

Show
Peter Ledbrook added a comment - This is similar to the enhancement to allow other scripts as 'outside of project' ones, so they may best be tackled together.
Hide
Graeme Rocher added a comment -

Is

System.setProperty("grails.env", "test")

Not sufficient?

Show
Graeme Rocher added a comment - Is System.setProperty("grails.env", "test") Not sufficient?
Hide
Peter Ledbrook added a comment -

This doesn't really work because it will override any explicit setting the user provides. It's not even possible to check whether an explicit environment has already been set because 'grails.env' will always be set.

Show
Peter Ledbrook added a comment - This doesn't really work because it will override any explicit setting the user provides. It's not even possible to check whether an explicit environment has already been set because 'grails.env' will always be set.
Hide
Graeme Rocher added a comment -

scripts can now add a property like

scriptEnv = "development"

To the top of the script above the includeTargets calls such as

includeTargets << new File ( "${grailsHome}/scripts/TestApp.groovy" )

The Init.groovy script calls a target called setupEnvironment automatically that looks for this setting in the binding

Show
Graeme Rocher added a comment - scripts can now add a property like scriptEnv = "development" To the top of the script above the includeTargets calls such as includeTargets << new File ( "${grailsHome}/scripts/TestApp.groovy" ) The Init.groovy script calls a target called setupEnvironment automatically that looks for this setting in the binding
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: