Capistrano Twitter task 1
Justin had an idea that we should post to Twitter whenever we deploy a new version of our apps to either a staging site or the production app. Turns out, this is really easy with the twitter4r gem. I used a twitter account that Justin created expressly for our internal notices and set its updates to be private. Then I created this task:
desc 'posts to twitter that something was deployed'
task :send_tweet do
require 'rubygems'
gem 'twitter4r'
require 'twitter'
require 'twitter/console'
twitter = Twitter::Client.from_config('config/twitter.yml',rails_env)
status = twitter.status(:post, "deployed #{application} to #{rails_env}")
endThe twitter4r library loads a simple yaml file that contains the username and password of the twitter account to use. And one line of code posts the status update with the name of the app and the environment from previously-defined variables.
That’s it! The great thing about using Twitter for this, as Justin pointed out, is that each one of us developers can consume this information how we choose: IM, Growl messages with Twitterific, SMS, etc. So it’s really just the syndication technology that we’re taking advantage of.
Update
Chris’s comment below prompted me to come up with a new version
gem environment 1
This is another one of those things I learned way too late:
$ gem environment... tells you a bunch of things about your environment. Including where your gems are installed. Handy! It’s the little things like this that can make one so much more productive.
Jabber with Ruby 1
I got curious on how easy it might be to integrate Jabber with some Ruby projects. Turns out, it’s dead simple. (Why would I ever think otherwise?) That’s due to the efforts of the folks over at the xmpp4r project. One can do it with a simple little script of a dozen lines or so, once that package is installed. Something like this:
require 'xmpp4r/client'
include Jabber
client = Client::new(JID::new('username'))
client.connect
client.auth('password')
client.send Message::new(colinbartlett@gmail.com,"test!!").set_type(:normal).set_id('1')
client.closeOn our project list coming up is integrating Jabber with our Nagios server so that notifications can be sent to us via IM when we’re online instead of SMS. (To avoid the $70 SMS bills in months when one of the servers has a bad day!).
Ads for open source projects on Google? 1
I was shocked the other day to see sponsored Ad Words ads on Google under the keyword “email ruby” that seemed to be advertising a project on RubyForge:

I wonder if someone at the RubyMail project is paying to place these ads on Google? If so, I wonder why? Or perhaps Google gives these out for free some how? Do other open source projects have ads on Google?
Since the RubyMail project has one developer and one file last posted in April 2004, it seems odd that anyone would be paying for ads for such an inactive project.
Bad do_mysql-0.2.2 Gem 4
If your getting this error whilst attempting to load up DataMapper in Merb (the rake dm:install:mysql portion, or just gem install do_mysql). Here’s how I fixed it…
Started merb_init.rb ...
Loading dependencies...
dyld: NSLinkModule() error
dyld: Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient_r.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/do_mysql-0.2.2/lib/mysql_c.bundle
Reason: image not found
Trace/BPT trapTry this…
# sudo -s
# cd /usr/local/lib/ruby/gems/1.8/gems/do_mysql-0.2.2/ext
# make clean
# vim mysql_c.i
[change any bad paths to correct mysql locations in your OS]
# make all
# rm ../lib/mysql_c.bundle
# cp mysql_c.bundle ../libDataMapper with MySQL should now work in Merb! Happy hacking once more…
Generating Ruby 1.9 RDocs Tip 1
Like many hardcore Ruby hackers, I am completely psyched for this December… Ruby 1.9 will depot to the world, and give us a much needed refresher in the community.
Last night, following RubyInside’s How to Start Playing with Ruby 1.9 Right Now! I was able to have it compiled in no time (after upgrading GNU Bison on Tiger).
So with a brand new programming language refresh your going to need the API docs right? Well, some people are finding problems when generating these new rdoc’s, so I figured I’d have the same problem…. but not quite…
Allison Is Sexy
Using Evan Weaver’s “Allison” RDoc template gem I was able to do a simple generation of the new RDoc’s with his gorgeous template.

First you’ll need the template…
# sudo gem install allisonThen, from within the root level of the Ruby 1.9 trunk source directory (where you built Ruby 1.9) use the allison command like so.
# allison --title 'Ruby 1.9beta' --line-numbers -o new-rdocThis will place all the new docs into “new-rdoc” directory. You can copy them out to where ever you like afterwards. I stored mine within my /usr/local/ruby1.9b/doc/.
Remember, when compiling 1.9 to configure with prefix=/usr/local/ruby1.9 otherwise you may overwrite your 1.8 installation… and that would make for a bad workday.
Small Issue
I have experienced some error messages coming from Safari 3, that the Allison template’s Javascripts are loading too slowly. Just hitting the “Continue” button will keep them going. I have not tried this in Firefox or any other browser yet… but that would probably fix this small issue.
