resque_coalmine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +73 -0
- data/Guardfile +5 -0
- data/README.md +48 -0
- data/Rakefile +12 -0
- data/lib/coalmine/version.rb +3 -0
- data/lib/resque/failure/coalmine.rb +21 -0
- data/lib/resque_coalmine.rb +5 -0
- data/resque_coalmine.gemspec +20 -0
- data/spec/resque/failure/coalmine_spec.rb +46 -0
- data/spec/spec_helper.rb +8 -0
- metadata +108 -0
data/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
|
13
|
+
# Ignore all logfiles and tempfiles.
|
14
|
+
/log/*.log
|
15
|
+
/tmp
|
16
|
+
.DS_Store
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
resque_coalmine (0.0.1)
|
5
|
+
builder (= 3.0.4)
|
6
|
+
coalmine (= 0.5.3)
|
7
|
+
resque (= 1.23.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (3.2.9)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
builder (3.0.4)
|
16
|
+
coalmine (0.5.3)
|
17
|
+
jsonbuilder
|
18
|
+
diff-lcs (1.1.3)
|
19
|
+
guard (1.4.0)
|
20
|
+
listen (>= 0.4.2)
|
21
|
+
thor (>= 0.14.6)
|
22
|
+
guard-rspec (2.1.0)
|
23
|
+
guard (>= 1.1)
|
24
|
+
rspec (~> 2.11)
|
25
|
+
i18n (0.6.1)
|
26
|
+
jsonbuilder (0.3.1)
|
27
|
+
activesupport (>= 2.3.2)
|
28
|
+
listen (0.6.0)
|
29
|
+
metaclass (0.0.1)
|
30
|
+
mocha (0.12.0)
|
31
|
+
metaclass (~> 0.0.1)
|
32
|
+
multi_json (1.5.0)
|
33
|
+
rack (1.4.1)
|
34
|
+
rack-protection (1.3.1)
|
35
|
+
rack
|
36
|
+
rake (0.9.2.2)
|
37
|
+
rb-fsevent (0.9.1)
|
38
|
+
redis (3.0.2)
|
39
|
+
redis-namespace (1.2.1)
|
40
|
+
redis (~> 3.0.0)
|
41
|
+
resque (1.23.0)
|
42
|
+
multi_json (~> 1.0)
|
43
|
+
redis-namespace (~> 1.0)
|
44
|
+
sinatra (>= 0.9.2)
|
45
|
+
vegas (~> 0.1.2)
|
46
|
+
rspec (2.11.0)
|
47
|
+
rspec-core (~> 2.11.0)
|
48
|
+
rspec-expectations (~> 2.11.0)
|
49
|
+
rspec-mocks (~> 2.11.0)
|
50
|
+
rspec-core (2.11.1)
|
51
|
+
rspec-expectations (2.11.3)
|
52
|
+
diff-lcs (~> 1.1.3)
|
53
|
+
rspec-mocks (2.11.3)
|
54
|
+
sinatra (1.3.3)
|
55
|
+
rack (~> 1.3, >= 1.3.6)
|
56
|
+
rack-protection (~> 1.2)
|
57
|
+
tilt (~> 1.3, >= 1.3.3)
|
58
|
+
thor (0.16.0)
|
59
|
+
tilt (1.3.3)
|
60
|
+
vegas (0.1.11)
|
61
|
+
rack (>= 1.0.0)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
guard (= 1.4.0)
|
68
|
+
guard-rspec (= 2.1.0)
|
69
|
+
mocha (= 0.12.0)
|
70
|
+
rake (= 0.9.2.2)
|
71
|
+
rb-fsevent (= 0.9.1)
|
72
|
+
resque_coalmine!
|
73
|
+
rspec (= 2.11.0)
|
data/Guardfile
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
guard 'rspec', :all_on_start => true, :all_after_pass => false, :cli => "--require spec_helper.rb --color --format documentation --fail-fast --backtrace" do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/resque_coalmine/#{m[1]}_spec.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { "spec" }
|
5
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Resque Coalmine
|
2
|
+
|
3
|
+
Resque failure backend that sends exceptions to [coalmineapp.com](http://coalmineapp.com).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'resque_coalmine'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install resque_coalmine
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Resque::Failure::Coalmine.configure do |config|
|
22
|
+
config.signature = 'my_secret_signature'
|
23
|
+
end
|
24
|
+
|
25
|
+
Resque::Failure.backend = Resque::Failure::Coalmine
|
26
|
+
|
27
|
+
If you are already using coalmineapp.com gem, you just need
|
28
|
+
|
29
|
+
Resque::Failure.backend = Resque::Failure::Coalmine
|
30
|
+
|
31
|
+
If you've not yet configured Coalmine in your project, visit the project page for installation instructions.
|
32
|
+
|
33
|
+
## Notes
|
34
|
+
|
35
|
+
In development mode you need to configure Coalmine to send exceptions, default is `['production', 'staging']`
|
36
|
+
|
37
|
+
Coalmine.configure do |config|
|
38
|
+
....
|
39
|
+
config.enabled_environments += %w( development ) if Rails.env.development?
|
40
|
+
end
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
1. Fork it
|
45
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
47
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Resque
|
2
|
+
module Failure
|
3
|
+
class Coalmine < Base
|
4
|
+
def self.configure(&block)
|
5
|
+
::Coalmine.configure(&block)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.count
|
9
|
+
# We can't get the total # of errors from Coalmine so we fake it
|
10
|
+
# by asking Resque how many errors it has seen.
|
11
|
+
Stat[:failed]
|
12
|
+
end
|
13
|
+
|
14
|
+
def save
|
15
|
+
::Coalmine.custom_variables[:payload_class] = payload['class']
|
16
|
+
::Coalmine.custom_variables[:payload_args] = payload['args'].inspect
|
17
|
+
::Coalmine.notify(exception)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/coalmine/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Luqman Amjad"]
|
6
|
+
gem.email = ["luqman.amjad@fatsoma.com"]
|
7
|
+
gem.description = 'Sends exceptions to coalmineapp.com'
|
8
|
+
gem.summary = 'Resque failure backend for coalmine'
|
9
|
+
gem.homepage = "http://www.fatsoma.com"
|
10
|
+
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = "resque_coalmine"
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = ResqueCoalmine::VERSION
|
16
|
+
|
17
|
+
gem.add_dependency('coalmine', '0.5.3')
|
18
|
+
gem.add_dependency('resque', '1.23.0')
|
19
|
+
gem.add_dependency('builder', '3.0.4')
|
20
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
describe Resque::Failure::Coalmine do
|
2
|
+
|
3
|
+
describe '.configure block' do
|
4
|
+
let(:signature) { 'my_secret_signature' }
|
5
|
+
before do
|
6
|
+
Resque::Failure::Coalmine.configure do |config|
|
7
|
+
config.signature = signature
|
8
|
+
end
|
9
|
+
end
|
10
|
+
it 'sets signature to "my_secret_signature"' do
|
11
|
+
expect(Coalmine.config.signature).to eql signature
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#count" do
|
16
|
+
let(:failed) { 0 }
|
17
|
+
before { Resque::Stat.expects(:[]).with(:failed).returns(failed) }
|
18
|
+
it 'should be zero' do
|
19
|
+
expect(Resque::Failure::Coalmine.count).to eq failed
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#save" do
|
24
|
+
let(:exception) { StandardError.new("ka boom") }
|
25
|
+
let(:worker) { Resque::Worker.new(:coalmine) }
|
26
|
+
let(:queue) { "coalmine" }
|
27
|
+
let(:klass) { Object }
|
28
|
+
let(:args) { 2012 }
|
29
|
+
let(:payload) { {'class' => klass, 'args' => args } }
|
30
|
+
let(:backend) { Resque::Failure::Coalmine.new(exception, worker, queue, payload) }
|
31
|
+
|
32
|
+
it "notifies coaline with exception" do
|
33
|
+
Coalmine.expects(:notify).with(exception)
|
34
|
+
backend.save
|
35
|
+
end
|
36
|
+
|
37
|
+
describe Coalmine do
|
38
|
+
subject { Coalmine.custom_variables }
|
39
|
+
it 'has custom variables set "payload_class: Object", "payload_args: 2012"' do
|
40
|
+
expect(subject[:payload_class]).to eq payload['class']
|
41
|
+
expect(subject[:payload_args]).to eq payload['args'].inspect
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resque_coalmine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Luqman Amjad
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: coalmine
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.5.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: resque
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - '='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.23.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.23.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: builder
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - '='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.0.4
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.4
|
62
|
+
description: Sends exceptions to coalmineapp.com
|
63
|
+
email:
|
64
|
+
- luqman.amjad@fatsoma.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rspec
|
71
|
+
- Gemfile
|
72
|
+
- Gemfile.lock
|
73
|
+
- Guardfile
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- lib/coalmine/version.rb
|
77
|
+
- lib/resque/failure/coalmine.rb
|
78
|
+
- lib/resque_coalmine.rb
|
79
|
+
- resque_coalmine.gemspec
|
80
|
+
- spec/resque/failure/coalmine_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
homepage: http://www.fatsoma.com
|
83
|
+
licenses: []
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.8.24
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Resque failure backend for coalmine
|
106
|
+
test_files:
|
107
|
+
- spec/resque/failure/coalmine_spec.rb
|
108
|
+
- spec/spec_helper.rb
|