Sha256: 783a4bfdfbec073e3c43b8f2584be839733d9eef5111aaaaee8b5aac269fa2d3

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

require 'capistrano'
require 'rails'
require 'appsignal/version'
require 'appsignal/config'
require 'appsignal/transmitter'
require 'appsignal/marker'

module Appsignal
  class Capistrano
    def self.tasks(config)
      config.load do
        after "deploy", "appsignal:deploy"
        after "deploy:migrations", "appsignal:deploy"

        namespace :appsignal do
          task :deploy do
            rails_env = fetch(:rails_env, 'production')
            user = ENV['USER'] || ENV['USERNAME']

            marker_data = {
              :revision => current_revision,
              :repository => repository,
              :user => user
            }

            marker = Marker.new(marker_data, ENV['PWD'], rails_env, logger)
            if config.dry_run
              logger.info "Dry run: Deploy marker not actually sent."
            else
              marker.transmit
            end
          end
        end
      end
    end
  end
end

if Capistrano::Configuration.instance
  Appsignal::Capistrano.tasks(Capistrano::Configuration.instance)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
appsignal-0.5.3 lib/appsignal/capistrano.rb
appsignal-0.5.1 lib/appsignal/capistrano.rb
appsignal-0.5.0 lib/appsignal/capistrano.rb
appsignal-0.4.7 lib/appsignal/capistrano.rb
appsignal-0.4.6 lib/appsignal/capistrano.rb
appsignal-0.4.5 lib/appsignal/capistrano.rb
appsignal-0.4.4 lib/appsignal/capistrano.rb
appsignal-0.4.3 lib/appsignal/capistrano.rb
appsignal-0.4.0 lib/appsignal/capistrano.rb