I'm tring to create a grails scritp ('grails create-script foo') that should receive two arguments. In it's implematition, it should call some command lines like: generate-views and generate-controllers and others commands, passing one of the parameters received.
So far I've got this: includeTargets << grailsScript("_GrailsInit")
target(foo: "The description of the script goes here!") {
def arguments= args
//grails create-controller arguments
}
setDefaultTarget(foo)
Anyone knows how to do this? Call a grails command inside a custom script?
Obs: I'm using grails 2.5.5
This should be as easy as including the scripts you want to use in yours via includeTargets << grailsScript()
.
The available scripts are located in your Grails install directory under scripts
.
In your case you might want to look at the contents of _GrailsCreateArtifacts.groovy
.
Once you've included the correct script(s), all you need to do is call the corresponding closure.
Update
The Generate-XXX scripts are provided by the scaffolding plugin. This plugin (in zip form) is located under the plugins
directory of your Grails install. In the zip file you will find a scripts
directory which has all the scripts for the plugin. Including the GenerateViews.groovy
.