Sha256: 42fa5077180ade8d3f9828582017883d64052cdd1f42abcbaba7e3d7efd1e75a

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'rubygems' unless defined?(Rubygems)
require 'capistrano' unless defined?(Capistrano)

unless Capistrano::Configuration.respond_to?(:instance)
  abort "capistrano/mailer requires Capistrano 2"
end

require 'capistrano/log_with_awesome'
require 'inline-style'
require 'action_mailer' unless defined?(ActionMailer)
require 'cap_mailer' unless defined?(CapMailer)

module Capistrano
  class Configuration
    module CapistranoMailer
      def send_notification_email(cap, config = {}, *args)
        CapMailer.notification_email(cap, config, *args).deliver
      end
    end

    include CapistranoMailer

    module Execution
      protected
        def __rollback_with_mailer!
          set :mailer_status, :failure
          find_and_execute_task "deploy:notify"
          __rollback_without_mailer!
        end

        alias_method :__rollback_without_mailer!, :rollback!
        alias_method :rollback!, :__rollback_with_mailer!
    end
  end
end

Capistrano.plugin :mailer, Capistrano::Configuration::CapistranoMailer

if cap = Capistrano::Configuration.instance
  cap.load("#{File.expand_path(File.dirname(__FILE__))}/mailer_recipes.rb")
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano_mailer-4.0.2 lib/capistrano/mailer.rb