Skip to content

Instantly share code, notes, and snippets.

@squeejee
Created May 18, 2009 03:01
Show Gist options
  • Save squeejee/113292 to your computer and use it in GitHub Desktop.
Save squeejee/113292 to your computer and use it in GitHub Desktop.
after :deploy, :tweet_presently
after "deploy:migrations", :tweet_presently
desc "Tweet into the present.ly group for this project"
task :tweet_presently, :roles => :app do
build_environment = (ENV['cap_server'].nil? ? "DEV" : ENV['cap_server'])
presently_user_name = ENV['PRESENTLY_USER']
presently_user_name = "@#{presently_user_name.to_s.downcase}" unless presently_user_name.nil?
presently_user_name = ENV['USER'].capitalize if presently_user_name.blank?
message = "b tweetcongress #{presently_user_name} deployed a build to #{stage.to_s.upcase}"
url = URI.parse("https://squeejee.presentlyapp.com/api/twitter/statuses/update.xml")
req = Net::HTTP::Post.new(url.path)
req.basic_auth('user', 'pass')
req.set_form_data('status' => message, 'source' => 'capistrano')
net_http = Net::HTTP.new(url.host, url.port)
net_http.use_ssl = true
net_http.start { |http| http.request(req) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment