Sha256: 4faa26f6c12681c50345a3b2f92d1e8eb5b7ba6d56597c0daa26a4eafff94af7

Contents?: true

Size: 1.29 KB

Versions: 15

Compression:

Stored size: 1.29 KB

Contents

require 'capistrano'

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

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

              appsignal_config = Appsignal::Config.new(
                ENV['PWD'],
                env,
                fetch(:appsignal_config, {}),
                logger
              )

              if appsignal_config && appsignal_config.active?
                marker_data = {
                  :revision => current_revision,
                  :repository => repository,
                  :user => user
                }

                marker = Marker.new(marker_data, appsignal_config, logger)
                if config.dry_run
                  logger.info('Dry run: Deploy marker not actually sent.')
                else
                  marker.transmit
                end
              end
            end
          end
        end
      end
    end
  end
end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
appsignal-0.8.15 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.14 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.13 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.12 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.11 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.10 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.8 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.7 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.7.alpha.1 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.6 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.6.beta.1 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.6.beta.0 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.5 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.4 lib/appsignal/integrations/capistrano.rb
appsignal-0.8.4.beta.1 lib/appsignal/integrations/capistrano.rb