Skip to content

Commit a1716b8

Browse files
committed
fix ruby script
closes NARKOZ#53
1 parent 1366360 commit a1716b8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

kumar_asshole.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@
1414
DB_NAME_REGEX = /\S+_staging/
1515
KEYWORDS_REGEX = /sorry|help|wrong/i
1616

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+
1725
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])
1927
backup_file = "/home/backups/databases/#{db_name}-" + (Date.today - 1).strftime('%Y%m%d') + '.gz'
2028
abort 'ERROR: Backup file not found' unless File.exist?(backup_file)
2129

@@ -29,11 +37,3 @@
2937
gmail.deliver(reply)
3038
end
3139
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

0 commit comments

Comments
 (0)