Skip to content

Instantly share code, notes, and snippets.

@robey
Created May 20, 2013 18:17
Show Gist options
  • Save robey/5614140 to your computer and use it in GitHub Desktop.
Save robey/5614140 to your computer and use it in GitHub Desktop.

Using "terminal-notifier" here: https://github.com/alloy/terminal-notifier

Make a helper script for terminal-notifier to keep you from killing yourself:

$ cat ~/bin/terminal-notifier 
#!/bin/bash
/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier "$@"

Then alias "gr" to this script to find the nearest gradlew, run it, and notify you when it's done:

function gr {
  if test -x ./gradlew; then
    gradlew="./gradlew"
  else
    if test -x ../gradlew; then
      gradlew="../gradlew"
    fi
  fi

  if $gradlew "$@"; then
    terminal-notifier -title "gradle" -message "Build succeeded."
  else
    terminal-notifier -title "gradle" -message "BUILD FAILED :("
  fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment