Top Level Namespace

Defined Under Namespace

Modules: Git, Kernel, Sawyer Classes: Dir, Numeric, String

Instance Method Summary collapse

Instance Method Details

#notify(message, options = {}, verbose = false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ext/notify.rb', line 8

def notify(message, options = {}, verbose = false)
  # print the given message to STDERR, if the
  # script is running with "--verbose" option
  subtitle = options[:subtitle]
  warn(subtitle ? "#{subtitle}: #{message}" : message) if $VERBOSE
  # send a given message to the Mac OS X Notification Center
  # but only if the git-multi script is running interactively
  # and if the "terminal-notifier" gem has been installed...
  interactive? && defined?(TerminalNotifier) && begin
    options[:title] ||= 'git-multi'
    TerminalNotifier.notify(message, options, verbose)
  end
end