require 'yaml' Capistrano::Configuration.instance(:must_exist).load do namespace :notify do begin require 'broach' rescue LoadError def notify(action) puts "[!] Please `gem install broach' to post deployment messages to Campfire." end else def notify(action) begin Broach.settings = YAML.load_file(File.expand_path('~/.fingercap.yml'))['campfire'] rescue Errno::ENOENT puts "[!] Fingercap can't find it's configuration file at ~/.fingercap.yml" puts File.read(File.expand_path('../../../../examples/fingercap.yml', __FILE__)) exit -1 end Broach.speak(Broach.session.room, "#{ENV['USER']} just #{action} #{application}: #{repository}") end end desc "Posts a `deployed' message to Campfire" task :deploy do notify "deployed" end desc "Posts a `deployed and migrated' message to Campfire" task :migrations do notify "deployed and migrated" end end end