bugsnag 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/bugsnag.gemspec +5 -5
- data/lib/bugsnag/helpers.rb +17 -0
- data/lib/bugsnag/notification.rb +1 -1
- data/lib/bugsnag/rack.rb +35 -28
- data/lib/bugsnag/railtie.rb +5 -1
- data/lib/tasks/bugsnag.rake +1 -1
- metadata +17 -18
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.3
|
data/bugsnag.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "bugsnag"
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.3"
|
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 = "2012-
|
12
|
+
s.date = "2012-09-12"
|
13
13
|
s.description = "Ruby notifier for bugsnag.com"
|
14
14
|
s.email = "james@bugsnag.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -54,20 +54,20 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.specification_version = 3
|
55
55
|
|
56
56
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
-
s.add_runtime_dependency(%q<multi_json>, ["~> 1.
|
57
|
+
s.add_runtime_dependency(%q<multi_json>, ["~> 1.0"])
|
58
58
|
s.add_runtime_dependency(%q<httparty>, ["~> 0.8.3"])
|
59
59
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
60
60
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
61
61
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
62
62
|
else
|
63
|
-
s.add_dependency(%q<multi_json>, ["~> 1.
|
63
|
+
s.add_dependency(%q<multi_json>, ["~> 1.0"])
|
64
64
|
s.add_dependency(%q<httparty>, ["~> 0.8.3"])
|
65
65
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
66
66
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
67
67
|
s.add_dependency(%q<rcov>, [">= 0"])
|
68
68
|
end
|
69
69
|
else
|
70
|
-
s.add_dependency(%q<multi_json>, ["~> 1.
|
70
|
+
s.add_dependency(%q<multi_json>, ["~> 1.0"])
|
71
71
|
s.add_dependency(%q<httparty>, ["~> 0.8.3"])
|
72
72
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
73
73
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
data/lib/bugsnag/helpers.rb
CHANGED
@@ -30,5 +30,22 @@ module Bugsnag
|
|
30
30
|
def self.request_context(request)
|
31
31
|
"#{request.request_method} #{request.path}" if request
|
32
32
|
end
|
33
|
+
|
34
|
+
# Helper functions to work around MultiJson changes in 1.3+
|
35
|
+
def self.dump_json(object, options={})
|
36
|
+
if MultiJson.respond_to?(:adapter)
|
37
|
+
MultiJson.dump(object, options)
|
38
|
+
else
|
39
|
+
MultiJson.encode(object, options)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.load_json(json, options={})
|
44
|
+
if MultiJson.respond_to?(:adapter)
|
45
|
+
MultiJson.load(json, options)
|
46
|
+
else
|
47
|
+
MultiJson.decode(json, options)
|
48
|
+
end
|
49
|
+
end
|
33
50
|
end
|
34
51
|
end
|
data/lib/bugsnag/notification.rb
CHANGED
data/lib/bugsnag/rack.rb
CHANGED
@@ -2,6 +2,11 @@ module Bugsnag
|
|
2
2
|
class Rack
|
3
3
|
def initialize(app)
|
4
4
|
@app = app
|
5
|
+
|
6
|
+
# Automatically set the release_stage
|
7
|
+
Bugsnag.configuration.release_stage = ENV['RACK_ENV'] if ENV['RACK_ENV']
|
8
|
+
|
9
|
+
# Automatically set the project_root if possible
|
5
10
|
if Bugsnag.configuration.project_root.nil? || Bugsnag.configuration.project_root.empty?
|
6
11
|
if defined?(settings)
|
7
12
|
Bugsnag.configuration.project_root = settings.root
|
@@ -20,44 +25,46 @@ module Bugsnag
|
|
20
25
|
begin
|
21
26
|
response = @app.call(env)
|
22
27
|
rescue Exception => raised
|
23
|
-
Bugsnag.auto_notify(raised, bugsnag_request_data(env))
|
28
|
+
Bugsnag.auto_notify(raised, self.class.bugsnag_request_data(env))
|
24
29
|
raise
|
25
30
|
end
|
26
31
|
|
27
32
|
if env['rack.exception']
|
28
|
-
Bugsnag.auto_notify(env['rack.exception'], bugsnag_request_data(env))
|
33
|
+
Bugsnag.auto_notify(env['rack.exception'], self.class.bugsnag_request_data(env))
|
29
34
|
end
|
30
35
|
|
31
36
|
response
|
32
37
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
38
|
+
|
39
|
+
class << self
|
40
|
+
def bugsnag_request_data(env)
|
41
|
+
request = ::Rack::Request.new(env)
|
42
|
+
|
43
|
+
session = env["rack.session"]
|
44
|
+
params = env["action_dispatch.request.parameters"] || request.params
|
45
|
+
user_id = session[:session_id] || session["session_id"] rescue nil
|
46
|
+
|
47
|
+
{
|
48
|
+
:user_id => user_id,
|
49
|
+
:context => Bugsnag::Helpers.param_context(params) || Bugsnag::Helpers.request_context(request),
|
50
|
+
:meta_data => {
|
51
|
+
:request => {
|
52
|
+
:url => request.url,
|
53
|
+
:controller => params[:controller],
|
54
|
+
:action => params[:action],
|
55
|
+
:params => bugsnag_filter_if_filtering(env, Bugsnag::Helpers.cleanup_hash(params.to_hash)),
|
56
|
+
},
|
57
|
+
:session => bugsnag_filter_if_filtering(env, Bugsnag::Helpers.cleanup_hash(session)),
|
58
|
+
:environment => bugsnag_filter_if_filtering(env, Bugsnag::Helpers.cleanup_hash(env))
|
59
|
+
}
|
54
60
|
}
|
55
|
-
|
56
|
-
end
|
61
|
+
end
|
57
62
|
|
58
|
-
|
59
|
-
|
60
|
-
|
63
|
+
private
|
64
|
+
def bugsnag_filter_if_filtering(env, hash)
|
65
|
+
@params_filters ||= env["action_dispatch.parameter_filter"]
|
66
|
+
Bugsnag::Helpers.apply_filters(hash, @params_filters)
|
67
|
+
end
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
data/lib/bugsnag/railtie.rb
CHANGED
@@ -10,7 +10,11 @@ module Bugsnag
|
|
10
10
|
end
|
11
11
|
|
12
12
|
initializer "bugsnag.use_rack_middleware" do |app|
|
13
|
-
|
13
|
+
begin
|
14
|
+
app.config.middleware.insert_after ActionDispatch::ShowExceptions, "Bugsnag::Rack"
|
15
|
+
rescue
|
16
|
+
app.config.middleware.use "Bugsnag::Rack"
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
config.after_initialize do
|
data/lib/tasks/bugsnag.rake
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 3
|
10
|
+
version: 1.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-09-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
@@ -23,16 +23,15 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
hash:
|
26
|
+
hash: 15
|
27
27
|
segments:
|
28
28
|
- 1
|
29
|
-
-
|
30
|
-
|
31
|
-
version: 1.3.4
|
32
|
-
version_requirements: *id001
|
33
|
-
name: multi_json
|
29
|
+
- 0
|
30
|
+
version: "1.0"
|
34
31
|
prerelease: false
|
35
32
|
type: :runtime
|
33
|
+
name: multi_json
|
34
|
+
version_requirements: *id001
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
37
|
none: false
|
@@ -45,10 +44,10 @@ dependencies:
|
|
45
44
|
- 8
|
46
45
|
- 3
|
47
46
|
version: 0.8.3
|
48
|
-
version_requirements: *id002
|
49
|
-
name: httparty
|
50
47
|
prerelease: false
|
51
48
|
type: :runtime
|
49
|
+
name: httparty
|
50
|
+
version_requirements: *id002
|
52
51
|
- !ruby/object:Gem::Dependency
|
53
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
53
|
none: false
|
@@ -59,10 +58,10 @@ dependencies:
|
|
59
58
|
segments:
|
60
59
|
- 0
|
61
60
|
version: "0"
|
62
|
-
version_requirements: *id003
|
63
|
-
name: shoulda
|
64
61
|
prerelease: false
|
65
62
|
type: :development
|
63
|
+
name: shoulda
|
64
|
+
version_requirements: *id003
|
66
65
|
- !ruby/object:Gem::Dependency
|
67
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
67
|
none: false
|
@@ -75,10 +74,10 @@ dependencies:
|
|
75
74
|
- 6
|
76
75
|
- 4
|
77
76
|
version: 1.6.4
|
78
|
-
version_requirements: *id004
|
79
|
-
name: jeweler
|
80
77
|
prerelease: false
|
81
78
|
type: :development
|
79
|
+
name: jeweler
|
80
|
+
version_requirements: *id004
|
82
81
|
- !ruby/object:Gem::Dependency
|
83
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
84
83
|
none: false
|
@@ -89,10 +88,10 @@ dependencies:
|
|
89
88
|
segments:
|
90
89
|
- 0
|
91
90
|
version: "0"
|
92
|
-
version_requirements: *id005
|
93
|
-
name: rcov
|
94
91
|
prerelease: false
|
95
92
|
type: :development
|
93
|
+
name: rcov
|
94
|
+
version_requirements: *id005
|
96
95
|
description: Ruby notifier for bugsnag.com
|
97
96
|
email: james@bugsnag.com
|
98
97
|
executables: []
|