27 lines
648 B
Plaintext
Raw Normal View History

2015-05-26 11:25:40 +02:00
namespace :send do
namespace :mail do
desc "Send an email when deploy is finished"
task :notify do
if Capistrano::Send::Mail.supported?
config = fetch(:send_mail, {})
2015-05-26 14:54:16 +02:00
invoke 'send:set_release_log'
body = revision_log_message << "\n\n"
body << "Changes:\n#{fetch(:release_log)}"
2015-05-26 11:25:40 +02:00
Mail.deliver do
to config[:to]
from config[:from]
subject "Deploy successful on #{fetch(:stage)}!"
2015-05-26 14:54:16 +02:00
body body
2015-05-26 11:25:40 +02:00
delivery_method config[:via] || :smtp, config[:via_options] || {}
end
end
end
end
end
after 'deploy:finished', 'send:mail:notify'