class Bluemoon::Notify

Public Class Methods

failure(message, flags = '') click to toggle source
# File lib/bluemoon/notify.rb, line 29
def self.failure(message, flags = '')
  puts message

  `terminal-notifier-failed \
    -message "#{message}" \
    #{flags} \
    -title "Bluemoon" \
    -group bluemoon &>/dev/null`
end
handle(exception) click to toggle source
# File lib/bluemoon/notify.rb, line 3
def self.handle(exception)
  "#{ENV['HOME']}/bluemoon-error-logs.txt".tap do |error_log|
    File.open(error_log, 'a') do |file|
      file.write exception.message
      file.write exception.backtrace.join("\n")
    end

    Notify.failure(
      "Failed to gather location, enabled bluetooth",
      "-execute 'open #{error_log}'"
    )
  end

  puts  exception.message
  puts *exception.backtrace
end
success(message) click to toggle source
# File lib/bluemoon/notify.rb, line 20
def self.success(message)
  puts message

  `terminal-notifier-success \
    -message "#{message}" \
    -title "Bluemoon" \
    -group bluemoon &>/dev/null`
end