0
@@ -26,7 +26,7 @@ require File.join(File.dirname(__FILE__), *%w[.. vendor action_mailer_tls lib sm
0
# cap -s comment="fix for bug #303" deploy
0
@@ -38,7 +38,7 @@ module CapGun
0
ActionMailer::Base.smtp_settings = cap.cap_gun_action_mailer_config
0
- # Current user - unsupported on Windows
0
+ # Current user - unsupported on Windows, patches welcome
0
platform.include?('mswin') ? nil : `id -un`.strip
0
@@ -48,14 +48,31 @@ module CapGun
0
- # Assuming the standard Capistrano timestamp directory, gives you a prettier date/time for output.
0
- # This does not take into account anything to do with timezones, but I believe Capistrano always
0
- # uses UTC so we could convert to a specified time zone for even friendlier display.
0
+ # Gives you a prettier date/time for output form the standard Capistrano timestamp'ed release directory.
0
+ # This assumes Capistrano uses UTC for its date/timestamped directories, and converts to the local
0
def humanize_release_time(path)
0
match = path.match(/(\d+)$/)
0
- time = Time.parse(match[1])
0
- time.strftime("%B #{time.day.ordinalize}, %Y %l:%M %p %Z").gsub(/\s+/, ' ').strip
0
+ local = convert_from_utc(match[1])
0
+ local.strftime("%B #{local.day.ordinalize}, %Y %l:%M %p #{local_timezone}").gsub(/\s+/, ' ').strip
0
+ # Use some DateTime magicrey to convert UTC to the current time zone
0
+ # When the whole world is on Rails 2.1 (and therefore new ActiveSupport) we can use the magic timezone support there.
0
+ def convert_from_utc(timestamp)
0
+ # we know Capistrano release timestaps are UTC, but Ruby doesn't, so make it explicit
0
+ utc_time = timestamp << "UTC"
0
+ datetime = DateTime.parse(utc_time)
0
+ datetime.new_offset(local_datetime_zone_offset)
0
+ def local_datetime_zone_offset
0
+ @local_datetime_zone_offset ||= DateTime.now.offset
0
+ @current_timezone ||= Time.now.zone
0
@@ -70,6 +87,11 @@ module CapGun
0
adv_attr_accessor :email_prefix
0
# Grab the options for emaililng from cap_gun_email_envelope (should be set in your deploy file)
0
+ # :recipients (required) an array or string of email address(es) who should get notifications
0
+ # :from the sender of the notification, defaults to cap_gun@example.com
0
+ # :email_prefix subject prefix, defaults to [DEPLOY]
0
def init(envelope = {})
0
recipients envelope[:recipients]
0
from (envelope[:from] || DEFAULT_SENDER)
Comments
No one has commented yet.