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
29
30
31
|
# File 'lib/capistrano/git/plugins/airbrake.rb', line 3
def self.load_into(configuration)
configuration.load do
after 'deploy', 'airbrake:deploy'
after 'deploy:migrations', 'airbrake:deploy'
namespace :airbrake do
desc " Notify Airbrake of the deployment by running the notification on the REMOTE machine.\n - Run remotely so we use remote API keys, environment, etc.\n DESC\n task :deploy, :except => { :no_release => true } do\n rails_env = fetch(:airbrake_env, fetch(:rails_env, 'production'))\n local_user = ENV['USER'] || ENV['USERNAME']\n executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'rake')\n notify_command = \"cd \#{deploy_to}; \#{\"sudo -u \#{sudo_user}\" if configuration[:sudo_user] } \#{executable} RAILS_ENV=\#{rails_env} airbrake:deploy TO=\#{rails_env} REPO=\#{repository} USER=\#{local_user}\"\n notify_command << ' DRY_RUN=true' if dry_run\n notify_command << \" API_KEY=\#{ENV['API_KEY']}\" if ENV['API_KEY']\n puts \"\\n\\n### NOTIFY AIRBRAKE: Notifying Airbrake of Deploy (\#{notify_command})\\n\\n\"\n if configuration.dry_run\n puts 'DRY RUN: Notification not actually run.'\n else\n result = ''\n run(notify_command, :once => true) { |ch, stream, data| result << data }\n end\n puts 'Airbrake Notification Complete.'\n end\n end\n end\nend\n"
|