delayed-plugins-airbrake 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +7 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/delayed-plugins-airbrake.gemspec +23 -0
- data/lib/delayed-plugins-airbrake.rb +32 -0
- data/lib/delayed-plugins-airbrake/version.rb +7 -0
- metadata +79 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Originally published as https://gist.github.com/granth/2223758, and later modified and posted under http://stackoverflow.com/questions/12683364/how-to-make-delayed-job-notify-airbrake-when-an-actionmailer-runs-into-an-error.
|
2
|
+
|
3
|
+
The original did not specify a license, but the StackOverflow version is implicitly CC BY-SA 3.0. As this gem is just packaging up that work, it is presumed to be the following license:
|
4
|
+
|
5
|
+
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
6
|
+
|
7
|
+
For more information, please see http://creativecommons.org/licenses/by-sa/3.0/
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Delayed::Plugins::Airbrake
|
2
|
+
|
3
|
+
`delayed_job` exception notification with Airbrake
|
4
|
+
|
5
|
+
Originally based on [this gist](https://gist.github.com/granth/2223758) and [this StackOverflow answer](http://stackoverflow.com/questions/12683364/how-to-make-delayed-job-notify-airbrake-when-an-actionmailer-runs-into-an-error).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'delayed-plugins-airbrake'
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Register the plugin like so:
|
16
|
+
|
17
|
+
require 'delayed/plugins/airbrake'
|
18
|
+
Delayed::Worker.plugins << Delayed::Plugins::Airbrake
|
19
|
+
|
20
|
+
In a Rails project, this can be done in `config/initializers`.
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'delayed-plugins-airbrake/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "delayed-plugins-airbrake"
|
8
|
+
gem.version = Delayed::Plugins::Airbrake::VERSION
|
9
|
+
gem.authors = ['Benjamin Oakes', 'Romain Champourlier', 'Grant Hollingworth']
|
10
|
+
gem.email = ['hello@benjaminoakes.com']
|
11
|
+
gem.description = %q(delayed_job exception notification with airbrake)
|
12
|
+
gem.summary = %q(Notify Airbrake on Delayed Job errors, including those on PerformableMethod. Packaged for use from https://gist.github.com/granth/2223758 and http://stackoverflow.com/questions/12683364/how-to-make-delayed-job-notify-airbrake-when-an-actionmailer-runs-into-an-error.)
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# Dependencies are not using versions so that there are few version conflicts for users.
|
21
|
+
gem.add_dependency('airbrake')
|
22
|
+
gem.add_dependency('delayed_job')
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'airbrake'
|
2
|
+
require 'delayed/performable_method'
|
3
|
+
require 'delayed/plugin'
|
4
|
+
|
5
|
+
require 'delayed-plugins-airbrake/version'
|
6
|
+
|
7
|
+
module Delayed
|
8
|
+
module Plugins
|
9
|
+
class Airbrake < Plugin
|
10
|
+
module Notify
|
11
|
+
def error(job, error)
|
12
|
+
::Airbrake.notify_or_ignore(
|
13
|
+
:error_class => error.class.name,
|
14
|
+
:error_message => "#{error.class.name}: #{error.message}",
|
15
|
+
:parameters => {
|
16
|
+
:failed_job => job.inspect,
|
17
|
+
}
|
18
|
+
)
|
19
|
+
super if defined?(super)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
callbacks do |lifecycle|
|
24
|
+
lifecycle.before(:invoke_job) do |job|
|
25
|
+
payload = job.payload_object
|
26
|
+
payload = payload.object if payload.is_a? Delayed::PerformableMethod
|
27
|
+
payload.extend Notify
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: delayed-plugins-airbrake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.beta.1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Benjamin Oakes
|
9
|
+
- Romain Champourlier
|
10
|
+
- Grant Hollingworth
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: airbrake
|
18
|
+
requirement: &12117500 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *12117500
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: delayed_job
|
29
|
+
requirement: &12116800 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *12116800
|
38
|
+
description: delayed_job exception notification with airbrake
|
39
|
+
email:
|
40
|
+
- hello@benjaminoakes.com
|
41
|
+
executables: []
|
42
|
+
extensions: []
|
43
|
+
extra_rdoc_files: []
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- LICENSE.txt
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
50
|
+
- delayed-plugins-airbrake.gemspec
|
51
|
+
- lib/delayed-plugins-airbrake.rb
|
52
|
+
- lib/delayed-plugins-airbrake/version.rb
|
53
|
+
homepage: ''
|
54
|
+
licenses: []
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>'
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.3.1
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.8.11
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Notify Airbrake on Delayed Job errors, including those on PerformableMethod. Packaged
|
77
|
+
for use from https://gist.github.com/granth/2223758 and http://stackoverflow.com/questions/12683364/how-to-make-delayed-job-notify-airbrake-when-an-actionmailer-runs-into-an-error.
|
78
|
+
test_files: []
|
79
|
+
has_rdoc:
|