resque-backtrace 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d698a0761b833ac82292b19096e45352f7abbd18
4
+ data.tar.gz: 573c94b3d6332cfd3a765221c2c87956751bd37a
5
+ SHA512:
6
+ metadata.gz: 43a9336df2647d277be0cc0d15494c3815aed6a663a70acd1d87b1db15500f625ecefb03f0b651f6e9b5ae2f63f976c5658591c0ebba8f2b78326b912838abff
7
+ data.tar.gz: f66e03e2543cadc86acce78cf9df209b32125be4369049f215d8e96a969846f478fd5bdd79b1067587ee94c37db0aae6a07ad89448dd4b70befe6bb83d1500a9
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in resque-backtrace.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Cameron Desautels
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # resque-backtrace
2
+
3
+ A simple gem to solve a simple problem: when an exception occurs
4
+ during a [Resque][1] job, no backtrace is visibly logged. In
5
+ production you probably want to use an exception catching service, but
6
+ in development you might just want to see the backtrace and fix the
7
+ issue.
8
+
9
+ **Note:** I've only tested this with with Resque 1.X---I'm not yet
10
+ aware if it's compatible with newer versions of Resque.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ gem 'resque-backtrace', require: false
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install resque-backtrace
25
+
26
+ ## Usage
27
+
28
+ If `resque-backtrace` is the only error handling strategy you want
29
+ use, open the file where you initialize Resque (possibly something like
30
+ `config/initializers/resque.rb`), and do the following:
31
+
32
+ ```ruby
33
+ require 'resque/failure/backtrace'
34
+
35
+ Resque::Failure.backend = Resque::Failure::Backtrace
36
+ ```
37
+
38
+ If you want to use multiple error handling strategies you'll need to
39
+ do something like this (which adds Redis for failures):
40
+
41
+ ```ruby
42
+ require 'resque/failure/backtrace'
43
+ require 'resque/failure/multiple'
44
+ require 'resque/failure/redis'
45
+
46
+ failure_backends = [Resque::Failure::Redis]
47
+
48
+ if Rails.env.development?
49
+ failure_backends << Resque::Failure::Backtrace
50
+ end
51
+
52
+ Resque::Failure::MultipleWithRetrySuppression.classes = failure_backends
53
+ Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression
54
+ ```
55
+
56
+ ## Contributing
57
+
58
+ 1. Fork it
59
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
60
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
61
+ 4. Push to the branch (`git push origin my-new-feature`)
62
+ 5. Create new Pull Request
63
+
64
+ [1]: https://github.com/resque/resque
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
1
+ module Resque
2
+ module Failure
3
+ class Backtrace < Base
4
+ def save
5
+ bt = filter_backtrace(exception.backtrace)
6
+ worker.log bt.join("\n")
7
+ end
8
+
9
+ private
10
+
11
+ def filter_backtrace(backtrace)
12
+ index = backtrace.index { |item| item.include?('/lib/resque/job.rb') }
13
+ backtrace.first(index.to_i)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "resque-backtrace"
7
+ spec.version = "0.0.1"
8
+ spec.authors = ["Cameron Desautels"]
9
+ spec.email = ["camdez@gmail.com"]
10
+ spec.description = "Log backtraces from exceptions in Resque jobs"
11
+ spec.summary = spec.summary
12
+ spec.homepage = "http://github.com/orgsync/resque-backtrace"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+
23
+ spec.add_runtime_dependency('resque', '>= 1.0')
24
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: resque-backtrace
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cameron Desautels
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: resque
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ description: Log backtraces from exceptions in Resque jobs
56
+ email:
57
+ - camdez@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/resque/failure/backtrace.rb
68
+ - resque-backtrace.gemspec
69
+ homepage: http://github.com/orgsync/resque-backtrace
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.1.11
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: ''
93
+ test_files: []