« Return to Thread: Extending the _Event system in Grails (Re: was something else I can't remember now)

Re: Extending the _Event system in Grails (Re: was something else I can't remember now)

by Richard Vowles :: Rate this Message:

Reply to Author | View in Thread

I  think you are talking about _Install.groovy? I'm not really sure of what the problems are with _Install, but that doesn't solve the problem with general runtime uses where the Events script depends on compiled classes (which will always fail). I could implement a specific solution to this problem for easyb, I'm just trying to implement a generic solution that won't impact on the performance or use of scripts for anyone who doesn't need to use it.

Can _Install not just depend on compile when it is run?

On Mon, Jun 22, 2009 at 3:20 PM, Luke Daley <ld@...> wrote:

On 22/06/2009, at 12:46 PM, Richard Vowles wrote:

Ok, so since no-one responded to me about their ideal way to solve the problem I am going to propose a solution and if I don't get any "but nay!" comments, I'll go ahead and implement a patch and attach it to a JIRA.

My *suggestion* is this - extend the loadEventsHooks in GrailsBuildEventListener so that it looks for all scripts that *start* with _Events. It processes plain _Events as normal, and when an event is fired it checks to see if there are any _Event_That_Event_Name.groovy scripts anywhere, and if so, loads them in with loadEventScript.

I would have sworn there was an event ("CompileEnd") in the _GrailsCompile.groovy, but I can no-longer find it anywhere. It might be worthwhile to pepper more events around, but I think this is the biggie.

Thus if people need stuff to load after the compilation, they can create a script called _Events_Compile_End.groovy and that will load the extra event triggers into the namespace.

Is there no way to run a compile after the plugin is installed and after that execute the plugin's relevant scripts with the libs and classes from the plugin available?




--
---
Richard Vowles,
Talk to me about development in Grails, Groovy, Java and for the Blackberry
ph: +64275467747, linkedin, skype:rvowles
get 2Gb shared disk space in the cloud - Dropbox, its incredibly useful! - http://tinyurl.com/cmcceh
podcast: http://www.illegalargument.com

 « Return to Thread: Extending the _Event system in Grails (Re: was something else I can't remember now)