Some Grails 0.5.5 script enhancements

Posted by: on Jun 8, 2007 | One Comment

I’ve committed some minor enhancements to Grails scripts in 0.5.5 HEAD.

They lay the groundwork for some platform-specific extensions to Grails that may come along in future. Graeme, Jeff, Jason and I, among other Grails developers, are OS X users and some people will know I have previously written a script to show Growl notifications based on script events.

Well we weren’t happy with the requirement to install growlnotify shell script from the Growl DMG so I went down a little path of using the Growl Java API. This necessitated some tweaks to grails scripts.

So what’s new in SVN is:

  • startGrails shell script on OS X adds /Library/Java/Home to the classpath before booting up the Gant script engine. This is required for Cocoa APIs to be available to Gant scripts
  • Tweaks to the classpath target of the Init script, which now always adds <home>/.grails/lib jars to the classpath before running scripts. This was required to allow Events.groovy to import the growl API. This mechanism will be useful for other platform specific jars. If you don’t mind looking up classes by name you probably don’t need this because of…
  • A new SetClasspath event is triggered when setting up the classpath for running grails code/scripts and the classpath is now setup even if you run a target that doesn’t depend on the "classpath" task. It turned out this was no good for me as of the previous point, I didn’t fancy class.forName :)
  • Grails now ships with a $GRAILS_HOME/media/icons directory with our new snazzy icons in there, and an OS X format multi-resolution icon file
  • New CompileStart/CompileEnd events (requested by a user) and PluginInstalled is now implemented in 0.5.5 – documentation for events is here

All this adds up to Growl notifications for Grails 0.5.5 being a case of downloading the latest Grails snapshot an then downloading this zip file and then unzipping the contents of that into your ~/.grails directory. Note that using the default unzip UI on OS X you will get the folder GrowlGrails and need to copy the files from there into ~/.grails/lib and ~/.grails/scripts manually. Either that or open a shell and do unzip GrowlGrails.zip :)

Now just do something with grails 0.5.5 and watch the pretty notifications. By default only status updates and final status are growled, but you can now go to Growl Preferences and configure the notifications on a per-event basis. I expect more changes to the list of available events in future. I’m looking to see if we can hook into Gant task execution to provide automatic task X start/end events as the current scheme requires us to add event generating calls to every target, which is likely to be boring and error prone.

1 Comment

  1. Marcelo
    February 19, 2010

    Hi, Im learning Groovy, and whant to know if possible run this implementation on Windows.

    Reply

Leave a Reply