rollbar 3.0.0 → 3.2.0

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.
@@ -2,18 +2,12 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
9
+ gem 'net-ssh', '<= 3.1.1'
10
+ gem 'public_suffix', '<= 3.1.1'
17
11
  gem 'rails', '~> 5.0.7'
18
12
  gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
19
13
 
@@ -31,13 +25,13 @@ platforms :rbx do
31
25
  gem 'minitest'
32
26
  gem 'racc'
33
27
  gem 'rubinius-developer_tools'
34
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
28
+ gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2') # rubysl doesn't yet support Ruby 3.x
35
29
  end
36
30
 
37
31
  gem 'capistrano', :require => false
38
32
  gem 'sucker_punch', '~> 2.0'
39
33
  gem 'codacy-coverage'
40
- gem 'simplecov'
34
+ gem 'simplecov', '<= 0.17.1'
41
35
 
42
36
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
43
37
  gem 'rack', '2.1.2'
@@ -45,12 +39,13 @@ end
45
39
 
46
40
  # We need last sinatra that uses rack 2.1.x
47
41
  gem 'sinatra', :git => 'https://github.com/sinatra/sinatra', :tag => 'v2.0.8'
48
- gem 'database_cleaner'
42
+ gem 'database_cleaner', '~> 1.8.4'
49
43
  gem 'delayed_job', :require => false
50
44
  gem 'generator_spec'
51
45
  gem 'girl_friday', '>= 0.11.1'
52
- gem 'redis'
46
+ gem 'redis', '<= 3.3.5'
53
47
  gem 'resque'
48
+ gem 'secure_headers', '~> 6.3.2', :require => false
54
49
 
55
50
  unless is_jruby
56
51
  # JRuby doesn't support fork, which is required for this test helper.
@@ -2,18 +2,12 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
9
+ gem 'net-ssh', '<= 3.1.1'
10
+ gem 'public_suffix', '<= 3.1.1'
17
11
  gem 'rails', '~> 5.1.7'
18
12
  gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
19
13
 
@@ -31,13 +25,13 @@ platforms :rbx do
31
25
  gem 'minitest'
32
26
  gem 'racc'
33
27
  gem 'rubinius-developer_tools'
34
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
28
+ gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2') # rubysl doesn't yet support Ruby 3.x
35
29
  end
36
30
 
37
31
  gem 'capistrano', :require => false
38
32
  gem 'sucker_punch', '~> 2.0'
39
33
  gem 'codacy-coverage'
40
- gem 'simplecov'
34
+ gem 'simplecov', '<= 0.17.1'
41
35
 
42
36
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
43
37
  gem 'rack', '2.1.2'
@@ -46,12 +40,13 @@ end
46
40
  # We need last sinatra that uses rack 2.1.x
47
41
  gem 'sinatra', :git => 'https://github.com/sinatra/sinatra', :tag => 'v2.0.8'
48
42
 
49
- gem 'database_cleaner'
43
+ gem 'database_cleaner', '~> 1.8.4'
50
44
  gem 'delayed_job', :require => false
51
45
  gem 'generator_spec'
52
46
  gem 'girl_friday', '>= 0.11.1'
53
- gem 'redis'
47
+ gem 'redis', '<= 3.3.5'
54
48
  gem 'resque'
49
+ gem 'secure_headers', '~> 6.3.2', :require => false
55
50
 
56
51
  unless is_jruby
57
52
  # JRuby doesn't support fork, which is required for this test helper.
@@ -2,16 +2,8 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
17
9
  gem 'rails', '~> 5.2.3'
@@ -31,7 +23,7 @@ platforms :rbx do
31
23
  gem 'minitest'
32
24
  gem 'racc'
33
25
  gem 'rubinius-developer_tools'
34
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
26
+ gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2') # rubysl doesn't yet support Ruby 3.x
35
27
  end
36
28
 
37
29
  gem 'sucker_punch', '~> 2.0'
@@ -46,7 +38,8 @@ gem 'generator_spec'
46
38
  gem 'girl_friday', '>= 0.11.1'
47
39
  gem 'redis'
48
40
  gem 'resque'
49
- gem 'simplecov'
41
+ gem 'secure_headers', '~> 6.3.2', :require => false
42
+ gem 'simplecov', '<= 0.17.1'
50
43
 
51
44
  unless is_jruby
52
45
  # JRuby doesn't support fork, which is required for this test helper.
@@ -3,27 +3,14 @@ require 'rubygems/version'
3
3
 
4
4
  source 'https://rubygems.org'
5
5
 
6
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
7
- # new process is created during tests. (Testing rake tasks, for example.)
8
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
9
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
10
- # with the wrong gemfile path.
11
- ENV['CURRENT_GEMFILE'] ||= __FILE__
12
-
13
6
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
14
7
 
15
- gem 'appraisal'
16
8
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
17
9
  gem 'jruby-openssl', :platform => :jruby
18
- gem 'rails', '6.0.2.1'
10
+ gem 'rails', '~> 6.0.2'
19
11
  gem 'sqlite3', '~> 1.4', :platform => [:ruby, :mswin, :mingw]
20
12
 
21
- gem 'rspec-core', '~> 3.8.0'
22
- gem 'rspec-support', '~> 3.8.0'
23
- gem 'rspec-expectations', '~> 3.8.0'
24
- gem 'rspec-mocks', '~> 3.8.0'
25
- # TODO: update this when 4.x becomes available on Rubygems
26
- gem 'rspec-rails', :git => 'https://github.com/rspec/rspec-rails', :ref => 'v4.0.0.beta2' # rubocop:disable Bundler/DuplicatedGem
13
+ gem 'rspec-rails', '~> 4.0.2'
27
14
 
28
15
  gem 'rake'
29
16
 
@@ -33,7 +20,7 @@ platforms :rbx do
33
20
  gem 'minitest'
34
21
  gem 'racc'
35
22
  gem 'rubinius-developer_tools'
36
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
23
+ gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2') # rubysl doesn't yet support Ruby 3.x
37
24
  end
38
25
 
39
26
  gem 'sucker_punch', '~> 2.0'
@@ -43,11 +30,12 @@ gem 'sinatra', :git => 'https://github.com/sinatra/sinatra'
43
30
 
44
31
  gem 'database_cleaner'
45
32
  gem 'codacy-coverage'
46
- gem 'delayed_job', '4.1.8.beta1', :require => false
33
+ gem 'delayed_job', '4.1.9', :require => false
47
34
  gem 'generator_spec'
48
35
  gem 'girl_friday', '>= 0.11.1'
49
36
  gem 'redis'
50
37
  gem 'resque'
38
+ gem 'secure_headers', '~> 6.3.2', :require => false
51
39
  gem 'simplecov'
52
40
 
53
41
  unless is_jruby
@@ -0,0 +1,54 @@
1
+ require 'rubygems/version'
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
+
7
+ gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
8
+ gem 'jruby-openssl', :platform => :jruby
9
+ gem 'rails', '~> 6.1.3'
10
+ gem 'sqlite3', '~> 1.4', :platform => [:ruby, :mswin, :mingw]
11
+
12
+ gem 'rspec-rails', '~> 4.0.2'
13
+
14
+ gem 'rake'
15
+
16
+ gem 'sidekiq', '>= 2.13.0'
17
+
18
+ platforms :rbx do
19
+ gem 'minitest'
20
+ gem 'racc'
21
+ gem 'rubinius-developer_tools'
22
+ gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2') # rubysl doesn't yet support Ruby 3.x
23
+ end
24
+
25
+ gem 'sucker_punch', '~> 2.0'
26
+
27
+ # We need last sinatra that uses rack 2.x
28
+ gem 'sinatra', :git => 'https://github.com/sinatra/sinatra'
29
+
30
+ gem 'database_cleaner'
31
+ gem 'codacy-coverage'
32
+ gem 'delayed_job', '4.1.9', :require => false
33
+ gem 'generator_spec'
34
+ gem 'girl_friday', '>= 0.11.1'
35
+ gem 'redis'
36
+ gem 'resque'
37
+ gem 'secure_headers', '~> 6.3.2', :require => false
38
+ gem 'simplecov'
39
+
40
+ unless is_jruby
41
+ # JRuby doesn't support fork, which is required for this test helper.
42
+ gem 'rspec-command'
43
+ end
44
+
45
+ gem 'mime-types'
46
+
47
+ gem 'webmock', :require => false
48
+
49
+ gem 'aws-sdk-sqs'
50
+ gem 'shoryuken'
51
+
52
+ gem 'capistrano', :require => false
53
+
54
+ gemspec :path => '../'
@@ -16,7 +16,9 @@ module Rollbar
16
16
  if result[:success] && (deploy_id = result[:data] && result[:data][:deploy_id])
17
17
  capistrano.set :rollbar_deploy_id, deploy_id
18
18
  else
19
- logger.error 'Unable to report deploy to Rollbar' + (result[:message] ? ': ' + result[:message] : '')
19
+ message = format_message('Unable to report deploy to Rollbar',
20
+ result[:message])
21
+ log_error(logger, message)
20
22
  end
21
23
  end
22
24
  end
@@ -42,7 +44,7 @@ module Rollbar
42
44
  yield
43
45
 
44
46
  rescue StandardError => e
45
- logger.error "Error reporting to Rollbar: #{e.inspect}"
47
+ log_error logger, "Error reporting to Rollbar: #{e.inspect}"
46
48
  end
47
49
 
48
50
  def deploy_update(capistrano, logger, dry_run, opts = {})
@@ -56,7 +58,9 @@ module Rollbar
56
58
  if result[:success]
57
59
  logger.info 'Updated deploy status in Rollbar'
58
60
  else
59
- logger.error 'Unable to update deploy status in Rollbar' + (result[:message] ? ': ' + result[:message] : '')
61
+ message = format_message('Unable to update deploy status in Rollbar',
62
+ result[:message])
63
+ log_error(logger, message)
60
64
  end
61
65
  end
62
66
  end
@@ -117,7 +121,7 @@ module Rollbar
117
121
  if capistrano.fetch(:rollbar_deploy_id)
118
122
  yield
119
123
  else
120
- logger.error 'Failed to update the deploy in Rollbar. No deploy id available.'
124
+ log_error logger, 'Failed to update the deploy in Rollbar. No deploy id available.'
121
125
  end
122
126
  end
123
127
 
@@ -134,6 +138,20 @@ module Rollbar
134
138
  logger.debug result[:request_info]
135
139
  logger.debug result[:response_info] if result[:response_info]
136
140
  end
141
+
142
+ def format_message(*args)
143
+ args.compact.join(': ')
144
+ end
145
+
146
+ def log_error(logger, message)
147
+ # Capistrano 2.x doesn't have the #error method,
148
+ # so we use #important if #error isn't present
149
+ if logger.respond_to?(:error)
150
+ logger.error message
151
+ elsif logger.respond_to?(:important)
152
+ logger.important message
153
+ end
154
+ end
137
155
  end
138
156
  end
139
157
  end
@@ -55,6 +55,7 @@ module Rollbar
55
55
  attr_accessor :uncaught_exception_level
56
56
  attr_accessor :scrub_headers
57
57
  attr_accessor :sidekiq_threshold
58
+ attr_accessor :sidekiq_use_scoped_block
58
59
  attr_reader :transform
59
60
  attr_accessor :verify_ssl_peer
60
61
  attr_accessor :use_async
@@ -75,6 +76,7 @@ module Rollbar
75
76
  attr_accessor :files_processed_enabled
76
77
  attr_accessor :files_processed_duration # seconds
77
78
  attr_accessor :files_processed_size # bytes
79
+ attr_accessor :use_payload_access_token
78
80
 
79
81
  attr_reader :project_gem_paths
80
82
  attr_accessor :configured_options
@@ -85,8 +87,10 @@ module Rollbar
85
87
  DEFAULT_WEB_BASE = 'https://rollbar.com'.freeze
86
88
 
87
89
  def initialize
90
+ @access_token = nil
88
91
  @async_handler = nil
89
92
  @before_process = []
93
+ @branch = nil
90
94
  @capture_uncaught = nil
91
95
  @code_version = nil
92
96
  @custom_data_method = nil
@@ -110,6 +114,7 @@ module Rollbar
110
114
  @failover_handlers = []
111
115
  @framework = 'Plain'
112
116
  @ignored_person_ids = []
117
+ @host = nil
113
118
  @payload_options = {}
114
119
  @person_method = 'current_user'
115
120
  @person_id_method = 'id'
@@ -121,6 +126,7 @@ module Rollbar
121
126
  @open_timeout = 3
122
127
  @request_timeout = 3
123
128
  @net_retries = 3
129
+ @root = nil
124
130
  @js_enabled = false
125
131
  @js_options = {}
126
132
  @locals = {}
@@ -134,6 +140,7 @@ module Rollbar
134
140
  @uncaught_exception_level = 'error'
135
141
  @scrub_headers = ['Authorization']
136
142
  @sidekiq_threshold = 0
143
+ @sidekiq_use_scoped_block = false
137
144
  @safely = false
138
145
  @transform = []
139
146
  @use_async = false
@@ -150,6 +157,7 @@ module Rollbar
150
157
  @log_payload = false
151
158
  @collect_user_ip = true
152
159
  @anonymize_user_ip = false
160
+ @user_ip_obfuscator_secret = nil
153
161
  @backtrace_cleaner = nil
154
162
  @hooks = {
155
163
  :on_error_response => nil, # params: response
@@ -157,10 +165,12 @@ module Rollbar
157
165
  }
158
166
 
159
167
  @write_to_file = false
168
+ @filepath = nil
160
169
  @files_with_pid_name_enabled = false
161
170
  @files_processed_enabled = false
162
171
  @files_processed_duration = 60
163
172
  @files_processed_size = 5 * 1000 * 1000
173
+ @use_payload_access_token = false
164
174
 
165
175
  @configured_options = ConfiguredOptions.new(self)
166
176
  end
data/lib/rollbar/item.rb CHANGED
@@ -40,7 +40,7 @@ module Rollbar
40
40
  class << self
41
41
  def build_with(payload, options = {})
42
42
  new(options).tap do |item|
43
- item.payload = payload
43
+ item.payload = item.add_access_token_to_payload(payload)
44
44
  end
45
45
  end
46
46
  end
@@ -64,9 +64,7 @@ module Rollbar
64
64
 
65
65
  def build
66
66
  data = build_data
67
- self.payload = {
68
- 'data' => data
69
- }
67
+ self.payload = add_access_token_to_payload({'data' => data})
70
68
 
71
69
  enforce_valid_utf8
72
70
  transform
@@ -166,6 +164,21 @@ module Rollbar
166
164
  configuration.ignored_person_ids.include?(person_id)
167
165
  end
168
166
 
167
+ def add_access_token_to_payload(payload)
168
+ # Some use cases remain where the token is needed in the payload. For example:
169
+ #
170
+ # When using async senders, if the access token is changed dynamically in
171
+ # the main process config, the sender process won't see that change.
172
+ #
173
+ # Until the delayed sender interface is changed to allow passing dynamic config options,
174
+ # this workaround allows the main process to set the token by adding it to the payload.
175
+ if (configuration && configuration.use_payload_access_token)
176
+ payload['access_token'] ||= configuration.access_token
177
+ end
178
+
179
+ payload
180
+ end
181
+
169
182
  private
170
183
 
171
184
  def build_environment
@@ -1,4 +1,3 @@
1
- require 'rollbar/notifier'
2
1
  require 'rollbar/scrubbers/params'
3
2
  require 'rollbar/util'
4
3
 
@@ -41,8 +41,6 @@ module Rollbar
41
41
  raw[key] = value
42
42
 
43
43
  loaded_data.delete(key)
44
-
45
- value
46
44
  end
47
45
 
48
46
  def data
@@ -76,8 +74,8 @@ module Rollbar
76
74
  super
77
75
  end
78
76
 
79
- def respond_to?(method_sym)
80
- super || raw.respond_to?(method_sym)
77
+ def respond_to_missing?(method_sym, include_all)
78
+ raw.respond_to?(method_sym, include_all)
81
79
  end
82
80
  end
83
81
  end