Sha256: 3127f6d9b36fd624d8f8d77f1ee4a0761b0c00956611a1a890af489731955abd

Contents?: true

Size: 1.35 KB

Versions: 19

Compression:

Stored size: 1.35 KB

Contents

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
            env = fetch(:appsignal_env, fetch(:stage, fetch(:rails_env, fetch(:rack_env, 'production'))))
            user = ENV['USER'] || ENV['USERNAME']
            revision = fetch(:appsignal_revision, fetch(:current_revision))

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

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

              marker = Marker.new(marker_data, appsignal_config)
              if config.dry_run
                puts 'Dry run: AppSignal deploy marker not actually sent.'
              else
                marker.transmit
              end
            else
              puts "Not notifying of deploy, config is not active for environment: #{env}"
            end
          end
        end
      end
    end
  end
end

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
appsignal-2.0.6 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.5 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.5.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.1.0.alpha.3 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.1.0.alpha.2 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.1.0.alpha.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.4 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.3 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.2 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.0 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.0.0.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.4.0.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.3.6 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.3.6.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.3.5 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.3.5.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.3.4 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-1.3.3 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb