Methods
- B
- C
- D
- E
- F
- G
- H
- L
- N
- P
- R
- S
Constants
DEFAULT_SENDER | = | %("CapGun" <cap_gun@example.com>) |
DEFAULT_EMAIL_PREFIX | = | "[DEPLOY]" |
Attributes
[RW] | capistrano |
Class Public methods
Instance Public methods
# File lib/cap_gun/presenter.rb, line 112 def body "\#{summary}\n\#{comment}\nDeployment details\n==================\nRelease: \#{capistrano[:current_release]}\nRelease Time: \#{release_time}\nRelease Revision: \#{capistrano[:current_revision]}\n\nPrevious Release: \#{capistrano[:previous_release]}\nPrevious Release Time: \#{previous_release_time}\nPrevious Release Revision: \#{capistrano[:previous_revision]}\n\nRepository: \#{capistrano[:repository]}\nDeploy path: \#{capistrano[:deploy_to]}\nDomain: \#{capistrano[:domain]}\n\#{git_details}\n" end
Use some DateTime magicrey to convert UTC to the current time zone When the whole world is on Rails 2.1 (and therefore new ActiveSupport) we can use the magic timezone support there.
# File lib/cap_gun/presenter.rb, line 81 def convert_from_utc(timestamp) # we know Capistrano release timestamps are UTC, but Ruby doesn't, so make it explicit utc_time = timestamp << "UTC" datetime = DateTime.parse(utc_time) datetime.new_offset(local_datetime_zone_offset) end
Gives you a prettier date/time for output from the standard Capistrano timestamped release directory. This assumes Capistrano uses UTC for its date/timestamped directories, and converts to the local machine timezone.
# File lib/cap_gun/presenter.rb, line 71 def humanize_release_time(path) return unless path match = path.match(/(\d+)$/) return unless match local = convert_from_utc(match[1]) local.strftime("%B #{local.day.ordinalize}, %Y %l:%M %p #{local_timezone}").gsub(/\s+/, ' ').strip end