Sha256: 2f064603b88fa26a778bcfabf9fbc1284f1c17b44657659a3d13b9fc4067027c

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 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::Deploy.notify({
                :api_key => fetch(:bugsnag_api_key, ENV["BUGSNAG_API_KEY"]),
                :release_stage => fetch(:rails_env, ENV["BUGSNAG_RELEASE_STAGE"] || "production"),
                :revision => fetch(:current_revision, ENV["BUGSNAG_REPOSITORY"]),
                :repository => fetch(:repository, ENV["BUGSNAG_REVISION"]),
                :branch => fetch(:branch, ENV["BUGSNAG_BRANCH"],
                :app_version => fetch(:app_version, ENV["BUGSNAG_APP_VERSION"]))
              })
            rescue
              logger.important("Bugnsag deploy notification failed, #{$!.inspect}")
            end

            logger.info "Bugsnag deploy notification complete."
          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-2.2.0 lib/bugsnag/capistrano2.rb
bugsnag-2.1.0 lib/bugsnag/capistrano2.rb
bugsnag-2.0.3 lib/bugsnag/capistrano2.rb
bugsnag-2.0.2 lib/bugsnag/capistrano2.rb
bugsnag-2.0.1 lib/bugsnag/capistrano2.rb