Overview

README

This is a quick and dirty script that allows the running of a groovy script within the grails context. This means that the script has access to the hibernate session and that your GORM domain classes are hooked up (as well as any other plugins that you might have installed).

If you're able to execute the script within a "grails console" you should be able to use run-script to execute it from the command line.

Syntax:

grails run-script path-to-script/scriptName.groovy

Example (included in this sample grails app):

grails run-script userScripts/createBook.groovy

If you take a look at that script, you'll see that it creates and Author and some Books and saves them to the database. It then asserts that they are there. This shows the interaction with the database as well as the domain objects.