Sha256: c0ab04e09b987bd1b77b1316f6691d5c6c645676eabb7da0d256cee73c66442b

Contents?: true

Size: 1.39 KB

Versions: 16

Compression:

Stored size: 1.39 KB

Contents

module Appsignal
  # @todo Move to sub-namespace
  # @api private
  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

16 entries across 16 versions & 1 rubygems

Version Path
appsignal-2.4.0.alpha.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.7 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.6 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.6.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.4 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.3 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.3.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.2 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.0 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.0.beta.3 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.0.beta.2 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.3.0.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.2.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.2.0 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
appsignal-2.2.0.beta.1 lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb