module Opbeat::Capistrano
Public Class Methods
load_into(configuration)
click to toggle source
# File lib/opbeat/capistrano/capistrano2.rb, line 5 def self.load_into(configuration) configuration.load do after "deploy", "opbeat:notify" after "deploy:migrations", "opbeat:notify" after "deploy:cold", "opbeat:notify" namespace :opbeat do desc "Notifies Opbeat of new deployments" task :notify, :except => { :no_release => true } do scm = fetch(:scm) if scm.to_s != "git" puts "Skipping Opbeat deployment notification because scm is not git." next end branches = capture("cd #{current_release}; /usr/bin/env git branch --contains #{current_revision}").split if branches.length == 1 branch = branch[0].sub("* ") else branch = nil end notify_command = "cd #{current_release}; REV=#{current_revision} " notify_command << "BRANCH=#{branch} " if branch rails_env = fetch(:rails_env, "production") notify_command << "RAILS_ENV=#{rails_env} " executable = fetch(:rake, 'bundle exec rake ') notify_command << "#{executable} opbeat:deployment" capture notify_command, :once => true end end end end