Created
November 1, 2010 22:36
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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