Created
March 22, 2011 15:00
-
-
Save gotascii/881351 to your computer and use it in GitHub Desktop.
cap recipe to notify campfire on deploy
This file contains hidden or 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 '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