Skip to content

Instantly share code, notes, and snippets.

@nakajima
Created November 1, 2010 22:36
Show Gist options
  • Select an option

  • Save nakajima/658998 to your computer and use it in GitHub Desktop.

Select an option

Save nakajima/658998 to your computer and use it in GitHub Desktop.
Lets you post to campfire from the command line. It might already exist.
#!/usr/bin/env ruby
# Usage:
#
# $ campfire "Hello Everyone"
#
# You can also paste
#
# $ campfire -p "some code"
#
# You can also pipe into it
#
# $ git log | grep "for some reason" | campfire -p
#
# That's about it.
require 'rubygems'
require 'tinder'
TOKEN = "YOUR_TOKEN"
ROOM_NAME = "YOUR ROOM NAME"
campfire = Tinder::Campfire.new 'groupmehq', :token => TOKEN
room = campfire.rooms.detect { |room| room.name == ROOM_NAME }
if ARGV.delete('-p') || ARGV.delete('--paste')
method = :paste
else
method = :speak
end
if ARGV.empty?
text = STDIN.read
else
text = ARGV.join(' ')
end
room.send(method, text)
puts "message sent."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment