rack_bugzscout 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack_bugzscout.rb +49 -0
- metadata +64 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bugzscout'
|
3
|
+
|
4
|
+
module Rack
|
5
|
+
# Catches all exceptions raised from the app it wraps and
|
6
|
+
# sends a useful email with the exception, stacktrace, and
|
7
|
+
# contents of the environment.
|
8
|
+
|
9
|
+
class BugzScout
|
10
|
+
attr_reader :fogbugz_url, :fogbugz_user, :fogbugz_project, :fogbugz_area
|
11
|
+
|
12
|
+
def initialize(app,fogbugz_url,fogbugz_user,fogbugz_project='inbox',fogbugz_area='undecided')
|
13
|
+
@app = app
|
14
|
+
@fogbugz_url = fogbugz_url
|
15
|
+
@fogbugz_user = fogbugz_user
|
16
|
+
@fogbugz_project = fogbugz_project
|
17
|
+
@fogbugz_area = fogbugz_area
|
18
|
+
end
|
19
|
+
|
20
|
+
def call(env)
|
21
|
+
status, headers, body =
|
22
|
+
begin
|
23
|
+
@app.call(env)
|
24
|
+
rescue => boom
|
25
|
+
# TODO don't allow exceptions from send_notification to
|
26
|
+
# propogate
|
27
|
+
send_notification boom, env
|
28
|
+
raise
|
29
|
+
end
|
30
|
+
send_notification env['rack.exception'], env if env['rack.exception']
|
31
|
+
[status, headers, body]
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def send_notification(exception, env)
|
36
|
+
puts "sending notification!!!!!"
|
37
|
+
if %w(staging production).include?(ENV['RACK_ENV'])
|
38
|
+
FogBugz::BugzScout.submit(@fogbugz_url) do |scout|
|
39
|
+
scout.user = @fogbugz_user
|
40
|
+
scout.project = @fogbugz_project
|
41
|
+
scout.area = @fogbugz_area
|
42
|
+
scout.title = exception.class.name
|
43
|
+
scout.body = exception.message
|
44
|
+
end
|
45
|
+
env['bugzscout.submitted'] = true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack_bugzscout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Gorsuch
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-07 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bugzscout
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: michael@styledbits.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- lib/rack_bugzscout.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/mgorsuch/rack_bugzscout
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.3.5
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Rack Middleware for submitting FogBugz BugzScout reports.
|
63
|
+
test_files: []
|
64
|
+
|