(Quick Reference)

create-script

目的
Purpose

The create-script command creates a new Grails executable script that can be run with the grails command from a terminal window.

使用例
Examples

The command:

grails create-script execute-report

Creates a script called scripts/ExecuteReport.groovy such as:

target('default': "The description of the script goes here!") {
    doStuff()
}
target(doStuff: "The implementation task") {
   // logic here
}

The command can then be run with:

grails execute-report

詳細
Description

The command will translate lower case command names separated by hyphens into a valid Groovy camel-cased class name. For example create-controller would become a script called scripts/CreateController.groovy.

The script generated is a Gant script which can use Gant's capabilities to depend on other scripts from Grails core. Refer to the section on Command Line Scripting in the user guide.

使用方法:

Usage:

grails create-script [name]

発生するイベント:

Fired Events:
  • CreatedFile - When the script has been created