Skip to content

Instantly share code, notes, and snippets.



Forked from xiplias/esca.rb
Created Nov 21, 2011
What would you like to do?
Campfire script for Pomodoro


Simple Campfire notifier for the Pomodoro app, based off xiplias's gist.

The script reads a JSON file to match a leading pomodoro tag with a Campfire account. In the example file there is a campfire account with tag called "wco". Any pomodoros starting with "wco-", "wco_", "wco," will use the "wco" campfire account. If no campfire account exists with the leading tag, nothing will be broadcast.


First, clone down the repo and install the gem dependency campy:

git clone git:// ~/Dropbox/esca
sudo gem install campy --no-ri --no-rdoc

On the Mac, the system installed Ruby will be used (hence the sudo).

Now modify campfire.json with your campfire account (or accounts). Finally, open Preferences in Pomodoro, go to the Scripts tab, and paste the contents of start.scpt in the Start textarea (and stop.scpt Stop).

"wco": {
"token": "token_api_key_here",
"domain": "widgetco",
"room": "Dev room"
require 'rubygems'
require 'campy'
action, name, duration, *therest = ARGV
account = name.split(/(-|,|_)/).first
json_file = File.join(File.dirname(__FILE__), "campfire.json")
# skip status update if no campfire account is "tagged"
data = MultiJson.decode([account] or exit
room = => data['domain'], :room => data['room'],
:token => data['token'])
end_time = + (60*duration.to_i)
formated_end_time = end_time.getutc.strftime("%H:%M:%S-0000")
case action
when "start"
msg = "Started '#{name}' - " +
"Ends in #{duration} minutes at #{formated_end_time}"
when "reset"
msg = "Reset '#{name}'"
when "stop"
msg = "Stopped '#{name}'"
room.speak "Pomodoro: #{msg}"
## Put into the Reset field in the Scripts tab in Pomodoro
do shell script "ruby ~/Dropbox/esca/esca.rb reset \"$pomodoroName\""
## Put into the Start field in the Scripts tab in Pomodoro
do shell script "ruby ~/Dropbox/esca/esca.rb start \"$pomodoroName\" $duration"
## Put into the Stop field in the Scripts tab in Pomodoro
do shell script "ruby ~/Dropbox/esca/esca.rb stop \"$pomodoroName\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.