lib/cap_gun.rb in relevance-cap_gun-0.0.4 vs lib/cap_gun.rb in relevance-cap_gun-0.0.5
- old
+ new
@@ -25,11 +25,11 @@
#
# cap -s comment="fix for bug #303" deploy
#
# See README for full install/config instructions.
module CapGun
- VERSION = '0.0.4'
+ VERSION = '0.0.5'
module Helper
# Loads ActionMailer settings from a Capistrano variable called "cap_gun_action_mailer_config"
def load_mailer_config(cap)
@@ -82,11 +82,11 @@
# This mailer is configured with a capistrano variable called "cap_gun_email_envelope"
class Mailer < ActionMailer::Base
include CapGun::Helper
DEFAULT_SENDER = %("CapGun" <cap_gun@example.com>)
- DEFAULT_EMAIL_PREFIX = "[DEPLOY] "
+ DEFAULT_EMAIL_PREFIX = "[DEPLOY]"
adv_attr_accessor :email_prefix
attr_accessor :summary
# Grab the options for emailing from cap_gun_email_envelope (should be set in your deploy file)
@@ -105,15 +105,19 @@
def deployment_notification(capistrano)
init(capistrano[:cap_gun_email_envelope])
self.summary = create_summary(capistrano)
content_type "text/plain"
- subject "#{email_prefix} #{capistrano[:application]} deployed to #{capistrano[:rails_env]}"
+ subject "#{email_prefix} #{capistrano[:application]} #{deployed_to(capistrano)}"
body create_body(capistrano)
end
def create_summary(capistrano)
%[#{capistrano[:application]} was deployed#{" to " << capistrano[:rails_env] if capistrano[:rails_env]} by #{current_user} at #{humanize_release_time(capistrano[:current_release])}.]
+ end
+
+ def deployed_to(capistrano)
+ returning(s = "deployed") { s += " to #{capistrano[:rails_env]}" if capistrano[:rails_env] }
end
# Create the body of the message using a bunch of values from Capistrano
def create_body(capistrano)
<<-EOL
\ No newline at end of file