Grails

Provide a way for a script to specifiy which environment to run in

Details

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

Description

I have a script in a plugin that I would like to run using the "test" environment, e.g.
grails test test-app-cobertura

I would like the ability to somehow automatically set the environment without having to type it on the command line. GrailsScriptRunner.groovy specifies default environments for some tasks:

static DEFAULT_ENVS = ['war': 'prod','test-app':'test','run-webtest':'test']

Perhaps one solution would be apply a convention, e.g. if a script name begins with test-* (or maybe even test-app-*), then use the test environment.

Issue Links

Activity

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 (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: