Allows sending user notifications in a cross-platform way.
A list of commandline tool names that can be used to send notifications
Send a notification. If no notifier is found, no notification will be created.
@param [String] message The message to include in the notification
# File lib/nanoc/cli/commands/watch.rb, line 107 def notify(message) return if tool.nil? if tool == 'growlnotify' && self.on_windows? growlnotify_windows(message) else send(tool.tr('-', '_'), message) end end
# File lib/nanoc/cli/commands/watch.rb, line 155 def growlnotify(message) system(*growlnotify_cmd_for(message)) end
# File lib/nanoc/cli/commands/watch.rb, line 151 def growlnotify_cmd_for(message) [ 'growlnotify', '-m', message ] end
# File lib/nanoc/cli/commands/watch.rb, line 163 def growlnotify_windows(message) system(*growlnotify_windows_cmd_for(message)) end
# File lib/nanoc/cli/commands/watch.rb, line 159 def growlnotify_windows_cmd_for(message) [ 'growlnotify', '/t:nanoc', message ] end
# File lib/nanoc/cli/commands/watch.rb, line 130 def have_tool?(tool) if self.on_windows? self.have_tool_windows?(tool) else self.have_tool_nix?(tool) end end
# File lib/nanoc/cli/commands/watch.rb, line 118 def have_tool_nix?(tool) !`which #{tool}`.empty? rescue Errno::ENOENT false end
# File lib/nanoc/cli/commands/watch.rb, line 124 def have_tool_windows?(tool) !`where #{tool} 2> nul`.empty? rescue Errno::ENOENT false end
# File lib/nanoc/cli/commands/watch.rb, line 167 def notify_send(message) system('notify-send', message) end
# File lib/nanoc/cli/commands/watch.rb, line 171 def on_windows? Nanoc.on_windows? end
Generated with the Darkfish Rdoc Generator 2.