Last active
September 14, 2016 13:35
-
-
Save danthegoodman/3707511 to your computer and use it in GitHub Desktop.
Desktop Notification on Grails Start, Test Complete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Save in ~/.grails/scripts/_Events.groovy | |
def start = new Date(); | |
eventStatusFinal = { msg -> | |
if(msg.startsWith("Server running.")) { | |
println 'Startup time = ' + timeDiff(start) | |
notification("Grails Started") | |
} | |
} | |
eventTestPhasesEnd = { | |
println 'Testing time = ' + timeDiff(start) | |
notification("Tests Complete"); | |
} | |
String timeDiff(Date d){ | |
return groovy.time.TimeCategory.minus(new Date(), d) | |
} | |
/* ubuntu */ | |
//void notification(String msg){ | |
// ['notify-send', '--urgency=low', '--hint=int:transient:1', msg].execute() | |
//} | |
/* OSX: iTerm2, "Enable Growl Notifications" */ | |
void notification(String msg){ | |
print new String([27,93,57,59] as byte[]) | |
print msg | |
print new String([7, 10] as byte[]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment