Capistrano Twitter task, take 2 2

Posted by Colin A. Bartlett Sat, 16 Feb 2008 16:17:00 GMT

In my original post, I explained how I used the twitter4r gem to post when we deployed an app with capistrano. Chris Matthieu posted a comment about how to do it without the twitter4r gem. I actually like this better, especially after we started having trouble with the twitter4t gem. So, here’s his version that I adapted slightly:

desc 'posts to twitter that an application has been deployed to a web server'
task :send_tweet do
  require 'open-uri'
  require 'net/http'

  url = URI.parse('http://twitter.com/statuses/update.xml')
  req = Net::HTTP::Post.new(url.path)
  req.basic_auth 'your_username' + ":" + 'your_password', ''
  req.set_form_data({'status' => "Deployed #{application} to #{rails_env}"})
  res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
end

Thanks, Chris!

Capistrano Twitter task 1

Posted by Colin A. Bartlett Sun, 10 Feb 2008 15:37:00 GMT

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}")
end

The 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

Updates on Git use in Mac OS X (Tiger)

Posted by Justin Reagor Fri, 26 Oct 2007 03:46:00 GMT

Note: This article is still on using Git under Tiger (10.4.10, respectively)... Until I have time to run down to the Apple store tomorrow and do a nice clean install of Leopard onto my Macbook, I will not have the appropriate means of writing a proper article on Git use under 10.5.

This is for anyone that reads this blog, and used my previous article on compiling Git. I left the proper Git tutorials to the behmouth of external articles out there, on using Git as Rails project/deployment SCM. I’m also a firm believer in DIY, and the same applies to learning new things. Nobody ever taught me a damn subject (completely) in person on anything I use day-to-day… so DIY and…



Welcome to the wonderful world of Git folks!

Since my last article, actually a day ago, Geoffrey Grosenbach over at Peepcode Screencasts released Video 015, on Git. This should really, visually, help out those that are really having problems crasping the simple things in Git. There are other numerous advances in using Git with your Rails applications. So I’ll keep things DRY here…

One thing I will update you with though, a quick and simple way to update your source compiled installation of Git, by using Git’s repository itself.

# git clone git://git.kernel.org/pub/scm/git/git.git
# cd git
# make configure
# ./configure --prefix=/usr/local
# make all doc
# sudo make install install-doc

You will now have a completely refreshed version of Git on your system.

Take note, Grosenbach mentions the benefits of having a compiled version of Git on your system. He does not, however, give more than a quick mention that it may be slightly difficult gathering up the proper dependency chain onto your system. That was what my previous article was for.

Enjoy, and let me know how things go for you… justin_at_kineticweb.com.