Sha256: f09acd5ed515f24a82c1e4998926027e266cad339fd17b83c3e6b9d2b2381d6d

Contents?: true

Size: 1.03 KB

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
appsignal-0.6.0.beta.2 lib/appsignal/capistrano.rb
appsignal-0.6.0.beta.1 lib/appsignal/capistrano.rb
appsignal-0.5.5 lib/appsignal/capistrano.rb