Sha256: cd42ec9e8c2b1f92a5fccc3e0363c19f0372b854502cdf724359bd36e6fbf1b8

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

namespace :load do

  task :defaults do

    set :bugsnag_default_hooks, ->{ true }

  end

end

namespace :deploy do

  before :starting, :bugsnag_hooks do
    invoke 'bugsnag:add_default_hooks' if fetch(:bugsnag_default_hooks)
  end

end

namespace :bugsnag do

  task :add_default_hooks do
    after 'deploy:published', 'bugsnag:deploy'
  end

  desc 'Notify Bugsnag that new production code has been deployed'
  task :deploy do
    run_locally do
      begin
        Bugsnag::Capistrano::Deploy.notify({
          :api_key => fetch(:bugsnag_api_key, ENV["BUGSNAG_API_KEY"]),
          :release_stage => fetch(:bugsnag_env) || ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env) || fetch(:stage) || "production",
          :revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
          :repository => fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"]),
          :branch => fetch(:branch, ENV["BUGSNAG_BRANCH"]),
          :app_version => fetch(:app_version, ENV["BUGSNAG_APP_VERSION"]),
          :endpoint => fetch(:bugsnag_endpoint)
        })
        info 'Bugsnag deploy notification complete.'
      rescue
        error "Bugsnag deploy notification failed, #{$!.inspect}"
      end
    end
  end

end
# vi:ft=ruby

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bugsnag-capistrano-1.1.2 lib/bugsnag-capistrano/tasks/bugsnag.cap
bugsnag-capistrano-1.1.1 lib/bugsnag-capistrano/tasks/bugsnag.cap
bugsnag-capistrano-1.1.0 lib/bugsnag-capistrano/tasks/bugsnag.cap
bugsnag-capistrano-1.0.1 lib/bugsnag-capistrano/tasks/bugsnag.cap
bugsnag-capistrano-1.0.0 lib/bugsnag-capistrano/tasks/bugsnag.cap