Module: Rollbar::CapistranoTasks

Defined in:
lib/rollbar/capistrano_tasks.rb

Overview

Module containing the logic of Capistrano tasks for deploy tracking

Class Method Summary collapse

Class Method Details

.deploy_failed(capistrano, logger, dry_run) ⇒ Object



38
39
40
41
42
43
# File 'lib/rollbar/capistrano_tasks.rb', line 38

def deploy_failed(capistrano, logger, dry_run)
  deploy_update(capistrano, logger, dry_run,
                :desc => 'Setting deployment status to `failed` in Rollbar') do
    report_deploy_failed(capistrano, dry_run)
  end
end

.deploy_started(capistrano, logger, dry_run) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rollbar/capistrano_tasks.rb', line 7

def deploy_started(capistrano, logger, dry_run)
  deploy_task(logger, :desc => 'Notifying Rollbar of deployment start') do
    result = report_deploy_started(capistrano, dry_run)

    debug_request_response(logger, result)

    capistrano.set(:rollbar_deploy_id, 123) if dry_run

    skip_in_dry_run(logger, dry_run) do
      if result[:success] &&
         (deploy_id = result[:data] &&
         result[:data][:deploy_id])
        capistrano.set :rollbar_deploy_id, deploy_id
      else
        message = format_message('Unable to report deploy to Rollbar',
                                 result[:message])
        log_error(logger, message)
      end
    end
  end
end

.deploy_succeeded(capistrano, logger, dry_run) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/rollbar/capistrano_tasks.rb', line 29

def deploy_succeeded(capistrano, logger, dry_run)
  deploy_update(
    capistrano, logger, dry_run,
    :desc => 'Setting deployment status to `succeeded` in Rollbar'
  ) do
    report_deploy_succeeded(capistrano, dry_run)
  end
end