0df0e771f1
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 Homebrew/homebrew#18511. Signed-off-by: Samuel John <github@SamuelJohn.de>
29 lines
1.1 KiB
Ruby
29 lines
1.1 KiB
Ruby
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
|