rollbar 2.26.0 → 2.26.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
  SHA256:
3
- metadata.gz: 69307fc6496e1b12a3ebbe3e40b7341f725a7f4efadd6a1a5e76d7246bc86928
4
- data.tar.gz: 117fb5d03ab1f140f9469558c6560963180806935d3d56eeeb35da9cf450edc6
3
+ metadata.gz: cd45e6b870eee21793378f297cf881406be39872d66be7cf69327aa7bc06a027
4
+ data.tar.gz: d575825e0dc9715370e04b4a667d94eec34a089dedbbd4c0ef92df991ac9ecbf
5
5
  SHA512:
6
- metadata.gz: 61587004c5ba54fffb2bd34d9f4abdfd182a82002ebcbe688c8c500975797f43f2caac63ce3ca510276828e1b2132cda95027b42ea02533221a18a008d8d654b
7
- data.tar.gz: 9b62efc68f689811910cb92ae3262447c41732eaa6ebdc14019b7fd96114fcfebddf921e29699480e1fa7a21d54281e9130e99a3c85f8104f2d4440fd22f840d
6
+ metadata.gz: 51ebdecd60cef3c8cb540ed24179b00840f296a137fad69f68c19b7ddff65e987129b4e7ef6fa138bd5e6b5e823f4a9e9a3aef471524797efe8a6ff9b41efd34
7
+ data.tar.gz: 17de152e3dadb969fae494fae14d00903bc7e31781d1d0bbe3d6410b8623e96b7f58b52b9cb9bcab03d517ad894acd1d908a23ffe722b4bd748f93450a7b0abf
@@ -35,7 +35,7 @@ module Rollbar
35
35
  _cset(:rollbar_user) { ENV['USER'] || ENV['USERNAME'] }
36
36
  _cset(:rollbar_env) { fetch(:rails_env, 'production') }
37
37
  _cset(:rollbar_token) { abort("Please specify the Rollbar access token, set :rollbar_token, 'your token'") }
38
- _cset(:rollbar_revision) { current_revision }
38
+ _cset(:rollbar_revision) { real_revision }
39
39
  _cset(:rollbar_comment) { nil }
40
40
  end
41
41
  end
@@ -40,6 +40,9 @@ module Rollbar
40
40
  capistrano_300_warning(logger)
41
41
  logger.info opts[:desc] if opts[:desc]
42
42
  yield
43
+
44
+ rescue StandardError => e
45
+ logger.error "Error reporting to Rollbar: #{e.inspect}"
43
46
  end
44
47
 
45
48
  def deploy_update(capistrano, logger, dry_run, opts = {})
@@ -61,7 +64,11 @@ module Rollbar
61
64
  end
62
65
 
63
66
  def capistrano_300_warning(logger)
64
- logger.warn("You need to upgrade capistrano to '>= 3.1' version in order to correctly report deploys to Rollbar. (On 3.0, the reported revision will be incorrect.)") if ::Capistrano::VERSION =~ /^3\.0/
67
+ return unless ::Capistrano.const_defined?('VERSION') && ::Capistrano::VERSION =~ /^3\.0/
68
+
69
+ logger.warn('You need to upgrade capistrano to >= 3.1 version in order'\
70
+ 'to correctly report deploys to Rollbar. (On 3.0, the reported revision'\
71
+ 'will be incorrect.)')
65
72
  end
66
73
 
67
74
  def report_deploy_started(capistrano, dry_run)
@@ -83,6 +90,7 @@ module Rollbar
83
90
  def report_deploy_succeeded(capistrano, dry_run)
