Sign in to edit and +1 items.
Login required
Download

Scripting plugin

(0)
Author(s) Bruno Cavaler Ghisi
Current Release 0.1.1   (1 year ago)
Grails Version 1.1.1 > *
Tags groovy  script  scripting 
Dependency
compile ":scripting:0.1.1"
Last updated by brunogh 1 year ago
Just execute following from your application directory:
grails install-plugin scripting
Last updated by brunogh 1 year ago
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 view

You can add Groovy scripts and run them using the default CRUD view. It is available at /script.

Service

There 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 script

You can use Script.findByLabel() to get your Script object.

Example

For example, add the following script code and run it. You will get the script list.

import scripting.Script;
return Script.findAll();

Future

If you want to contributte, feel free:

  • Add new languages support.
  • Improve current view (eg: adding language syntax editor)
  • Improve unit/integration tests
Last updated by admin 1 year ago
Last updated by admin 1 year ago