delayed_job_extras 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/delayed_job_extras/hoptoad.rb +14 -15
  2. metadata +2 -2
@@ -1,27 +1,26 @@
1
1
  begin
2
- # If the hoptoad_notifier gem is available
3
- # let's use it so we can get some good notifications
4
- # when an exception is raised.
5
- require 'hoptoad_notifier'
6
-
2
+
7
3
  DJ::Worker.logger.info "Adding Hoptoad support to Delayed::Job"
8
4
 
9
5
  module Delayed
10
6
  class Job
11
- include HoptoadNotifier::Catcher
12
7
 
13
8
  def invoke_job_with_hoptoad
14
- begin
15
- invoke_job_without_hoptoad
16
- rescue Exception => e
17
- h = exception_to_data(e)
18
- begin
19
- h[:environment][:delayed_job] = self.to_yaml
20
- rescue TypeError => ex
9
+ if defined?(HoptoadNotifier)
10
+ Delayed::Job.send(:define_method, :invoke_job_with_hoptoad) do
11
+ begin
12
+ invoke_job_without_hoptoad
13
+ rescue Exception => e
14
+ HoptoadNotifier.notify(e, :cgi_data => self.attributes)
15
+ raise e
16
+ end
17
+ end
18
+ else
19
+ Delayed::Job.send(:define_method, :invoke_job_with_hoptoad) do
20
+ invoke_job_without_hoptoad
21
21
  end
22
- notify_hoptoad(h)
23
- raise e
24
22
  end
23
+ invoke_job_with_hoptoad
25
24
  end
26
25
 
27
26
  alias_method_chain :invoke_job, :hoptoad
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-04 00:00:00 -05:00
12
+ date: 2009-11-10 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency