File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 14
14
DB_NAME_REGEX = /\S +_staging/
15
15
KEYWORDS_REGEX = /sorry|help|wrong/i
16
16
17
+ def create_reply ( subject )
18
+ gmail . compose do
19
+ to kumars_email
20
+ subject "RE: #{ subject } "
21
+ body "No problem. I've fixed it. \n \n Please be careful next time."
22
+ end
23
+ end
24
+
17
25
gmail . inbox . find ( :unread , from : kumars_email ) . each do |email |
18
- if email . body [ KEYWORDS_REGEX ] && ( db_name = email . body [ DB_NAME_REGEX ] )
26
+ if email . body . raw_source [ KEYWORDS_REGEX ] && ( db_name = email . body . raw_source [ DB_NAME_REGEX ] )
19
27
backup_file = "/home/backups/databases/#{ db_name } -" + ( Date . today - 1 ) . strftime ( '%Y%m%d' ) + '.gz'
20
28
abort 'ERROR: Backup file not found' unless File . exist? ( backup_file )
21
29
29
37
gmail . deliver ( reply )
30
38
end
31
39
end
32
-
33
- def create_reply ( subject )
34
- gmail . compose do
35
- to kumars_email
36
- subject "RE: #{ subject } "
37
- body "No problem. I've fixed it. \n \n Please be careful next time."
38
- end
39
- end
You can’t perform that action at this time.
0 commit comments