Created
March 23, 2012 04:02
-
-
Save smith/2166634 to your computer and use it in GitHub Desktop.
What a capistrano-notifier notifier could look like
This file contains 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 'capistrano/notifier/base' | |
require 'statsd-instrument' | |
class Capistrano::Notifier::StatsD | |
include Capistrano::Notifier::Base | |
name :statsd | |
description 'Notifies StatsD of a deploy' | |
# The base module takes this method and loads it in as a task of the | |
# current capistrano instance | |
def notify | |
# 'get' here could be a shortcut to capistrano's get (or is it fetch?) that prepends notify_#{name}, | |
# then in your deploy.rb you do `set :notify_statsd_host, '10.0.0.1'` | |
StatsD.host = get :host # get :notify_statsd_host | |
# ... and so on, or read from config/stats.yml ... | |
StastD.increment(get :key) # get :notify_statsd_key => #{application}.deploy.#{stage} | |
end | |
# do whatever you want in the rest of the class | |
end | |
# produces => | |
desc 'Notifies StatsD of a deploy' | |
namespace :deploy do | |
namespace :notify do | |
task :statsd do | |
# ... eval notify ... | |
end | |
end | |
end | |
after 'deploy', 'deploy:notify:statsd' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment