tobias (owner)

Revisions

gist: 205055 Download_button fork
public
Public Clone URL: git://gist.github.com/205055.git
Embed All Files: show embed
notify_campfire_recipe.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
after "deploy", "deploy:notify_campfire"
after "deploy:migrations", "deploy:notify_campfire"
 
namespace :deploy do
  desc 'notifies campfire room of deploy'
  task :notify_campfire do
    begin
      require 'tinder'
 
      rails_env = fetch(:rails_env, "production")
      local_user = ENV['USER'] || ENV['USERNAME']
 
      msg = "[#{application}/#{branch}] deployed to #{rails_env} by #{local_user} at #{Time.now}"
      puts "Notifying Campfire with '#{msg}'"
 
      #assuming your campfire url is my-campfire.campfirenow.com
      campfire = Tinder::Campfire.new('my-campfire')
      campfire.login('campfire-bot@my-domain.com', 'bot-password')
      room = campfire.find_room_by_name('A Campfire Room')
      room.speak(msg)
      campfire.logout
 
    rescue
      #don't kill cap just because we can't notify
      puts "Notifying Campfire failed: #{$!}"
    end
  end
end