bugsnag 6.1.0 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87a875a7b8d7eb04937db718665e498303157cea
4
- data.tar.gz: 39d1e2ad03f42d882286a4ed6845312e99a63738
3
+ metadata.gz: 87f0ef9e95838181ef04c215cf4e535d6833effa
4
+ data.tar.gz: bcfe35f561ac496c436dd99733f0df630659683d
5
5
  SHA512:
6
- metadata.gz: 9fb191d7ec53908887b1b3cbb200a9d714fb0dbd7d17b2157808b110b1f0b5994f2b6d04a0549e39311fa4e822f21bf51152ceb55a151f90fcf28300cdc30244
7
- data.tar.gz: 6def29d78105b3e3c2b39aa4d874d86d080285a0afe5e27b2fae9e11c348c1e37ef71dae1447a1656224e989611f96bc4ed597f2d6069daf635cbbdfe86cd0b6
6
+ metadata.gz: 62d4455c390e8e3c9fce2b0f6e5da83974ffcb1ef805e549e5e79324524e5bd07ff000a75d34c2f88bbb9cdc36acbde69b6ed6aac586635ed8957763fc70cb0c
7
+ data.tar.gz: 4c8e70a864252fe2e1bbb6a8642da9f290edfe8f21a41f4ea026d6295f810aa07bf221c623990ce293e859cbd72677edb357dfbcbbd8833f2089083d2d623fc0
@@ -1,6 +1,13 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 6.1.1 (23 Nov 2017)
5
+
6
+ ### Fixes
7
+
8
+ * Ensured Bugsnag class intialises before railties initialised
9
+ | [#396](https://github.com/bugsnag/bugsnag-ruby/pull/396)
10
+
4
11
  ## 6.1.0 (17 Nov 2017)
5
12
 
6
13
  ### Enhancements
@@ -56,3 +56,14 @@ guide](https://docs.bugsnag.com/api/deploy-tracking/capistrano/) for more inform
56
56
  + config.logger.level = Logger::DEBUG
57
57
  end
58
58
  ```
59
+
60
+ * Log accessor functions on the `Bugsnag` object no longer exist. Logging must now be accessed through the configuration object:
61
+
62
+ ```diff
63
+ - Bugsnag.log "Log message"
64
+ - Bugsnag.warn "Warn message"
65
+ - Bugsnag.debug "Debug message"
66
+ + Bugsnag.configuration.logger.info "Info message"
67
+ + Bugsnag.configuration.logger.warn "Warn message"
68
+ + Bugsnag.configuration.logger.debug "Debug message"
69
+ ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.1.0
1
+ 6.1.1
@@ -13,7 +13,6 @@ require "bugsnag/delivery/synchronous"
13
13
  require "bugsnag/delivery/thread_queue"
14
14
 
15
15
  require "bugsnag/integrations/rack"
16
- require "bugsnag/integrations/railtie" if defined?(Rails::Railtie)
17
16
 
18
17
  require "bugsnag/middleware/rack_request"
19
18
  require "bugsnag/middleware/warden_user"
@@ -127,6 +126,7 @@ module Bugsnag
127
126
  end
128
127
  end
129
128
 
129
+ require "bugsnag/integrations/railtie" if defined?(Rails::Railtie)
130
130
  [:resque, :sidekiq, :mailman, :delayed_job, :shoryuken, :que].each do |integration|
131
131
  begin
132
132
  require "bugsnag/integrations/#{integration}"
@@ -8,13 +8,13 @@ module Bugsnag::Middleware
8
8
 
9
9
  def call(report)
10
10
  if report.request_data[:rack_env] &&
11
- report.request_data[:rack_env]["clearance"] &&
12
- report.request_data[:rack_env]["clearance"].signed_in? &&
13
- report.request_data[:rack_env]["clearance"].current_user
11
+ report.request_data[:rack_env][:clearance] &&
12
+ report.request_data[:rack_env][:clearance].signed_in? &&
13
+ report.request_data[:rack_env][:clearance].current_user
14
14
 
15
15
  # Extract useful user information
16
16
  user = {}
17
- user_object = report.request_data[:rack_env]["clearance"].current_user
17
+ user_object = report.request_data[:rack_env][:clearance].current_user
18
18
  if user_object
19
19
  # Build the bugsnag user info from the current user record
20
20
  COMMON_USER_FIELDS.each do |field|
@@ -7,6 +7,9 @@ module Bugsnag
7
7
  # e.g. "org.jruby.Ruby.runScript(Ruby.java:807)"
8
8
  JAVA_BACKTRACE_REGEX = /^(.*)\((.*)(?::([0-9]+))?\)$/
9
9
 
10
+ # Path to vendored code. Used to mark file paths as out of project.
11
+ VENDOR_PATH = 'vendor/'
12
+
10
13
  def initialize(backtrace, configuration)
11
14
  @configuration = configuration
12
15
 
@@ -31,7 +34,6 @@ module Bugsnag
31
34
 
32
35
  # Generate the stacktrace line hash
33
36
  trace_hash = {}
34
- trace_hash[:inProject] = true if in_project?(file)
35
37
  trace_hash[:lineNumber] = line_str.to_i
36
38
 
37
39
  if configuration.send_code
@@ -40,9 +42,12 @@ module Bugsnag
40
42
 
41
43
  # Clean up the file path in the stacktrace
42
44
  if defined?(@configuration.project_root) && @configuration.project_root.to_s != ''
45
+ trace_hash[:inProject] = true if file.start_with?(@configuration.project_root)
43
46
  file.sub!(/#{@configuration.project_root}\//, "")
47
+ trace_hash.delete(:inProject) if file.start_with?(VENDOR_PATH)
44
48
  end
45
49
 
50
+
46
51
  # Strip common gem path prefixes
47
52
  if defined?(Gem)
48
53
  file = Gem.path.inject(file) {|line, path| line.sub(/#{path}\//, "") }
@@ -67,10 +72,6 @@ module Bugsnag
67
72
 
68
73
  private
69
74
 
70
- def in_project?(line)
71
- @configuration.project_root && line.start_with?(@configuration.project_root.to_s)
72
- end
73
-
74
75
  def code(file, line_number, num_lines = 7)
75
76
  code_hash = {}
76
77
 
@@ -524,6 +524,34 @@ describe Bugsnag::Report do
524
524
  }
525
525
  end
526
526
 
527
+ it 'marks vendored stack frames as out-of-project' do
528
+ project_root = File.expand_path File.dirname(__FILE__)
529
+ Bugsnag.configuration.project_root = project_root
530
+
531
+ ex = Exception.new('Division by zero')
532
+ allow(ex).to receive (:backtrace) {[
533
+ File.join(project_root, "vendor/strutils/lib/string.rb:508:in `splice'"),
534
+ File.join(project_root, "vendors/strutils/lib/string.rb:508:in `splice'"),
535
+ File.join(project_root, "lib/helpers/string.rb:32:in `splice'"),
536
+ File.join(project_root, "lib/vendor/lib/article.rb:158:in `initialize'"),
537
+ File.join(project_root, "lib/prog.rb:158:in `read_articles'"),
538
+ "app.rb:10:in `main'",
539
+ "(pry):3:in `__pry__'"
540
+ ]}
541
+ Bugsnag.notify(ex)
542
+ expect(Bugsnag).to have_sent_notification{ |payload|
543
+ exception = get_exception_from_payload(payload)
544
+
545
+ expect(exception["stacktrace"][0]["inProject"]).to be_nil
546
+ expect(exception["stacktrace"][1]["inProject"]).to be true
547
+ expect(exception["stacktrace"][2]["inProject"]).to be true
548
+ expect(exception["stacktrace"][3]["inProject"]).to be true
549
+ expect(exception["stacktrace"][4]["inProject"]).to be true
550
+ expect(exception["stacktrace"][5]["inProject"]).to be_nil
551
+ expect(exception["stacktrace"][6]["inProject"]).to be_nil
552
+ }
553
+ end
554
+
527
555
  it "adds app_version to the payload if it is set" do
528
556
  Bugsnag.configuration.app_version = "1.1.1"
529
557
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
@@ -1,4 +1,4 @@
1
- if ARGV.include? "--coverage"
1
+ if ENV['GEMSETS'] and ENV['GEMSETS'].include? "coverage"
2
2
  require 'simplecov'
3
3
  require 'coveralls'
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-17 00:00:00.000000000 Z
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby notifier for bugsnag.com
14
14
  email: james@bugsnag.com