class Talkypi

Public Class Methods

run() click to toggle source
# File lib/talkypi.rb, line 29
def self.run
  config_file = "~/.talkypi"
  
  begin
    userkey = File.read(File.expand_path(config_file))
  rescue
    puts "Unable to read configuration file #{config_file}"
    exit 1
  end
  
  if not ARGV.count == 2 then
    puts "Usage: #{File.basename($0)} [EVENT][DESCRIPTION]"
    exit
  end
  
  event = ARGV[0]
  description = ARGV[1]
  
  Prowl.add(
    :apikey => userkey.chomp,
    :application => "talkypi",
    :event => event,
    :description => description
  )
end