Sha256: 560be92f90b29ff6ee84a5e1f40920e625accb8a031f47a9d18a26459d26c031

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

module Bugsnag
  module Capistrano
    def self.load_into(configuration)
      configuration.load do
        after "deploy",            "bugsnag:deploy"
        after "deploy:migrations", "bugsnag:deploy"

        namespace :bugsnag do
          desc "Notify Bugsnag that new production code has been deployed"
          task :deploy, :except => { :no_release => true }, :on_error => :continue 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)
              })
              logger.info "Bugsnag deploy notification complete."
            rescue
              logger.important("Bugnsag deploy notification failed, #{$!.inspect}")
            end
          end
        end
      end
    end
  end
end

Bugsnag::Capistrano.load_into(Capistrano::Configuration.instance) if Capistrano::Configuration.instance

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bugsnag-capistrano-1.1.2 lib/bugsnag-capistrano/capistrano2.rb
bugsnag-capistrano-1.1.1 lib/bugsnag-capistrano/capistrano2.rb
bugsnag-capistrano-1.1.0 lib/bugsnag-capistrano/capistrano2.rb
bugsnag-capistrano-1.0.1 lib/bugsnag-capistrano/capistrano2.rb
bugsnag-capistrano-1.0.0 lib/bugsnag-capistrano/capistrano2.rb