Sha256: d5b6961099f4194e244563724fda51b48fb6b8d17cdfa4771a44cb251e752388

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

Capistrano::Configuration.instance(:must_exist).load do
  namespace :campfire do
    desc "Send message to campfire room about deploy lifecycle events"
    task :notify do
      [campfire_account, campfire_token, campfire_room].each do |setting|
        abort("Campfire notifications require 'campfire_token', 'campfire_account', & 'campfire_room' to be set") unless setting
      end         
      lobby = Tinder::Campfire.new campfire_account, :ssl => true, :token => campfire_token
      room = lobby.find_room_by_name(campfire_room) 
      room.speak(fetch(:campfire_message))
    end

    namespace :message  do
      desc "Send a message to campfire room about beginning a deploy"
      task :start, :except => { :no_campfire => true } do
        set :campfire_message, "Starting deploy on server #{rails_env} with #{branch}/#{real_revision[0, 7]} to #{deploy_to}"
        notify
      end

      desc "Send a message to campfire room about completing a deploy"
      task :finish, :except => { :no_campfire => true } do
        set :campfire_message, "Finished deploy on server #{rails_env} with #{branch}/#{real_revision[0, 7]} to #{deploy_to}"
        notify
      end

      desc "Send a message to campfire room about rollingback a deploy"
      task :rollback, :except => { :no_campfire => true } do
        set :campfire_message, "Rolling back deploy on server #{rails_env} from #{latest_revision[0, 7]} to #{previous_revision[0, 7]} to #{deploy_to}"
        notify
      end
    end
  end
  
  _cset(:campfire, true) #Use campfire by default for any environment
  if campfire 
    before "deploy", "campfire:message:start"
    after "deploy", "campfire:message:finish"
    after "deploy:rollback", "campfire:message:rollback"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
g5cap-0.1.2 recipes/campfire.rb
g5cap-0.1.1 recipes/campfire.rb
g5cap-0.1.0 recipes/campfire.rb