Just execute following from your application directory:
grails install-plugin scripting
You can create Groovy scripts as CRUDs and run them. You can use it for updating entities dynamically, integrate with jobs, find specific entities persisted, export part of codes, admin stuff, among others. Currently, a Script is something with a label and a content (code).
Admin viewYou can add Groovy scripts and run them using the default CRUD view. It is available at /script.
ServiceThere is a service available called ScriptService. The service provides two methods.def run(Script script, params)def run(String scriptContent, params)
- script:model entity
- scriptContent: string with the script
- params: hashtable of params
Finding a scriptYou can use Script.findByLabel() to get your Script object.
ExampleFor example, add the following script code and run it. You will get the script list.
import scripting.Script; return Script.findAll();
FutureIf you want to contributte, feel free:
- Add new languages support.
- Improve current view (eg: adding language syntax editor)
- Improve unit/integration tests