-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
43 lines (29 loc) · 819 Bytes
/
Rakefile
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 'pony'
EMAIL_FROM = 'server@example.com'
EMAIL_TO = 'me@example.com'
def handle_exception(exception)
$stderr.puts "#{name} aborted!"
$stderr.puts exception.message
$stderr.puts exception.backtrace.join("\n")
# Send email
subject = "Rake exception - #{exception.message}"
body = "#{exception.message}\n\n#{exception.backtrace.join("\n")}"
Pony.mail(:to => EMAIL_TO, :from => EMAIL_FROM, :subject => subject, :body => body)
$stderr.puts
$stderr.puts
$stderr.puts "Exception details sent to #{EMAIL_TO}"
end
module Rake
class Application
def standard_exception_handling
begin
yield
rescue Exception => e
handle_exception(e)
exit(false)
end
end
end
end
# Include this to run 'rake test:foo'
# load 'test.rake'