class GitCommitMailer::PushInfo
Constants
- CHANGE_TYPE
- REFERENCE_TYPE
Attributes
change_type[R]
commits[R]
date[R]
log[R]
new_revision[R]
old_revision[R]
reference[R]
reference_type[R]
subject[R]
Public Class Methods
new(mailer, old_revision, new_revision, reference, reference_type, change_type, log, commits=[])
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 23 def initialize(mailer, old_revision, new_revision, reference, reference_type, change_type, log, commits=[]) @mailer = mailer @old_revision = old_revision @new_revision = new_revision if @new_revision != '0' * 40 #XXX well, i need to properly fix this bug later. @revision = @new_revision else @revision = @old_revision end @reference = reference @reference_type = reference_type @log = log author_name, author_email = get_records(["%an", "%ae"]) @author_name = author_name @author_email = author_email @date = @mailer.date @change_type = change_type @commits = commits || [] end
Public Instance Methods
branch_changed?()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 62 def branch_changed? !@commits.empty? end
format_mail_body_html()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 95 def format_mail_body_html "<pre>#{ERB::Util.h(format_mail_body_text)}</pre>" end
format_mail_body_text()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 82 def format_mail_body_text body = "" body << "#{author_name}\t#{@mailer.format_time(date)}\n" body << "\n" body << "New Push:\n" body << "\n" body << " Message:\n" log.rstrip.each_line do |line| body << " #{line}" end body << "\n\n" end
format_mail_subject()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 77 def format_mail_subject "(push) #{PushInfo::REFERENCE_TYPE[reference_type]} " + "(#{short_reference}) is #{PushInfo::CHANGE_TYPE[change_type]}." end
headers()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 52 def headers [ "X-Git-OldRev: #{old_revision}", "X-Git-NewRev: #{new_revision}", "X-Git-Refname: #{reference}", "X-Git-Reftype: #{REFERENCE_TYPE[reference_type]}", "Message-ID: #{message_id}", ] end
message_id()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 48 def message_id "<push.#{old_revision}.#{new_revision}@#{self.class.host_name}>" end
revision()
click to toggle source
# File lib/git-commit-mailer/push-info.rb, line 44 def revision @new_revision end