Skip to content

Instantly share code, notes, and snippets.

@marten
Created May 9, 2012 09:48
Show Gist options
  • Save marten/2643430 to your computer and use it in GitHub Desktop.
Save marten/2643430 to your computer and use it in GitHub Desktop.
namespace :notify do
task :airbrake do
# We need to do this require here, becaure Airbrake will load up ActiveSupport,
# which will set up Kernel#capture, which will fudge up capistrano's capture method.
# If we do the require here (just-in-time) and just HOPE that nobody after
# us needs capture, we might be ok.
#
# Yeah, really.
require 'airbrake'
require 'airbrake_tasks'
# Airbrake needs its API key, which is in the initializer
load "config/initializers/airbrake.rb"
logger.info "Notifying Airbrake of Deploy"
if dry_run
logger.info "DRY RUN: Notification not actually run."
else
AirbrakeTasks.deploy(:rails_env => fetch(:airbrake_env, fetch(:rails_env, "production")),
:scm_revision => current_revision,
:scm_repository => repository,
:local_username => ENV['USER'] || ENV['USERNAME'])
end
logger.info "Airbrake Notification Complete."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment