Skip to content

Instantly share code, notes, and snippets.

@gotascii
Created March 22, 2011 15:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotascii/881351 to your computer and use it in GitHub Desktop.
Save gotascii/881351 to your computer and use it in GitHub Desktop.
cap recipe to notify campfire on deploy
require 'uri'
require 'tinder'
class Campfire
attr_reader :config
def initialize(config)
@config = config
end
def api
Tinder::Campfire.new(config[:domain], {
:token => config[:token],
:ssl => config[:ssl]
})
end
def room
api.find_room_by_name(config[:room])
end
def speak(msg)
room.speak msg
end
end
after "deploy", "viget:deploy:campfire"
after "deploy:migrations", "viget:deploy:campfire"
after "deploy:rollback", "viget:deploy:campfire"
namespace :viget do
namespace :deploy do
desc 'Announces deployments in one or more Campfire rooms.'
task :campfire do
cf = Campfire.new(fetch(:campfire, nil))
cf.speak "[CAP] #{ENV['USER']} just deployed revision #{current_revision} from #{fetch(:repository)} to #{fetch(:stage)}."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment