Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails run-script with argument

Tags:

grails

I want to create grails script which adds an admin account to my application. Something like:

grails run-script utils/adminAdd.groovy username password

Unfortunately, it seems like run-script doesn't support passing arguments to scripts (allowing one to run multiple scripts at once, instead). Anyone knows a workaround?

like image 615
joozek Avatar asked Oct 18 '11 09:10

joozek


1 Answers

This should be supported, so you should create an issue at http://jira.grails.org/browse/GRAILS

In the meantime I think to keep backwards compatibility you probably need a way to differentiate script names from args, e.g. a prefix:

grails run-script utils/adminAdd.groovy -Jusername -Jpassword -Jfoo=bar

Then run-script could split out the args list into un-prefixed script names and send the de-prefixed args to each script as it runs.

Once you get it working locally send a pull request or attach the updated script to the JIRA and it'll get fixed a lot quicker.

like image 136
Burt Beckwith Avatar answered Nov 19 '22 05:11

Burt Beckwith