1

Wondering if there a grails "command" in much the same way Yii framework for php has? It allows to run scripts like groovy console plugin. I just need to run some tests or scripts on current running app without starting another one environment which takes a lot of time.

I like Grails console, but maybe it's possible to run it from IDE (IDEA) ? Or even better to run tests the same way without need to restart an app. (compiling and database create-drop are annoying)

Tried to use --baseUrl with test-app, but it doesn't work, produces java.lang.IllegalStateException and it too slow too.

What could be the best way to run scripts on running app or tests?

UPDATE: THERE IS NOW run-script command anymore in Grails 3

Alex Shwarc
  • 822
  • 10
  • 20

1 Answers1

1

You can use grails console plugin to run scripts on running enviorment

You Dependency: compile ":console:1.5.5"

For executing scripts from console .You can use

grails run-script src/scripts/appstatus.groovy

You can refer:

http://mrhaki.blogspot.in/2014/05/grails-goodness-run-groovy-scripts-in.html.

If that answers your question

Haider Ali
  • 342
  • 2
  • 11
  • Yes I know that, but I want the same from IDE, it's not convenient to type in browser instead of IntelliJ. Also, I want use Spock and get reports and coverage. – Alex Shwarc Sep 14 '15 at 08:55
  • https://www.jetbrains.com/idea/help/running-and-debugging-grails-applications.html may be that URL can help – Haider Ali Sep 14 '15 at 08:58
  • https://www.jetbrains.com/idea/help/evaluating-expressions.html https://www.jetbrains.com/idea/help/running-and-debugging-grails-applications.html https://www.jetbrains.com/idea/help/launching-groovy-interactive-console.html may be that URL can help. – Haider Ali Sep 14 '15 at 09:05
  • Of course I use it, but it's not a file to run, you have to input your code each time you want to test smth. I'm looking for launching tests from the file on running app like console does, but inside IDE. Simply run smth inside current application context. – Alex Shwarc Sep 14 '15 at 09:24
  • http://mrhaki.blogspot.in/2014/05/grails-goodness-run-groovy-scripts-in.html is that you looking for m not exactly getting your question – Haider Ali Sep 14 '15 at 11:36
  • Yes, this is exactly I asked for. Thank you. – Alex Shwarc Sep 14 '15 at 12:23
  • There is no run-script command anymoro in Grails 3 http://stackoverflow.com/questions/30591547/run-script-alternative-in-grails-3/30806256#30806256 – Alex Shwarc Sep 16 '15 at 07:49
  • Hi Alex For 3.0.7 you can visit : https://grails.github.io/grails-doc/latest/guide/commandLine.html this how to create scripts and use them under headings 5.3 Creating Custom Scripts and 5.4 Re-using Grails scripts. Hope that helps – Haider Ali Sep 17 '15 at 04:56
  • I've read it already but it's not enough clear and looks a bit complicated, I simply want to run a script against running server and (running context). – Alex Shwarc Sep 18 '15 at 19:09