Module: Airbrake::Capistrano

Defined in:
lib/airbrake/capistrano/capistrano2.rb

Overview

The Capistrano v2 integration.

Class Method Summary collapse

Class Method Details

.load_into(config) ⇒ Object

rubocop:disable Metrics/AbcSize



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
32
33
34
35
# File 'lib/airbrake/capistrano/capistrano2.rb', line 7

def self.load_into(config)
  config.load do
    after 'deploy',            'airbrake:deploy'
    after 'deploy:migrations', 'airbrake:deploy'
    after 'deploy:cold',       'airbrake:deploy'

    namespace :airbrake do
      desc "Notify Airbrake of the deploy"
      task :deploy, except: { no_release: true }, on_error: :continue do
        run(
          "            cd \#{config.release_path} && \\\n\n            RACK_ENV=\#{fetch(:rack_env, nil)} \\\n            RAILS_ENV=\#{fetch(:rails_env, nil)} \\\n\n            bundle exec rake airbrake:deploy \\\n              USERNAME=\#{Shellwords.shellescape(ENV.fetch('USER', nil) || ENV.fetch('USERNAME', nil))} \\\n              ENVIRONMENT=\#{fetch(:airbrake_env, fetch(:rails_env, 'production'))} \\\n              REVISION=\#{current_revision.strip} \\\n              REPOSITORY=\#{repository} \\\n              VERSION=\#{fetch(:app_version, nil)}\n          CMD\n        )\n        logger.info 'Notified Airbrake of the deploy'\n      end\n    end\n  end\nend\n", once: true