bugsnag 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.3.3
5
+ -----
6
+ - Support windows-style paths in backtraces
7
+ - Fix bug with `before_bugsnag_notify` in Rails 2
8
+
4
9
  1.3.2
5
10
  -----
6
11
  - Notify will now build exceptions if a non-exception is passed in.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{bugsnag}
8
- s.version = "1.3.2"
7
+ s.name = "bugsnag"
8
+ s.version = "1.3.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 = %q{2013-04-18}
13
- s.description = %q{Ruby notifier for bugsnag.com}
14
- s.email = %q{james@bugsnag.com}
12
+ s.date = "2013-04-23"
13
+ s.description = "Ruby notifier for bugsnag.com"
14
+ s.email = "james@bugsnag.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.md"
@@ -59,32 +59,31 @@ Gem::Specification.new do |s|
59
59
  "spec/rack_spec.rb",
60
60
  "spec/spec_helper.rb"
61
61
  ]
62
- s.homepage = %q{http://github.com/bugsnag/bugsnag-ruby}
62
+ s.homepage = "http://github.com/bugsnag/bugsnag-ruby"
63
63
  s.licenses = ["MIT"]
64
64
  s.require_paths = ["lib"]
65
- s.rubygems_version = %q{1.3.6}
66
- s.summary = %q{Ruby notifier for bugsnag.com}
65
+ s.rubygems_version = "1.8.24"
66
+ s.summary = "Ruby notifier for bugsnag.com"
67
67
 
68
68
  if s.respond_to? :specification_version then
69
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
70
69
  s.specification_version = 3
71
70
 
72
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
71
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
73
72
  s.add_runtime_dependency(%q<multi_json>, ["~> 1.0"])
74
- s.add_runtime_dependency(%q<httparty>, [">= 0.6", "< 1.0"])
73
+ s.add_runtime_dependency(%q<httparty>, ["< 1.0", ">= 0.6"])
75
74
  s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
76
75
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
77
76
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
78
77
  else
79
78
  s.add_dependency(%q<multi_json>, ["~> 1.0"])
80
- s.add_dependency(%q<httparty>, [">= 0.6", "< 1.0"])
79
+ s.add_dependency(%q<httparty>, ["< 1.0", ">= 0.6"])
81
80
  s.add_dependency(%q<rspec>, ["~> 2.11.0"])
82
81
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
83
82
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
84
83
  end
85
84
  else
86
85
  s.add_dependency(%q<multi_json>, ["~> 1.0"])
87
- s.add_dependency(%q<httparty>, [">= 0.6", "< 1.0"])
86
+ s.add_dependency(%q<httparty>, ["< 1.0", ">= 0.6"])
88
87
  s.add_dependency(%q<rspec>, ["~> 2.11.0"])
89
88
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
90
89
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
@@ -11,6 +11,7 @@ module Bugsnag
11
11
  NOTIFIER_URL = "http://www.bugsnag.com"
12
12
 
13
13
  API_KEY_REGEX = /[0-9a-f]{32}/i
14
+ BACKTRACE_LINE_REGEX = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/
14
15
 
15
16
  MAX_EXCEPTIONS_TO_UNWRAP = 5
16
17
 
@@ -246,13 +247,17 @@ module Bugsnag
246
247
 
247
248
  def stacktrace(exception)
248
249
  (exception.backtrace || caller).map do |trace|
249
- method = nil
250
- file, line_str, method_str = trace.split(":")
250
+ # Parse the stacktrace line
251
+ _, file, line_str, method = trace.match(BACKTRACE_LINE_REGEX).to_a
251
252
 
253
+ # Skip stacktrace lines inside lib/bugsnag
252
254
  next(nil) if file =~ %r{lib/bugsnag}
253
255
 
254
256
  # Expand relative paths
255
- file = Pathname.new(file).realpath.to_s rescue file
257
+ p = Pathname.new(file)
258
+ if p.relative?
259
+ file = p.realpath.to_s rescue file
260
+ end
256
261
 
257
262
  # Generate the stacktrace line hash
258
263
  trace_hash = {}
@@ -272,10 +277,6 @@ module Bugsnag
272
277
  trace_hash[:file] = file
273
278
 
274
279
  # Add a method if we have it
275
- if method_str
276
- method_match = /in `([^']+)'/.match(method_str)
277
- method = method_match.captures.first if method_match
278
- end
279
280
  trace_hash[:method] = method if method && (method =~ /^__bind/).nil?
280
281
 
281
282
  if trace_hash[:file] && !trace_hash[:file].empty?
@@ -24,7 +24,7 @@ module Bugsnag::Rails
24
24
  # Set up "method symbol" callbacks
25
25
  methods.each do |method_symbol|
26
26
  request_data[callback_key] << lambda { |notification|
27
- self.send(method_symbol, notification)
27
+ controller.send(method_symbol, notification)
28
28
  }
29
29
  end
30
30
 
@@ -418,13 +418,11 @@ describe Bugsnag::Notification do
418
418
  it "should call to_exception on i18n error objects" do
419
419
  Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
420
420
  exception = get_exception_from_payload(payload)
421
- exception[:errorClass].should be == "I18n::MissingTranslationData"
421
+ exception[:errorClass].should be == "BugsnagTestException"
422
+ exception[:message].should be == "message"
422
423
  end
423
424
 
424
- I18n.exception_handler = lambda do |exception, locale, key, options|
425
- Bugsnag.notify exception
426
- end
427
- I18n.t(:test)
425
+ Bugsnag.notify(OpenStruct.new(:to_exception => BugsnagTestException.new("message")))
428
426
  end
429
427
 
430
428
  it "should generate runtimeerror for non exceptions" do
@@ -436,4 +434,54 @@ describe Bugsnag::Notification do
436
434
 
437
435
  Bugsnag.notify("test message")
438
436
  end
437
+
438
+ it "should support unix-style paths in backtraces" do
439
+ ex = BugsnagTestException.new("It crashed")
440
+ ex.set_backtrace([
441
+ "/Users/james/app/spec/notification_spec.rb:419",
442
+ "/Some/path/rspec/example.rb:113:in `instance_eval'"
443
+ ])
444
+
445
+ Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
446
+ exception = get_exception_from_payload(payload)
447
+ exception[:stacktrace].length.should be == 2
448
+
449
+ line = exception[:stacktrace][0]
450
+ line[:file].should be == "/Users/james/app/spec/notification_spec.rb"
451
+ line[:lineNumber].should be == 419
452
+ line[:method].should be nil
453
+
454
+ line = exception[:stacktrace][1]
455
+ line[:file].should be == "/Some/path/rspec/example.rb"
456
+ line[:lineNumber].should be == 113
457
+ line[:method].should be == "instance_eval"
458
+ end
459
+
460
+ Bugsnag.notify(ex)
461
+ end
462
+
463
+ it "should support windows-style paths in backtraces" do
464
+ ex = BugsnagTestException.new("It crashed")
465
+ ex.set_backtrace([
466
+ "C:/projects/test/app/controllers/users_controller.rb:13:in `index'",
467
+ "C:/ruby/1.9.1/gems/actionpack-2.3.10/filters.rb:638:in `block in run_before_filters'"
468
+ ])
469
+
470
+ Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
471
+ exception = get_exception_from_payload(payload)
472
+ exception[:stacktrace].length.should be == 2
473
+
474
+ line = exception[:stacktrace][0]
475
+ line[:file].should be == "C:/projects/test/app/controllers/users_controller.rb"
476
+ line[:lineNumber].should be == 13
477
+ line[:method].should be == "index"
478
+
479
+ line = exception[:stacktrace][1]
480
+ line[:file].should be == "C:/ruby/1.9.1/gems/actionpack-2.3.10/filters.rb"
481
+ line[:lineNumber].should be == 638
482
+ line[:method].should be == "block in run_before_filters"
483
+ end
484
+
485
+ Bugsnag.notify(ex)
486
+ end
439
487
  end
@@ -1,5 +1,4 @@
1
1
  require 'bugsnag'
2
- require 'i18n'
3
2
 
4
3
  class BugsnagTestException < RuntimeError; end
5
4
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 29
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 3
8
- - 2
9
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - James Smith
@@ -14,82 +15,92 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2013-04-18 00:00:00 -07:00
18
- default_executable:
18
+ date: 2013-04-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- prerelease: false
22
- type: :runtime
23
- name: multi_json
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
25
23
  requirements:
26
24
  - - ~>
27
25
  - !ruby/object:Gem::Version
26
+ hash: 15
28
27
  segments:
29
28
  - 1
30
29
  - 0
31
30
  version: "1.0"
32
- requirement: *id001
33
- - !ruby/object:Gem::Dependency
31
+ version_requirements: *id001
34
32
  prerelease: false
35
33
  type: :runtime
36
- name: httparty
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
34
+ name: multi_json
35
+ - !ruby/object:Gem::Dependency
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
38
  requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 6
44
- version: "0.6"
45
39
  - - <
46
40
  - !ruby/object:Gem::Version
41
+ hash: 15
47
42
  segments:
48
43
  - 1
49
44
  - 0
50
45
  version: "1.0"
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ hash: 7
49
+ segments:
50
+ - 0
51
+ - 6
52
+ version: "0.6"
53
+ version_requirements: *id002
53
54
  prerelease: false
54
- type: :development
55
- name: rspec
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ type: :runtime
56
+ name: httparty
57
+ - !ruby/object:Gem::Dependency
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
57
60
  requirements:
58
61
  - - ~>
59
62
  - !ruby/object:Gem::Version
63
+ hash: 35
60
64
  segments:
61
65
  - 2
62
66
  - 11
63
67
  - 0
64
68
  version: 2.11.0
65
- requirement: *id003
66
- - !ruby/object:Gem::Dependency
69
+ version_requirements: *id003
67
70
  prerelease: false
68
71
  type: :development
69
- name: rdoc
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ name: rspec
73
+ - !ruby/object:Gem::Dependency
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
71
76
  requirements:
72
77
  - - ~>
73
78
  - !ruby/object:Gem::Version
79
+ hash: 31
74
80
  segments:
75
81
  - 3
76
82
  - 12
77
83
  version: "3.12"
78
- requirement: *id004
79
- - !ruby/object:Gem::Dependency
84
+ version_requirements: *id004
80
85
  prerelease: false
81
86
  type: :development
82
- name: jeweler
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
87
+ name: rdoc
88
+ - !ruby/object:Gem::Dependency
89
+ requirement: &id005 !ruby/object:Gem::Requirement
90
+ none: false
84
91
  requirements:
85
92
  - - ~>
86
93
  - !ruby/object:Gem::Version
94
+ hash: 63
87
95
  segments:
88
96
  - 1
89
97
  - 8
90
98
  - 4
91
99
  version: 1.8.4
92
- requirement: *id005
100
+ version_requirements: *id005
101
+ prerelease: false
102
+ type: :development
103
+ name: jeweler
93
104
  description: Ruby notifier for bugsnag.com
94
105
  email: james@bugsnag.com
95
106
  executables: []
@@ -141,7 +152,6 @@ files:
141
152
  - spec/notification_spec.rb
142
153
  - spec/rack_spec.rb
143
154
  - spec/spec_helper.rb
144
- has_rdoc: true
145
155
  homepage: http://github.com/bugsnag/bugsnag-ruby
146
156
  licenses:
147
157
  - MIT
@@ -151,23 +161,27 @@ rdoc_options: []
151
161
  require_paths:
152
162
  - lib
153
163
  required_ruby_version: !ruby/object:Gem::Requirement
164
+ none: false
154
165
  requirements:
155
166
  - - ">="
156
167
  - !ruby/object:Gem::Version
168
+ hash: 3
157
169
  segments:
158
170
  - 0
159
171
  version: "0"
160
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
+ none: false
161
174
  requirements:
162
175
  - - ">="
163
176
  - !ruby/object:Gem::Version
177
+ hash: 3
164
178
  segments:
165
179
  - 0
166
180
  version: "0"
167
181
  requirements: []
168
182
 
169
183
  rubyforge_project:
170
- rubygems_version: 1.3.6
184
+ rubygems_version: 1.8.24
171
185
  signing_key:
172
186
  specification_version: 3
173
187
  summary: Ruby notifier for bugsnag.com