Sha256: 4cba9af818fab7982cb1c4d8ed56fe1f114a58148445c8bc7e3887af126dcf4d
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'capistrano' module CapistranoPayload class CapistranoIntegration def self.load_into(capistrano_config) capistrano_config.load do _cset(:payload_url) { abort 'Payload URL required! set :payload_url' } _cset(:payload_format) { :json } _cset(:payload_data) { { :application => fetch(:application), :deployer => ENV['USER'] || ENV['USERNAME'] || 'n/a', :timestamp => Time.now, :source => { :branch => fetch(:branch), :revision => fetch(:real_revision), :repository => fetch(:repository) } } } namespace :payload do task :deploy, :roles => :app do logger.debug("Sending deployment notification to #{fetch(:payload_url)}") begin CapistranoPayload::Payload.new('deploy', payload_data).deliver(fetch(:payload_url)) rescue DeliveryError => err logger.debug("Payload delivery error: #{err.message}") end end task :rollback, :roles => :app do logger.debug("Sending rollback notification to #{fetch(:payload_url)}") begin CapistranoPayload::Payload.new('rollback', payload_data).deliver(fetch(:payload_url)) rescue DeliveryError => err logger.debug("Payload delivery error: #{err.message}") end end end after :deploy, 'payload:deploy' after :rollback, 'payload:rollback' end end end end if Capistrano::Configuration.instance CapistranoPayload::CapistranoIntegration.load_into(Capistrano::Configuration.instance) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-payload-0.1.0 | lib/capistrano-payload/capistrano_integration.rb |