-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathemail_formatter.rb
More file actions
43 lines (35 loc) · 857 Bytes
/
Copy pathemail_formatter.rb
File metadata and controls
43 lines (35 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require_relative 'git_info'
# Contains the various snippets of text generated for the mail
class EmailFormatter
def initialize(special, target_branch_is_master)
@special = special
@target_branch_is_master = target_branch_is_master
end
attr_reader :special, :target_branch_is_master
def to
Settings.email_to
end
def subject
"Deploy request #{special ? '[SPECIAL]' : '[no special]'} for "\
"\"#{GitInfo.branch_name}\""
end
def body
body_raw = <<BODY
# Branch
#{GitInfo.branch_name}
#{conditional_body_text}
# Commits
#{GitInfo.commit_log}
# Shortstat
#{GitInfo.shortstat}
# Referenced issues
#{GitInfo.issue_urls}
BODY
end
def conditional_body_text
text = ''
text << "\n# Target branch\n\n" unless target_branch_is_master
text << "\n# Deploy instructions\n1. \n" if special
text
end
end