Sha256: a5a84d245dfadb1444b658f7bb80dbf2d0cd286e2ac54a59e38fa02eee54f275

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 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:release'
  end

  desc 'Notify Bugsnag that new production code has been released'
  task :release do
    run_locally do
      begin
        auto_assign_release_bool = ENV["BUGSNAG_AUTO_ASSIGN_RELEASE"] == 'true'
        Bugsnag::Capistrano::Release.notify({
          :api_key => fetch(:bugsnag_api_key, ENV["BUGSNAG_API_KEY"]),
          :app_version => fetch(:app_version, ENV["BUGSNAG_APP_VERSION"]),
          :auto_assign_release => fetch(:bugsnag_auto_assign_release, auto_assign_release_bool),
          :builder_name => fetch(:bugsnag_builder, ENV["BUGSNAG_BUILDER_NAME"] || ENV["USER"]),
          :metadata => fetch(:bugsnag_metadata),
          :release_stage => fetch(:bugsnag_env) || ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env) || fetch(:stage) || "production",
          :revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
          :repository => fetch(:bugsnag_repo_url, fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"])),
          :source_control_provider => fetch(:bugsnag_source_control_provider, ENV["BUGSNAG_SOURCE_CONTROL_PROVIDER"]),
          :endpoint => fetch(:bugsnag_endpoint)
        })
        info 'Bugsnag release notification complete.'
      rescue
        error "Bugsnag release notification failed, #{$!.inspect}"
      end
    end
  end
end
# vi:ft=ruby

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bugsnag-capistrano-2.1.0 lib/bugsnag-capistrano/tasks/bugsnag.cap