rollbar 2.13.0 → 2.13.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: d7a60c8f3a1929550de7236c1f2cad3f06d686ef
4
- data.tar.gz: 7c91ff957d85efa7387384948174d1ea6f745b00
3
+ metadata.gz: 4a27c812bcbc48208ec5968eaae3a20ef863b43a
4
+ data.tar.gz: f6d8171c122522d4f9f44caf1971fb0fa7e1fd94
5
5
  SHA512:
6
- metadata.gz: a53c437380edf552740dec8ece8c8bf90f774b5c1ba420ac8526f8a11eaf8bd502ec6798f70da4ce056cbadae215ebef4629cd75e81742164cc78838fc89a0ba
7
- data.tar.gz: f5bda5da6010fa1a5d6d4d1571c5973e78d42fba2523731be1f5c38295cf808c7f2e9bfdb9035da143963fdb65dc8c586b739e91b4200a2a70f4f7fbafc5eea9
6
+ metadata.gz: ed6a83b65c5a09f55c5605c94adcc18d015bb9691f1ca608c5bb2c0d869ae2ac1f720b12fcb4c50df26fd8c316757c9f5914574ca98dd724f70e6ca30fddfdc0
7
+ data.tar.gz: 776e79159576228d00a385c4650499da8e7ae7e5bda62e342f27eb94ec7f7b651335b9a477a29db0cda2634f456c35eb828fb81ea1ef5d1ed411bbb58cf77ecb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.13.1
4
+
5
+ Fixes:
6
+
7
+ - Inherit test controller from ActionController::Base
8
+ - Fix test rake task when Rack::MockRequest is not defined
9
+ - Fix docs for Sinatra middleware
10
+ - Fix few basic rubocop offenses
11
+
3
12
  ## 2.13.0
4
13
 
5
14
  Features:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rollbar [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.13.0)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ # Rollbar [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.13.1)](https://travis-ci.org/rollbar/rollbar-gem/branches)
2
2
 
3
3
  <!-- RemoveNext -->
4
4
  [Rollbar](https://rollbar.com) is an error tracking service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
@@ -153,6 +153,8 @@ end
153
153
  Then mount the middleware in your app, like:
154
154
 
155
155
  ```ruby
156
+ require 'rollbar/middleware/sinatra'
157
+
156
158
  class MyApp < Sinatra::Base
157
159
  use Rollbar::Middleware::Sinatra
158
160
  # other middleware/etc
@@ -11,6 +11,8 @@ require 'rollbar/logger_proxy'
11
11
  require 'rollbar/item'
12
12
 
13
13
  module Rollbar
14
+ # The notifier class. It has the core functionality
15
+ # for sending reports to the API.
14
16
  class Notifier
15
17
  attr_accessor :configuration
16
18
  attr_accessor :last_report
@@ -140,7 +142,7 @@ module Rollbar
140
142
 
141
143
  begin
142
144
  report(level, message, exception, extra)
143
- rescue Exception => e
145
+ rescue StandardError, SystemStackError => e
144
146
  report_internal_error(e)
145
147
 
146
148
  'error'
@@ -180,9 +182,9 @@ module Rollbar
180
182
  def process_item(item)
181
183
  if configuration.write_to_file
182
184
  if configuration.use_async
183
- @file_semaphore.synchronize {
185
+ @file_semaphore.synchronize do
184
186
  write_item(item)
185
- }
187
+ end
186
188
  else
187
189
  write_item(item)
188
190
  end
@@ -383,26 +385,26 @@ module Rollbar
383
385
  # Rollbar project. We'll first attempt to provide a report including the exception traceback.
384
386
  # If that fails, we'll fall back to a more static failsafe response.
385
387
  def report_internal_error(exception)
386
- log_error "[Rollbar] Reporting internal error encountered while sending data to Rollbar."
388
+ log_error '[Rollbar] Reporting internal error encountered while sending data to Rollbar.'
387
389
 
388
390
  begin
389
- item = build_item('error', nil, exception, {:internal => true})
391
+ item = build_item('error', nil, exception, :internal => true)
390
392
  rescue => e
391
- send_failsafe("build_item in exception_data", e)
393
+ send_failsafe('build_item in exception_data', e)
392
394
  return
393
395
  end
394
396
 
395
397
  begin
396
398
  process_item(item)
397
399
  rescue => e
398
- send_failsafe("error in process_item", e)
400
+ send_failsafe('error in process_item', e)
399
401
  return
400
402
  end
401
403
 
402
404
  begin
403
405
  log_instance_link(item['data'])
404
406
  rescue => e
405
- send_failsafe("error logging instance link", e)
407
+ send_failsafe('error logging instance link', e)
406
408
  return
407
409
  end
408
410
  end
@@ -475,7 +477,7 @@ module Rollbar
475
477
  if uri.scheme == 'https'
476
478
  http.use_ssl = true
477
479
  # This is needed to have 1.8.7 passing tests
478
- http.ca_file = ENV['ROLLBAR_SSL_CERT_FILE'] if ENV.has_key?('ROLLBAR_SSL_CERT_FILE')
480
+ http.ca_file = ENV['ROLLBAR_SSL_CERT_FILE'] if ENV.key?('ROLLBAR_SSL_CERT_FILE')
479
481
  http.verify_mode = ssl_verify_mode
480
482
  end
481
483
 
@@ -526,9 +528,9 @@ module Rollbar
526
528
 
527
529
  def write_item(item)
528
530
  if configuration.use_async
529
- @file_semaphore.synchronize {
531
+ @file_semaphore.synchronize do
530
532
  do_write_item(item)
531
- }
533
+ end
532
534
  else
533
535
  do_write_item(item)
534
536
  end
@@ -541,13 +543,12 @@ module Rollbar
541
543
  return unless body
542
544
 
543
545
  begin
544
- unless @file
545
- @file = File.open(configuration.filepath, "a")
546
- end
546
+ @file ||= File.open(configuration.filepath, 'a')
547
547
 
548
548
  @file.puts(body)
549
549
  @file.flush
550
- log_info "[Rollbar] Success"
550
+
551
+ log_info '[Rollbar] Success'
551
552
  rescue IOError => e
552
553
  log_error "[Rollbar] Error opening/writing to file: #{e}"
553
554
  end
@@ -563,16 +564,18 @@ module Rollbar
563
564
 
564
565
  exception_info = exception.class.name
565
566
  # #to_s and #message defaults to class.to_s. Add message only if add valuable info.
566
- exception_info += %Q{: "#{exception.message}"} if exception.message != exception.class.to_s
567
+ exception_info += %(: "#{exception.message}") if exception.message != exception.class.to_s
567
568
  exception_info += " in #{nearest_frame}" if nearest_frame
568
569
 
569
570
  body += "#{exception_info}: #{message}"
570
571
  rescue
572
+ log_error('[Rollbar] Error building failsafe exception message')
571
573
  end
572
574
  else
573
575
  begin
574
576
  body += message.to_s
575
577
  rescue
578
+ log_error('[Rollbar] Error building failsafe message')
576
579
  end
577
580
  end
578
581
 
@@ -604,7 +607,7 @@ module Rollbar
604
607
  def process_async_item(item)
605
608
  configuration.async_handler ||= default_async_handler
606
609
  configuration.async_handler.call(item.payload)
607
- rescue => e
610
+ rescue
608
611
  if configuration.failover_handlers.empty?
609
612
  log_error '[Rollbar] Async handler failed, and there are no failover handlers configured. See the docs for "failover_handlers"'
610
613
  return
@@ -1,5 +1,8 @@
1
1
  require 'rollbar'
2
- require 'rack/mock'
2
+ begin
3
+ require 'rack/mock'
4
+ rescue LoadError
5
+ end
3
6
  require 'logger'
4
7
 
5
8
  namespace :rollbar do
@@ -39,60 +42,52 @@ namespace :rollbar do
39
42
  end
40
43
  end
41
44
 
42
- if defined?(Rails)
43
- begin
44
- require './app/controllers/application_controller'
45
- rescue LoadError
46
- end
47
-
48
- unless defined?(ApplicationController)
49
- puts 'No ApplicationController found, using ActionController::Base instead'
50
- class ApplicationController < ActionController::Base; end
51
- end
45
+ if defined?(Rack::MockRequest)
46
+ if defined?(Rails)
47
+ puts 'Setting up the controller.'
52
48
 
53
- puts 'Setting up the controller.'
49
+ class RollbarTestController < ActionController::Base
50
+ include RollbarTest
54
51
 
55
- class RollbarTestController < ApplicationController
56
- include RollbarTest
52
+ def verify
53
+ test_rollbar
54
+ end
57
55
 
58
- def verify
59
- test_rollbar
56
+ def logger
57
+ nil
58
+ end
60
59
  end
61
60
 
62
- def logger
63
- nil
61
+ Rails.application.routes_reloader.execute_if_updated
62
+ Rails.application.routes.draw do
63
+ get 'verify' => 'rollbar_test#verify', :as => 'verify'
64
64
  end
65
- end
66
65
 
67
- Rails.application.routes_reloader.execute_if_updated
68
- Rails.application.routes.draw do
69
- get 'verify' => 'rollbar_test#verify', :as => 'verify'
70
- end
71
-
72
- # from http://stackoverflow.com/questions/5270835/authlogic-activation-problems
73
- if defined? Authlogic
74
- Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
75
- end
66
+ # from http://stackoverflow.com/questions/5270835/authlogic-activation-problems
67
+ if defined? Authlogic
68
+ Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
69
+ end
76
70
 
77
- protocol = (defined? Rails.application.config.force_ssl && Rails.application.config.force_ssl) ? 'https' : 'http'
78
- app = Rails.application
79
- else
80
- protocol = 'http'
81
- app = Class.new do
82
- include RollbarTest
71
+ protocol = (defined? Rails.application.config.force_ssl && Rails.application.config.force_ssl) ? 'https' : 'http'
72
+ app = Rails.application
73
+ else
74
+ protocol = 'http'
75
+ app = Class.new do
76
+ include RollbarTest
83
77
 
84
- def self.call(_env)
85
- new.test_rollbar
78
+ def self.call(_env)
79
+ new.test_rollbar
80
+ end
86
81
  end
87
82
  end
88
- end
89
83
 
90
- puts 'Processing...'
91
- env = Rack::MockRequest.env_for("#{protocol}://www.example.com/verify")
92
- status, = app.call(env)
84
+ puts 'Processing...'
85
+ env = Rack::MockRequest.env_for("#{protocol}://www.example.com/verify")
86
+ status, = app.call(env)
93
87
 
94
- unless status.to_i == 500
95
- puts 'Test failed! You may have a configuration issue, or you could be using a gem that\'s blocking the test. Contact support@rollbar.com if you need help troubleshooting.'
88
+ unless status.to_i == 500
89
+ puts 'Test failed! You may have a configuration issue, or you could be using a gem that\'s blocking the test. Contact support@rollbar.com if you need help troubleshooting.'
90
+ end
96
91
  end
97
92
  end
98
93
  end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '2.13.0'.freeze
2
+ VERSION = '2.13.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json