Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A multi-platform unified notification plugin for Grails (Growl, Notify OSD)
Groovy
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
grails-app
scripts
web-app
.classpath
.gitignore
.project
GromGrailsPlugin.groovy
LICENSE.txt
README.md
application.properties
plugin.xml

README.md

Grom

Grom is Dutch for Growl, which already gives away a hint on what this plugin does. This plugin sends grails notifications to a unified notifications daemon. It is currently compatible with Growl for Mac OS X, Growl for Windows and Notify OSD for Linux.

Development of this plugin was inspired by N.A.D.D. Neutralizer, a plugin to decrease development latency by using the speech synthesizer to notify you when a project was up and running. While this was very useful at the time and certainly has it's uses (me and my colleagues even gave feedback to improve support), it was a bit too obtrusive for our liking as it started iTunes if not running and at some point you just wished it stopped talking.

So what would be better than to use Growl instead, as it is unobtrusive and the whole reason for running a notification daemon is to unify messaging into a single location. So I developed Grom initially for Growl on Mac OS X, and I added multi-platform support later by including support for Growl for Windows and Notify OSD for Linux which is by default shipped with Ubuntu.

image

Installation

To install the plugin, add a compile time dependency to your application's BuildConfig:

grails.project.dependency.resolution = {
    ...
    plugins {
        compile ':grom:latest.integration'
        ...
    }
}

or if you only want to use it during development:

grails.project.dependency.resolution = {
    ...
    plugins {
        // development only plugins
        provided(
                    ":grom:latest.integration"
        )

        // the rest of your dependencies
        ...
    }
}

or add it to a certain environment, like the ci environment:

grails.project.dependency.resolution = {
    ...
    plugins {
        ...

        // continuous integration specific plugins
        if (System.getProperty("grails.env") == "ci") {
            compile ":grom:latest.integration"
        }
    }
}

note that a ci environment does not exist by default, but you can easily accomplish that by using the following property grails.env=ci, for example when building the project in Jenkins CI

Examples

Grom will send notifications for default Grails events, but it also possible to send custom notifications by Grom-ing a String:

"bootstrapping application".grom()

If you, at some point in the future, decide to remove the from plugin, either before packaging to a production environment or for some other reason, keep in mind that any custom Grom-ing will break your application as the grom() method will not be available. This can be resolved by using something like:

class MyController {
    def myAction {
        if (String.metaClass.getMetaMethod("grom")) "my action is being called".grom()
    }
}

You can also grom bootstrap messages:

class BootStrap {
    def init = { servletContext ->
        if (String.metaClass.getMetaMethod("grom")) "bootstrapping application".grom()
        ...
    }

    def destroy = {
        if (String.metaClass.getMetaMethod("grom")) "stopping application...".grom()
        ...
    }
} 

The Grom plugin can be in a production package, as it will just not do anything if no notification agent is present. It may spit out a warning to the logfile, but that can be ignored.

Mac OS X support

Most people I know already run Growl as a notification daemon, so I'm pretty sure I'm not telling you anything new here. In order to have any benefit from this plugin you should install Growl to centralize messages. In case you're not familiar with Growl, many Mac applications already support Growl integration so it will be an overall improvement to your Mac experience to have Growl installed. With or without using this plugin.

image

Linux / Ubuntu support

The unified messaging implementation in Ubuntu provided through Notify OSD. I am not entirely sure if it is also available for other distributions, but as Ubuntu is by far the most common distribution used in corporate organizations and home desktop installations, I chose to support Notify OSD. Notify OSD is by default available in (the latest releases of) Ubuntu, however the client binary is not provided so you need to install that to get Grom working on Ubuntu. To do that, just install libnotify-bin and you're good to go:

apt-get install libnotify-bin

While Grom will now work, there are a number of limitations with the default implementation of Notify OSD on Ubuntu:

  • the timeout parameter is broken (notifications stay on the screen too long)
  • the notifications cannot be customized
  • grouping of notifications does not work

Luckily the first two limitations can be solved by using the Leolik patch for Notify OSD. Unfortunately the latter does not seem to be getting picked up anytime soon. Perhaps if more people voted the issue up, as support for grouping is already integrated into this plugin.

image

The default Grails events like 'Server Running' automatically show notifications

image

It's also possible to show custom notifications

Windows support

Growl for Windows basically is a port of Growl for Mac OS X and brings unified messaging to Windows. To have any benefit from this plugin, you should install Growl for Windows and the Microsoft .NET Framework (v2.0 or higher)

If you do not have any of the following notification daemons installed or if you're using a platform which is not -yet?- supported, the Grom plugin will just not send any notifications. Which means you can keep it in a project repository where multiple people work on the same project, without breaking the project on machines that do not support unified notifications.

Something went wrong with that request. Please try again.