-
-
Save szimek/340008 to your computer and use it in GitHub Desktop.
Alert Campfire of a Capistrano deploy
This file contains 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
require 'httparty' | |
require 'json' | |
class Campfire | |
include HTTParty | |
base_uri 'http://your_domain.campfirenow.com' | |
basic_auth 'your_auth_token', 'whatever' | |
headers "Content-Type" => "application/json" | |
def self.notify(body) | |
post('/room/1/speak.json', :body => { :message => { :body => body }}.to_json) | |
end | |
end |
This file contains 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
require File.expand_path('../campfire', __FILE__) | |
namespace :notify do | |
desc 'Alert Campfire of a deploy' | |
task :campfire do | |
branch_name = branch.split('/', 2).last | |
deployer = ENV["USER"] | |
deployed = capture("cd #{previous_release} && git rev-parse HEAD")[0,7] | |
deploying = capture("cd #{current_release} && git rev-parse HEAD")[0,7] | |
compare_url = "#{source_repo_url}/compare/#{deployed}...#{deploying}" | |
Campfire.notify( | |
"#{deployer} deployed " + | |
"#{branch_name} (#{deployed}..#{deploying}) to #{rails_env} " + | |
"with `cap #{ARGV.join(' ')}` (#{compare_url})" | |
) | |
end | |
end | |
after "deploy:symlink", "notify:campfire" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment