Sha256: f26e02e9048854c0e5dcb285cfc9fc47c46960f357f8890ecdaa654146794f5c

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

# Capistrano 3 integration
namespace :appsignal do
  task :deploy do
    appsignal_env = fetch(:appsignal_env,
      fetch(:stage, fetch(:rails_env, fetch(:rack_env, "production"))))
    user = fetch(:appsignal_user, ENV["USER"] || ENV.fetch("USERNAME", nil))
    revision = fetch(:appsignal_revision, fetch(:current_revision))

    appsignal_config = Appsignal::Config.new(
      Dir.pwd,
      appsignal_env
    ).tap do |c|
      c.merge_dsl_options(fetch(:appsignal_config, {}))
      c.validate
    end
    Appsignal._start_logger

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

      marker = Appsignal::Marker.new(marker_data, appsignal_config)
      # {#dry_run?} helper was added in Capistrano 3.5.0
      # https://github.com/capistrano/capistrano/commit/38d8d6d2c8485f1b5643857465b16ff01da57aff
      if respond_to?(:dry_run?) && 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: #{appsignal_env}"
    end
  end
end

after "deploy:finished", "appsignal:deploy"

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
appsignal-4.2.1-java lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.2.1 lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.2.0-java lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.2.0 lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.1.3-java lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.1.3 lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.1.2-java lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.1.2 lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.1.1-java lib/appsignal/integrations/capistrano/appsignal.cap
appsignal-4.1.1 lib/appsignal/integrations/capistrano/appsignal.cap