Twitter Gem Gets STDIN
April 2nd, 2008
Jeremy, from my local ruby group, had a sweet idea. He was piping crontab commands into mail and thought “why not use twitter?” He hacked around a bit and sent me some code. I tweaked a couple things and now, as of version 0.2.6, the twitter gem can take stdin when posting from the command line. Below are a few examples from the changelog.
$ twitter post 'test without stdin'
# => twitters: "test without stdin"
$ echo 'test with stdin' | twitter post 'and an argv[1]'
# => twitters: "test with stdin and an argv[1]"
$ echo 'test with stdin without any argv[1]' | twitter post
# => twitters: "test with stdin without any argv[1]"
If you are curious about the implementation, see the bottom of the bin/twitter file.
A Recent Cool Use of the Twitter Gem
Also, while on the topic of twitter, some pals of mine are repurposing the twitter gem to do reviews (and they were even so kind as to update the gem and send a pull request). If you are a twitterer, check out microrevie.ws.
1 Response to “Twitter Gem Gets STDIN”
Sorry, comments are closed for this article to ease the burden of pruning spam. If you have any further comments, just send me an email.


April 3rd, 2008 at 02:45 PM
Nice! :)