class Guard::Notifier::FileNotifier


notification :file, path: ‘tmp/guard_result’
@example Add the ‘:file` notifier to your `Guardfile`
Writes Guard notification results to a file.

def self.available?(opts = {})

Options Hash: (**opts)
  • path (Boolean) -- the path to a file where Guard notification

Parameters:
  • opts (Hash) -- some options
def self.available?(opts = {})
  super and opts.has_key?(:path)
end

def _write(path, contents)

def _write(path, contents)
  File.write(path, contents)
end

def notify(message, opts = {})

Options Hash: (**opts)
  • path (String) -- the path of where to write the file
  • format (String) -- printf style format for file contents
  • image (String) -- the path to the notification image
  • title (String) -- the notification title
  • type (String) -- the notification type. Either 'success',

Parameters:
  • opts (Hash) -- additional notification library options
  • message (String) -- the notification message body
def notify(message, opts = {})
  super
  if opts[:path]
    format = opts.fetch(:format, DEFAULTS[:format])
    _write(opts[:path], format % [opts[:type], opts[:title], message])
  else
    ::Guard::UI.error ':file notifier requires a :path option'
  end
end