bugsnag 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/UPGRADING.md +11 -0
- data/VERSION +1 -1
- data/lib/bugsnag.rb +1 -1
- data/lib/bugsnag/middleware/clearance_user.rb +4 -4
- data/lib/bugsnag/stacktrace.rb +6 -5
- data/spec/report_spec.rb +28 -0
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 87f0ef9e95838181ef04c215cf4e535d6833effa
         | 
| 4 | 
            +
              data.tar.gz: bcfe35f561ac496c436dd99733f0df630659683d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 62d4455c390e8e3c9fce2b0f6e5da83974ffcb1ef805e549e5e79324524e5bd07ff000a75d34c2f88bbb9cdc36acbde69b6ed6aac586635ed8957763fc70cb0c
         | 
| 7 | 
            +
              data.tar.gz: 4c8e70a864252fe2e1bbb6a8642da9f290edfe8f21a41f4ea026d6295f810aa07bf221c623990ce293e859cbd72677edb357dfbcbbd8833f2089083d2d623fc0
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/UPGRADING.md
    CHANGED
    
    | @@ -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. | 
| 1 | 
            +
            6.1.1
         | 
    
        data/lib/bugsnag.rb
    CHANGED
    
    | @@ -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][ | 
| 12 | 
            -
                    report.request_data[:rack_env][ | 
| 13 | 
            -
                    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
         | 
| 14 14 |  | 
| 15 15 | 
             
                    # Extract useful user information
         | 
| 16 16 | 
             
                    user = {}
         | 
| 17 | 
            -
                    user_object = report.request_data[:rack_env][ | 
| 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|
         | 
    
        data/lib/bugsnag/stacktrace.rb
    CHANGED
    
    | @@ -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 |  | 
    
        data/spec/report_spec.rb
    CHANGED
    
    | @@ -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"))
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 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
         |