84
91
  ::Rollbar::Deploy.update(
85
92
  {
93
+ :comment => capistrano.fetch(:rollbar_comment),
86
94
  :proxy => :ENV,
87
95
  :dry_run => dry_run
88
96
  },
@@ -95,6 +103,7 @@ module Rollbar
95
103
  def report_deploy_failed(capistrano, dry_run)
96
104
  ::Rollbar::Deploy.update(
97
105
  {
106
+ :comment => capistrano.fetch(:rollbar_comment),
98
107
  :proxy => :ENV,
99
108
  :dry_run => dry_run
100
109
  },
@@ -1,6 +1,6 @@
1
1
 
2
2
  namespace :rollbar do
3
- desc 'Verify your gem installation by sending a test exception to Rollbar'
3
+ desc 'Verify your gem installation by sending a test message to Rollbar'
4
4
  task :test => [:environment] do
5
5
  rollbar_dir = Gem.loaded_specs['rollbar'].full_gem_path
6
6
  require "#{rollbar_dir}/lib/rollbar/rollbar_test"
@@ -131,6 +131,7 @@ module Rollbar
131
131
  host = host.split(',').first.strip unless host.empty?
132
132
 
133
133
  path = env['ORIGINAL_FULLPATH'] || env['REQUEST_URI']
134
+ path ||= "#{env['SCRIPT_NAME']}#{env['PATH_INFO']}#{"?#{env['QUERY_STRING']}" unless env['QUERY_STRING'].to_s.empty?}"
134
135
  unless path.nil? || path.empty?
135
136
  path = '/' + path.to_s if path.to_s.slice(0, 1) != '/'
136
137
  end
@@ -1,48 +1,16 @@
1
1
  require 'rollbar'
2
- begin
3
- require 'rack/mock'
4
- rescue LoadError
5
- puts 'Cannot load rack/mock'
6
- end
7
- require 'logger'
8
2
 
9
- # Module to inject into the Rails controllers or rack apps
10
3
  module RollbarTest # :nodoc:
11
- def test_rollbar
12
- puts 'Raising RollbarTestingException to simulate app failure.'
13
-
14
- raise RollbarTestingException.new, ::RollbarTest.success_message
15
- end
16
-
17
4
  def self.run
18
5
  return unless confirmed_token?
19
6
 
20
- configure_rails if defined?(Rails)
21
-
22
- puts 'Testing manual report...'
23
- Rollbar.error('Test error from rollbar:test')
24
-
25
- return unless defined?(Rack::MockRequest)
26
-
27
- protocol, app = setup_app
28
-
29
- puts 'Processing...'
30
- env = Rack::MockRequest.env_for("#{protocol}://www.example.com/verify", 'REMOTE_ADDR' => '127.0.0.1')
31
- status, = app.call(env)
32
-
33
- puts error_message unless status.to_i == 500
34
- end
35
-
36
- def self.configure_rails
37
- Rails.logger = if defined?(ActiveSupport::TaggedLogging)
38
- ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
39
- else
40
- Logger.new(STDOUT)
41
- end
7
+ puts 'Test sending to Rollbar...'
8
+ result = Rollbar.info('Test message from rollbar:test')
42
9
 
43
- Rails.logger.level = Logger::DEBUG
44
- Rollbar.preconfigure do |config|
45
- config.logger = Rails.logger
10
+ if result == 'error'
11
+ puts error_message
12
+ else
13
+ puts success_message
46
14
  end
47
15
  end
48
16
 
@@ -54,69 +22,6 @@ module RollbarTest # :nodoc:
54
22
  false
55
23
  end
56
24
 
57
- def self.authlogic_config
58
- # from http://stackoverflow.com/questions/5270835/authlogic-activation-problems
59
- return unless defined?(Authlogic)
60
-
61
- Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
62
- end
63
-
64
- def self.setup_app
65
- puts 'Setting up the test app.'
66
-
67
- if defined?(Rails)
68
- app = rails_app
69
-
70
- draw_rails_route(app)
71
-
72
- authlogic_config
73
-
74
- [rails_protocol(app), app]
75
- else
76
- ['http', rack_app]
77
- end
78
- end
79
-
80
- def self.rails_app
81
- # The setup below is needed for Rails 5.x, but not for Rails 4.x and below.
82
- # (And fails on Rails 4.x in various ways depending on the exact version.)
83
- return Rails.application if Rails.version < '5.0.0'
84
-
85
- # Spring now runs by default in development on all new Rails installs. This causes
86
- # the new `/verify` route to not get picked up if `config.cache_classes == false`
87
- # which is also a default in development env.
88
- #
89
- # `config.cache_classes` needs to be set, but the only possible time is at app load,
90
- # so here we clone the default app with an updated config.
91
- #
92
- config = Rails.application.config
93
- config.cache_classes = true
94
-
95
- # Make a copy of the app, so the config can be updated.
96
- Rails.application.class.name.constantize.new(:config => config)
97
- end
98
-
99
- def self.draw_rails_route(app)
100
- app.routes_reloader.execute_if_updated
101
- app.routes.draw do
102
- get 'verify' => 'rollbar_test#verify', :as => 'verify'
103
- end
104
- end
105
-
106
- def self.rails_protocol(app)
107
- defined?(app.config.force_ssl && app.config.force_ssl) ? 'https' : 'http'
108
- end
109
-
110
- def self.rack_app
111
- Class.new do
112
- include RollbarTest
113
-
114
- def self.call(_env)
115
- new.test_rollbar
116
- end
117
- end
118
- end
119
-
120
25
  def self.token_error_message
121
26
  'Rollbar needs an access token configured. Check the README for instructions.'
122
27
  end
@@ -129,19 +34,3 @@ module RollbarTest # :nodoc:
129
34
  'Testing rollbar with "rake rollbar:test". If you can see this, it works.'
130
35
  end
131
36
  end
132
-
133
- class RollbarTestingException < RuntimeError; end
134
-
135
- if defined?(Rails)
136
- class RollbarTestController < ActionController::Base # :nodoc:
137
- include RollbarTest
138
-
139
- def verify
140
- test_rollbar
141
- end
142
-
143
- def logger
144
- nil
145
- end
146
- end
147
- end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '2.26.0'.freeze
2
+ VERSION = '2.26.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.26.0
4
+ version: 2.26.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: 2020-06-22 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easy and powerful exception tracking for Ruby
14
14
  email: