Class: CapGun::Mailer
This mailer is configured with a capistrano variable called "cap_gun_email_envelope"
Constants
| Name | Value |
|---|---|
| DEFAULT_SENDER | %("CapGun" <cap_gun@example.com>) |
| DEFAULT_EMAIL_PREFIX | "[DEPLOY] " |
Public Instance Methods
create_body (capistrano)
Create the body of the message using a bunch of values from Capistrano
# File lib/cap_gun.rb, line 112 112: def create_body(capistrano) 113: "\#{capistrano[:application]} was deployed to \#{capistrano[:rails_env]} by \#{current_user} at \#{humanize_release_time(capistrano[:current_release])}.\n\nComment: \#{capistrano[:comment] || \"[none given]\"}\n\nNerd details\n============\nRelease: \#{capistrano[:current_release]}\nRelease Time: \#{humanize_release_time(capistrano[:current_release])}\nRelease Revision: \#{capistrano[:current_revision]}\n\nPrevious Release: \#{capistrano[:previous_release]}\nPrevious Release Time: \#{humanize_release_time(capistrano[:previous_release])}\nPrevious Release Revision: \#{capistrano[:previous_revision]}\n\nRepository: \#{capistrano[:repository]}\nDeploy path: \#{capistrano[:deploy_to]}\n" 114: end
deployment_notification (capistrano)
Do the actual email
# File lib/cap_gun.rb, line 103 103: def deployment_notification(capistrano) 104: init(capistrano[:cap_gun_email_envelope]) 105: 106: content_type "text/plain" 107: subject "#{email_prefix} #{capistrano[:application]} deployed to #{capistrano[:rails_env]}" 108: body create_body(capistrano) 109: end
init (envelope = {})
Grab the options for emaililng from cap_gun_email_envelope (should be set in your deploy file)
Valid options:
:recipients (required) an array or string of email address(es) who should get notifications
:from the sender of the notification, defaults to cap_gun@example.com
:email_prefix subject prefix, defaults to [DEPLOY]
# File lib/cap_gun.rb, line 96 96: def init(envelope = {}) 97: recipients envelope[:recipients] 98: from (envelope[:from] || DEFAULT_SENDER) 99: email_prefix (envelope[:email_prefix] || DEFAULT_EMAIL_PREFIX) 100: end