OS X Ruby Alarm Clock

Posted by crayz

No real error checking, but it should be pretty obvious whether it works when you run it.

%w(rubygems rbosa chronic).each{ |dep| require dep }

itunes = OSA.app 'iTunes'
wake_at = Chronic.parse ARGV.first
time_until_alarm = wake_at - Time.now

puts "I'll wake you up at #{wake_at}"
sleep time_until_alarm

itunes.play
Comments

Leave a response