bugsnag 1.5.3 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +35 -5
- data/README.md +4 -0
- data/VERSION +1 -1
- data/bugsnag.gemspec +15 -15
- data/lib/bugsnag.rb +2 -1
- data/lib/bugsnag/mailman.rb +18 -0
- data/lib/bugsnag/railtie.rb +1 -0
- data/lib/bugsnag/resque.rb +38 -0
- data/lib/bugsnag/tasks/bugsnag.rake +1 -1
- metadata +85 -97
- data/lib/resque/failure/bugsnag.rb +0 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 273d6b5e30c112e42d9d667dccbab65af1c4a64e
|
4
|
+
data.tar.gz: c798d5e662751dc2b0774ea72e38ca4614275562
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 692be4458a34c4b201ed88f8e9ff4ce2146e57fcad51abe41429c183334d66c654f183dc82d897327ef9a3b8802333a8718dc8fc99606aba6c18ee4cd66b3307
|
7
|
+
data.tar.gz: 13dea215afa1c2fd776eaab65a4b75f0bcb89b98b5a9f870a009134ed4baf9cd2c4ce7e20fdb222f9ff4fe63433e79924214513061aa39694e63b03b9bf2f024
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
1.6.0
|
5
|
+
-----
|
6
|
+
- Add support for catching crashes in [mailman](https://github.com/titanous/mailman) apps
|
7
|
+
- Automatically enable Bugsnag's resque failure backend
|
8
|
+
- Add automatic rake integration for rails apps
|
9
|
+
|
4
10
|
1.5.3
|
5
11
|
-----
|
6
12
|
- Deal with self-referential meta data correctly.
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,51 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
4
6
|
diff-lcs (1.1.3)
|
5
|
-
|
7
|
+
faraday (0.8.8)
|
8
|
+
multipart-post (~> 1.2.0)
|
9
|
+
git (1.2.6)
|
10
|
+
github_api (0.10.1)
|
11
|
+
addressable
|
12
|
+
faraday (~> 0.8.1)
|
13
|
+
hashie (>= 1.2)
|
14
|
+
multi_json (~> 1.4)
|
15
|
+
nokogiri (~> 1.5.2)
|
16
|
+
oauth2
|
17
|
+
hashie (2.0.5)
|
18
|
+
highline (1.6.19)
|
6
19
|
httparty (0.10.2)
|
7
20
|
multi_json (~> 1.0)
|
8
21
|
multi_xml (>= 0.5.2)
|
9
|
-
|
22
|
+
httpauth (0.2.0)
|
23
|
+
jeweler (1.8.8)
|
24
|
+
builder
|
10
25
|
bundler (~> 1.0)
|
11
26
|
git (>= 1.2.5)
|
27
|
+
github_api (= 0.10.1)
|
28
|
+
highline (>= 1.6.15)
|
29
|
+
nokogiri (= 1.5.10)
|
12
30
|
rake
|
13
31
|
rdoc
|
14
|
-
json (1.
|
32
|
+
json (1.8.0)
|
33
|
+
jwt (0.1.8)
|
34
|
+
multi_json (>= 1.5)
|
15
35
|
multi_json (1.7.2)
|
16
36
|
multi_xml (0.5.3)
|
17
|
-
|
18
|
-
|
37
|
+
multipart-post (1.2.0)
|
38
|
+
nokogiri (1.5.10)
|
39
|
+
oauth2 (0.9.2)
|
40
|
+
faraday (~> 0.8)
|
41
|
+
httpauth (~> 0.2)
|
42
|
+
jwt (~> 0.1.4)
|
43
|
+
multi_json (~> 1.0)
|
44
|
+
multi_xml (~> 0.5)
|
45
|
+
rack (~> 1.2)
|
46
|
+
rack (1.5.2)
|
47
|
+
rake (10.1.0)
|
48
|
+
rdoc (3.12.2)
|
19
49
|
json (~> 1.4)
|
20
50
|
rspec (2.11.0)
|
21
51
|
rspec-core (~> 2.11.0)
|
data/README.md
CHANGED
@@ -156,6 +156,10 @@ Bugsnag.notify(RuntimeError.new("Something broke"), {
|
|
156
156
|
Rake Integration
|
157
157
|
----------------
|
158
158
|
|
159
|
+
Rake integration is automatically enabled in Rails 3 apps, so providing you load the environment
|
160
|
+
in your Rake tasks you dont need to do anything to get Rake support. If you choose not to load
|
161
|
+
your environment, you can manually configure Bugsnag with a `bugsnag.configure` block in the Rakefile.
|
162
|
+
|
159
163
|
Bugsnag can automatically notify of all exceptions that happen in your rake tasks. In order
|
160
164
|
to enable this, you need to `require "bugsnag/rake"` in your Rakefile, like so:
|
161
165
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/bugsnag.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.
|
7
|
+
s.name = "bugsnag"
|
8
|
+
s.version = "1.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James Smith"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2013-10-10"
|
13
|
+
s.description = "Ruby notifier for bugsnag.com"
|
14
|
+
s.email = "james@bugsnag.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.md"
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/bugsnag/configuration.rb",
|
35
35
|
"lib/bugsnag/delay/resque.rb",
|
36
36
|
"lib/bugsnag/helpers.rb",
|
37
|
+
"lib/bugsnag/mailman.rb",
|
37
38
|
"lib/bugsnag/meta_data.rb",
|
38
39
|
"lib/bugsnag/middleware/callbacks.rb",
|
39
40
|
"lib/bugsnag/middleware/rack_request.rb",
|
@@ -48,11 +49,11 @@ Gem::Specification.new do |s|
|
|
48
49
|
"lib/bugsnag/rails/controller_methods.rb",
|
49
50
|
"lib/bugsnag/railtie.rb",
|
50
51
|
"lib/bugsnag/rake.rb",
|
52
|
+
"lib/bugsnag/resque.rb",
|
51
53
|
"lib/bugsnag/sidekiq.rb",
|
52
54
|
"lib/bugsnag/tasks.rb",
|
53
55
|
"lib/bugsnag/tasks/bugsnag.rake",
|
54
56
|
"lib/bugsnag/version.rb",
|
55
|
-
"lib/resque/failure/bugsnag.rb",
|
56
57
|
"rails/init.rb",
|
57
58
|
"spec/helper_spec.rb",
|
58
59
|
"spec/middleware_spec.rb",
|
@@ -60,32 +61,31 @@ Gem::Specification.new do |s|
|
|
60
61
|
"spec/rack_spec.rb",
|
61
62
|
"spec/spec_helper.rb"
|
62
63
|
]
|
63
|
-
s.homepage =
|
64
|
+
s.homepage = "http://github.com/bugsnag/bugsnag-ruby"
|
64
65
|
s.licenses = ["MIT"]
|
65
66
|
s.require_paths = ["lib"]
|
66
|
-
s.rubygems_version =
|
67
|
-
s.summary =
|
67
|
+
s.rubygems_version = "2.0.3"
|
68
|
+
s.summary = "Ruby notifier for bugsnag.com"
|
68
69
|
|
69
70
|
if s.respond_to? :specification_version then
|
70
|
-
|
71
|
-
s.specification_version = 3
|
71
|
+
s.specification_version = 4
|
72
72
|
|
73
|
-
if Gem::Version.new(Gem::
|
73
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
74
74
|
s.add_runtime_dependency(%q<multi_json>, ["~> 1.0"])
|
75
|
-
s.add_runtime_dependency(%q<httparty>, ["
|
75
|
+
s.add_runtime_dependency(%q<httparty>, ["< 1.0", ">= 0.6"])
|
76
76
|
s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
|
77
77
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
78
78
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
79
79
|
else
|
80
80
|
s.add_dependency(%q<multi_json>, ["~> 1.0"])
|
81
|
-
s.add_dependency(%q<httparty>, ["
|
81
|
+
s.add_dependency(%q<httparty>, ["< 1.0", ">= 0.6"])
|
82
82
|
s.add_dependency(%q<rspec>, ["~> 2.11.0"])
|
83
83
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
84
84
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
85
85
|
end
|
86
86
|
else
|
87
87
|
s.add_dependency(%q<multi_json>, ["~> 1.0"])
|
88
|
-
s.add_dependency(%q<httparty>, ["
|
88
|
+
s.add_dependency(%q<httparty>, ["< 1.0", ">= 0.6"])
|
89
89
|
s.add_dependency(%q<rspec>, ["~> 2.11.0"])
|
90
90
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
91
91
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
data/lib/bugsnag.rb
CHANGED
@@ -9,8 +9,9 @@ require "bugsnag/helpers"
|
|
9
9
|
require "bugsnag/rack"
|
10
10
|
require "bugsnag/railtie" if defined?(Rails::Railtie)
|
11
11
|
|
12
|
-
require "resque
|
12
|
+
require "bugsnag/resque" if defined?(::Resque::Job)
|
13
13
|
require "bugsnag/sidekiq" if defined?(Sidekiq)
|
14
|
+
require "bugsnag/mailman" if defined?(Mailman)
|
14
15
|
|
15
16
|
module Bugsnag
|
16
17
|
LOG_PREFIX = "** [Bugsnag] "
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Bugsnag
|
2
|
+
class Mailman
|
3
|
+
def call(mail)
|
4
|
+
begin
|
5
|
+
yield
|
6
|
+
rescue => ex
|
7
|
+
Bugsnag.notify(ex, :mailman => {"message" => mail.to_s})
|
8
|
+
raise
|
9
|
+
ensure
|
10
|
+
Bugsnag.clear_request_data
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if Mailman.config.respond_to?(:middleware)
|
17
|
+
Mailman.config.middleware.add ::Bugsnag::Mailman
|
18
|
+
end
|
data/lib/bugsnag/railtie.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "resque/failure/base"
|
2
|
+
require "resque/failure/multiple"
|
3
|
+
|
4
|
+
module Bugsnag
|
5
|
+
class Resque < ::Resque::Failure::Base
|
6
|
+
def self.configure(&block)
|
7
|
+
add_failure_backend
|
8
|
+
Bugsnag.configure(&block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.add_failure_backend
|
12
|
+
return if ::Resque::Failure.backend == self
|
13
|
+
|
14
|
+
# Ensure resque is using a "Multiple" failure backend
|
15
|
+
unless ::Resque::Failure.backend < ::Resque::Failure::Multiple
|
16
|
+
original_backend = ::Resque::Failure.backend
|
17
|
+
::Resque::Failure.backend = ::Resque::Failure::Multiple
|
18
|
+
::Resque::Failure.backend.classes ||= []
|
19
|
+
::Resque::Failure.backend.classes << original_backend
|
20
|
+
end
|
21
|
+
|
22
|
+
# Add Bugsnag failure backend
|
23
|
+
unless ::Resque::Failure.backend.classes.include?(self)
|
24
|
+
::Resque::Failure.backend.classes << self
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
Bugsnag.auto_notify(exception, {:context => "resque##{queue}", :payload => payload})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# For backwards compatibility
|
35
|
+
Resque::Failure::Bugsnag = Bugsnag::Resque
|
36
|
+
|
37
|
+
# Auto-load the failure backend
|
38
|
+
Bugsnag::Resque.add_failure_backend
|
@@ -21,7 +21,7 @@ namespace :bugsnag do
|
|
21
21
|
begin
|
22
22
|
require Rails.root.join('config/initializers/bugsnag')
|
23
23
|
rescue Exception => e
|
24
|
-
yml_filename = Rails.root.join("config
|
24
|
+
yml_filename = Rails.root.join("config","bugsnag.yml")
|
25
25
|
config = YAML.load_file(yml_filename) if File.exists?(yml_filename)
|
26
26
|
Bugsnag.configure(config[releaseStage] ? config[releaseStage] : config) if config
|
27
27
|
end
|
metadata
CHANGED
@@ -1,105 +1,99 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 5
|
8
|
-
- 3
|
9
|
-
version: 1.5.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.6.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- James Smith
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
prerelease: false
|
22
|
-
type: :runtime
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
23
14
|
name: multi_json
|
24
|
-
|
25
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
26
17
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
version: "1.0"
|
32
|
-
requirement: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
prerelease: false
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
35
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
36
28
|
name: httparty
|
37
|
-
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
|
-
- 6
|
44
|
-
version: "0.6"
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
45
31
|
- - <
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
version:
|
51
|
-
|
52
|
-
- !ruby/object:Gem::Dependency
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0.6'
|
37
|
+
type: :runtime
|
53
38
|
prerelease: false
|
54
|
-
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - <
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.0'
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.6'
|
47
|
+
- !ruby/object:Gem::Dependency
|
55
48
|
name: rspec
|
56
|
-
|
57
|
-
requirements:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
58
51
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
segments:
|
61
|
-
- 2
|
62
|
-
- 11
|
63
|
-
- 0
|
52
|
+
- !ruby/object:Gem::Version
|
64
53
|
version: 2.11.0
|
65
|
-
requirement: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
prerelease: false
|
68
54
|
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.11.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
69
62
|
name: rdoc
|
70
|
-
|
71
|
-
requirements:
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
72
65
|
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
- 3
|
76
|
-
- 12
|
77
|
-
version: "3.12"
|
78
|
-
requirement: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
prerelease: false
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.12'
|
81
68
|
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.12'
|
75
|
+
- !ruby/object:Gem::Dependency
|
82
76
|
name: jeweler
|
83
|
-
|
84
|
-
requirements:
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ~>
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 1.8.4
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
85
86
|
- - ~>
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 1
|
89
|
-
- 8
|
90
|
-
- 4
|
87
|
+
- !ruby/object:Gem::Version
|
91
88
|
version: 1.8.4
|
92
|
-
requirement: *id005
|
93
89
|
description: Ruby notifier for bugsnag.com
|
94
90
|
email: james@bugsnag.com
|
95
91
|
executables: []
|
96
|
-
|
97
92
|
extensions: []
|
98
|
-
|
99
|
-
extra_rdoc_files:
|
93
|
+
extra_rdoc_files:
|
100
94
|
- LICENSE.txt
|
101
95
|
- README.md
|
102
|
-
files:
|
96
|
+
files:
|
103
97
|
- .document
|
104
98
|
- .rspec
|
105
99
|
- .ruby-version
|
@@ -117,6 +111,7 @@ files:
|
|
117
111
|
- lib/bugsnag/configuration.rb
|
118
112
|
- lib/bugsnag/delay/resque.rb
|
119
113
|
- lib/bugsnag/helpers.rb
|
114
|
+
- lib/bugsnag/mailman.rb
|
120
115
|
- lib/bugsnag/meta_data.rb
|
121
116
|
- lib/bugsnag/middleware/callbacks.rb
|
122
117
|
- lib/bugsnag/middleware/rack_request.rb
|
@@ -131,46 +126,39 @@ files:
|
|
131
126
|
- lib/bugsnag/rails/controller_methods.rb
|
132
127
|
- lib/bugsnag/railtie.rb
|
133
128
|
- lib/bugsnag/rake.rb
|
129
|
+
- lib/bugsnag/resque.rb
|
134
130
|
- lib/bugsnag/sidekiq.rb
|
135
131
|
- lib/bugsnag/tasks.rb
|
136
132
|
- lib/bugsnag/tasks/bugsnag.rake
|
137
133
|
- lib/bugsnag/version.rb
|
138
|
-
- lib/resque/failure/bugsnag.rb
|
139
134
|
- rails/init.rb
|
140
135
|
- spec/helper_spec.rb
|
141
136
|
- spec/middleware_spec.rb
|
142
137
|
- spec/notification_spec.rb
|
143
138
|
- spec/rack_spec.rb
|
144
139
|
- spec/spec_helper.rb
|
145
|
-
has_rdoc: true
|
146
140
|
homepage: http://github.com/bugsnag/bugsnag-ruby
|
147
|
-
licenses:
|
141
|
+
licenses:
|
148
142
|
- MIT
|
143
|
+
metadata: {}
|
149
144
|
post_install_message:
|
150
145
|
rdoc_options: []
|
151
|
-
|
152
|
-
require_paths:
|
146
|
+
require_paths:
|
153
147
|
- lib
|
154
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
segments:
|
166
|
-
- 0
|
167
|
-
version: "0"
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
168
158
|
requirements: []
|
169
|
-
|
170
159
|
rubyforge_project:
|
171
|
-
rubygems_version:
|
160
|
+
rubygems_version: 2.0.3
|
172
161
|
signing_key:
|
173
|
-
specification_version:
|
162
|
+
specification_version: 4
|
174
163
|
summary: Ruby notifier for bugsnag.com
|
175
164
|
test_files: []
|
176
|
-
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# Resque support
|
2
|
-
|
3
|
-
# How to use:
|
4
|
-
# Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Bugsnag]
|
5
|
-
# Resque::Failure.backend = Resque::Failure::Multiple
|
6
|
-
#
|
7
|
-
|
8
|
-
begin
|
9
|
-
require "bugsnag"
|
10
|
-
rescue LoadError
|
11
|
-
raise "Can't find 'bugsnag' gem. Please add it to your Gemfile or install it."
|
12
|
-
end
|
13
|
-
|
14
|
-
require "resque/failure/base"
|
15
|
-
|
16
|
-
module Resque
|
17
|
-
module Failure
|
18
|
-
class Bugsnag < Base
|
19
|
-
def self.configure(&block)
|
20
|
-
unless ::Resque::Failure.backend < ::Resque::Failure::Multiple
|
21
|
-
original_backend = ::Resque::Failure.backend
|
22
|
-
::Resque::Failure.backend = ::Resque::Failure::Multiple
|
23
|
-
::Resque::Failure.backend.classes ||= []
|
24
|
-
::Resque::Failure.backend.classes << original_backend
|
25
|
-
end
|
26
|
-
|
27
|
-
::Resque::Failure.backend.classes << self
|
28
|
-
::Bugsnag.configure(&block)
|
29
|
-
end
|
30
|
-
|
31
|
-
def save
|
32
|
-
::Bugsnag.auto_notify(exception, bugsnag_job_data)
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
def bugsnag_job_data
|
37
|
-
{
|
38
|
-
:context => "resque##{queue}",
|
39
|
-
:meta_data => {
|
40
|
-
:payload => payload
|
41
|
-
}
|
42
|
-
}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|