Scripting plugin

  • Tags: groovy, scripting, script
  • Latest: 0.1.1
  • Last Updated: 20 December 2010
  • Grails version: 1.1.1 > *
  • Authors: null
0 vote
Dependency:
compile ":scripting:0.1.1"

 Documentation

Summary

Installation

Just execute following from your application directory:
grails install-plugin scripting

Description

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