aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAlexander Bohn / FI$H2k2013-03-15 19:43:09 -0300
committerSamuel John2013-06-03 22:40:46 +0200
commit74abcd13734c81438131464e93d9f12d9c2ed3b5 (patch)
treed047f455680d5fb4480c9871aed907714c211612 /Library
parent0a684657fd77e487b8394474a3e3d1fa533c0d25 (diff)
downloadhomebrew-74abcd13734c81438131464e93d9f12d9c2ed3b5.tar.bz2
New terminal-notifier formula (first version, revision 3)
The `terminal-notifier` utility (analogous to Growl's `growlnotify` tool) offers a CLI for displaying Apple Notification Center messages. To use the program as distributed, one must call the inner binary of an app bundle (due to a library-linking quirk the author notes, in https://github.com/alloy/terminal-notifier/blob/master/README.markdown) – this formula sidesteps this awkward mode of execution with an exec script (see L#15). New terminal-notifier formula (with test code codoned off apropos its function, redundant calls removed, and adjusted syntax in respect of Homebrew code conventions) Closes #18511. Signed-off-by: Samuel John <github@SamuelJohn.de>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/terminal-notifier.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/Library/Formula/terminal-notifier.rb b/Library/Formula/terminal-notifier.rb
new file mode 100644
index 000000000..f89dc3997
--- /dev/null
+++ b/Library/Formula/terminal-notifier.rb
@@ -0,0 +1,29 @@
+require 'formula'
+
+class TerminalNotifier < Formula
+ homepage 'https://github.com/alloy/terminal-notifier'
+ url 'https://github.com/downloads/alloy/terminal-notifier/terminal-notifier_1.4.2.zip'
+ sha1 'aaf27d82d237c3f4f7c7ffe2e7118dd2552d6e8a'
+
+ def install
+ # Write an executable script to call the app bundles' inner binary
+ # See the developers' note on the matter in the project README:
+ # https://github.com/alloy/terminal-notifier/blob/master/README.markdown
+ prefix.install Dir['*']
+ inner_binary = "#{prefix}/terminal-notifier.app/Contents/MacOS/terminal-notifier"
+ bin.write_exec_script inner_binary
+ chmod 0755, Pathname.new(bin+"terminal-notifier")
+ end
+
+ test do
+ # Display a test notice
+ system "#{bin}/terminal-notifier", \
+ "-title", "Homebrew", \
+ "-subtitle", "Test CLI Notification", \
+ "-message", "Run terminal-notifier (sans args) for usage info", \
+ "-activate", "com.apple.UserNotificationCenter"
+ # We bind the notices' click event to a NOP, essentially,
+ # by stipulating the ID of the notice widget's own app bundle
+ # as that which it should 'activate'.
+ end
+end