Class: Talkypi

Inherits:
Object
  • Object
show all
Defined in:
lib/talkypi.rb

Class Method Summary collapse

Class Method Details

.runObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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