rollbar 2.18.2 → 2.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -0
  3. data/.travis.yml +155 -93
  4. data/Gemfile +19 -13
  5. data/README.md +12 -0
  6. data/gemfiles/rails30.gemfile +17 -10
  7. data/gemfiles/rails31.gemfile +20 -12
  8. data/gemfiles/rails32.gemfile +16 -7
  9. data/gemfiles/rails40.gemfile +16 -5
  10. data/gemfiles/rails41.gemfile +15 -5
  11. data/gemfiles/rails42.gemfile +25 -14
  12. data/gemfiles/rails50.gemfile +15 -8
  13. data/gemfiles/rails51.gemfile +15 -8
  14. data/gemfiles/rails52.gemfile +62 -0
  15. data/gemfiles/ruby_1_8_and_1_9_2.gemfile +2 -2
  16. data/lib/rails/rollbar_runner.rb +16 -1
  17. data/lib/rollbar/capistrano.rb +71 -39
  18. data/lib/rollbar/capistrano3.rb +53 -1
  19. data/lib/rollbar/capistrano_tasks.rb +131 -0
  20. data/lib/rollbar/configuration.rb +13 -4
  21. data/lib/rollbar/delay/active_job.rb +17 -0
  22. data/lib/rollbar/delay/sidekiq.rb +3 -1
  23. data/lib/rollbar/delay/thread.rb +1 -1
  24. data/lib/rollbar/deploy.rb +69 -0
  25. data/lib/rollbar/item.rb +17 -6
  26. data/lib/rollbar/middleware/js.rb +25 -3
  27. data/lib/rollbar/middleware/js/json_value.rb +26 -0
  28. data/lib/rollbar/notifier.rb +32 -13
  29. data/lib/rollbar/plugins/active_job.rb +3 -0
  30. data/lib/rollbar/plugins/rails/controller_methods.rb +2 -1
  31. data/lib/rollbar/plugins/rails/railtie_mixin.rb +7 -1
  32. data/lib/rollbar/rake_tasks.rb +126 -67
  33. data/lib/rollbar/scrubbers/params.rb +6 -0
  34. data/lib/rollbar/util.rb +75 -45
  35. data/lib/rollbar/util/hash.rb +15 -6
  36. data/lib/rollbar/version.rb +1 -1
  37. data/rollbar.gemspec +2 -3
  38. metadata +9 -261
  39. data/lib/rollbar/tasks/rollbar.cap +0 -47
  40. data/spec/cacert.pem +0 -3988
  41. data/spec/controllers/home_controller_spec.rb +0 -480
  42. data/spec/delay/sidekiq_spec.rb +0 -61
  43. data/spec/delay/sucker_punch_spec.rb +0 -25
  44. data/spec/delayed/backend/test.rb +0 -140
  45. data/spec/delayed/serialization/test.rb +0 -0
  46. data/spec/dummyapp/.gitignore +0 -73
  47. data/spec/dummyapp/Rakefile +0 -7
  48. data/spec/dummyapp/app/assets/javascripts/application.js +0 -3
  49. data/spec/dummyapp/app/assets/stylesheets/application.css.scss +0 -37
  50. data/spec/dummyapp/app/controllers/application_controller.rb +0 -3
  51. data/spec/dummyapp/app/controllers/home_controller.rb +0 -60
  52. data/spec/dummyapp/app/controllers/users_controller.rb +0 -17
  53. data/spec/dummyapp/app/helpers/.gitkeep +0 -0
  54. data/spec/dummyapp/app/mailers/.gitkeep +0 -0
  55. data/spec/dummyapp/app/models/.gitkeep +0 -0
  56. data/spec/dummyapp/app/models/book.rb +0 -5
  57. data/spec/dummyapp/app/models/post.rb +0 -9
  58. data/spec/dummyapp/app/models/user.rb +0 -9
  59. data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +0 -27
  60. data/spec/dummyapp/app/views/devise/registrations/new.html.erb +0 -20
  61. data/spec/dummyapp/app/views/devise/shared/_links.html.erb +0 -25
  62. data/spec/dummyapp/app/views/home/cause_exception.html.erb +0 -1
  63. data/spec/dummyapp/app/views/home/index.html.erb +0 -4
  64. data/spec/dummyapp/app/views/home/report_exception.html.erb +0 -1
  65. data/spec/dummyapp/app/views/js/test.html.erb +0 -1
  66. data/spec/dummyapp/app/views/layouts/_messages.html.erb +0 -5
  67. data/spec/dummyapp/app/views/layouts/_navigation.html.erb +0 -21
  68. data/spec/dummyapp/app/views/layouts/application.html.erb +0 -25
  69. data/spec/dummyapp/app/views/layouts/simple.html.erb +0 -18
  70. data/spec/dummyapp/app/views/users/index.html.erb +0 -8
  71. data/spec/dummyapp/app/views/users/show.html.erb +0 -3
  72. data/spec/dummyapp/config.ru +0 -4
  73. data/spec/dummyapp/config/application.rb +0 -59
  74. data/spec/dummyapp/config/boot.rb +0 -10
  75. data/spec/dummyapp/config/database.yml +0 -25
  76. data/spec/dummyapp/config/environment.rb +0 -5
  77. data/spec/dummyapp/config/environments/development.rb +0 -37
  78. data/spec/dummyapp/config/environments/production.rb +0 -67
  79. data/spec/dummyapp/config/environments/test.rb +0 -37
  80. data/spec/dummyapp/config/initializers/backtrace_silencers.rb +0 -7
  81. data/spec/dummyapp/config/initializers/inflections.rb +0 -15
  82. data/spec/dummyapp/config/initializers/mime_types.rb +0 -5
  83. data/spec/dummyapp/config/initializers/rollbar.rb +0 -26
  84. data/spec/dummyapp/config/initializers/secret_token.rb +0 -7
  85. data/spec/dummyapp/config/initializers/session_store.rb +0 -8
  86. data/spec/dummyapp/config/initializers/wrap_parameters.rb +0 -16
  87. data/spec/dummyapp/config/locales/devise.en.yml +0 -58
  88. data/spec/dummyapp/config/locales/en.yml +0 -5
  89. data/spec/dummyapp/config/routes.rb +0 -17
  90. data/spec/dummyapp/config/secrets.yml +0 -2
  91. data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +0 -46
  92. data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +0 -5
  93. data/spec/dummyapp/db/migrate/20161219184410_create_books.rb +0 -10
  94. data/spec/dummyapp/db/migrate/20161219185529_add_username_to_users.rb +0 -5
  95. data/spec/dummyapp/db/schema.rb +0 -41
  96. data/spec/dummyapp/db/seeds.rb +0 -12
  97. data/spec/dummyapp/lib/assets/.gitkeep +0 -0
  98. data/spec/dummyapp/public/404.html +0 -26
  99. data/spec/dummyapp/public/422.html +0 -26
  100. data/spec/dummyapp/public/500.html +0 -25
  101. data/spec/dummyapp/public/favicon.ico +0 -0
  102. data/spec/dummyapp/script/rails +0 -6
  103. data/spec/fixtures/file1 +0 -1
  104. data/spec/fixtures/file2 +0 -1
  105. data/spec/fixtures/payloads/message.json +0 -25
  106. data/spec/fixtures/payloads/sample.trace.json +0 -275
  107. data/spec/fixtures/payloads/sample.trace_chain.json +0 -530
  108. data/spec/fixtures/plugins/dummy1.rb +0 -5
  109. data/spec/fixtures/plugins/dummy2.rb +0 -5
  110. data/spec/generators/rollbar/rollbar_generator_rails30_spec.rb +0 -31
  111. data/spec/generators/rollbar/rollbar_generator_spec.rb +0 -51
  112. data/spec/requests/home_spec.rb +0 -49
  113. data/spec/rollbar/configuration_spec.rb +0 -74
  114. data/spec/rollbar/delay/delayed_job_spec.rb +0 -22
  115. data/spec/rollbar/delay/girl_friday_spec.rb +0 -41
  116. data/spec/rollbar/delay/resque_spec.rb +0 -37
  117. data/spec/rollbar/delay/shoryuken_spec.rb +0 -44
  118. data/spec/rollbar/delay/thread_spec.rb +0 -27
  119. data/spec/rollbar/encoding/encoder_spec.rb +0 -63
  120. data/spec/rollbar/item/backtrace_spec.rb +0 -26
  121. data/spec/rollbar/item/frame_spec.rb +0 -267
  122. data/spec/rollbar/item_spec.rb +0 -736
  123. data/spec/rollbar/json/oj_spec.rb +0 -18
  124. data/spec/rollbar/json_spec.rb +0 -110
  125. data/spec/rollbar/lazy_store_spec.rb +0 -99
  126. data/spec/rollbar/logger_proxy_spec.rb +0 -69
  127. data/spec/rollbar/logger_spec.rb +0 -124
  128. data/spec/rollbar/middleware/js_spec.rb +0 -428
  129. data/spec/rollbar/middleware/sinatra_spec.rb +0 -197
  130. data/spec/rollbar/notifier_spec.rb +0 -67
  131. data/spec/rollbar/plugin_spec.rb +0 -209
  132. data/spec/rollbar/plugins/active_job_spec.rb +0 -45
  133. data/spec/rollbar/plugins/delayed_job/job_data_spec.rb +0 -48
  134. data/spec/rollbar/plugins/delayed_job_spec.rb +0 -129
  135. data/spec/rollbar/plugins/rack_spec.rb +0 -152
  136. data/spec/rollbar/plugins/rails_js_spec.rb +0 -19
  137. data/spec/rollbar/plugins/rake_spec.rb +0 -34
  138. data/spec/rollbar/plugins/resque/failure_spec.rb +0 -36
  139. data/spec/rollbar/plugins/sidekiq_spec.rb +0 -169
  140. data/spec/rollbar/plugins/validations_spec.rb +0 -56
  141. data/spec/rollbar/plugins_spec.rb +0 -68
  142. data/spec/rollbar/request_data_extractor_spec.rb +0 -321
  143. data/spec/rollbar/scrubbers/params_spec.rb +0 -598
  144. data/spec/rollbar/scrubbers/url_spec.rb +0 -240
  145. data/spec/rollbar/scrubbers_spec.rb +0 -31
  146. data/spec/rollbar/sidekig/clear_scope_spec.rb +0 -19
  147. data/spec/rollbar/truncation/frames_strategy_spec.rb +0 -70
  148. data/spec/rollbar/truncation/min_body_strategy_spec.rb +0 -57
  149. data/spec/rollbar/truncation/strings_strategy_spec.rb +0 -89
  150. data/spec/rollbar/truncation_spec.rb +0 -27
  151. data/spec/rollbar/util/hash_spec.rb +0 -22
  152. data/spec/rollbar/util/ip_anonymizer_spec.rb +0 -30
  153. data/spec/rollbar/util_spec.rb +0 -80
  154. data/spec/rollbar_bc_spec.rb +0 -380
  155. data/spec/rollbar_spec.rb +0 -1737
  156. data/spec/spec_helper.rb +0 -84
  157. data/spec/support/cause_exception.rb +0 -1
  158. data/spec/support/encoding_helpers.rb +0 -8
  159. data/spec/support/encodings/iso_8859_9 +0 -1
  160. data/spec/support/fixture_helpers.rb +0 -10
  161. data/spec/support/get_ip_raising.rb +0 -7
  162. data/spec/support/helpers.rb +0 -5
  163. data/spec/support/matchers.rb +0 -23
  164. data/spec/support/notifier_helpers.rb +0 -57
  165. data/spec/support/rollbar_api.rb +0 -57
  166. data/spec/support/secure_headers_mocks.rb +0 -83
  167. data/spec/support/shared_contexts.rb +0 -12
@@ -1,84 +0,0 @@
1
- begin
2
- require 'simplecov'
3
- require 'codeclimate-test-reporter'
4
-
5
- SimpleCov.start do
6
- add_filter '/spec/'
7
-
8
- formatter SimpleCov::Formatter::MultiFormatter.new([
9
- SimpleCov::Formatter::HTMLFormatter,
10
- CodeClimate::TestReporter::Formatter
11
- ])
12
- end
13
- rescue LoadError
14
- end
15
-
16
- require 'rubygems'
17
-
18
- ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'test'
19
- require File.expand_path('../dummyapp/config/environment', __FILE__)
20
- require 'rspec/rails'
21
- require 'database_cleaner'
22
-
23
- begin
24
- require 'webmock/rspec'
25
- WebMock.disable_net_connect!(:allow => 'codeclimate.com')
26
- rescue LoadError
27
- end
28
-
29
- namespace :dummy do
30
- load 'spec/dummyapp/Rakefile'
31
- end
32
-
33
- if ENV['TRAVIS_JDK_VERSION'] == 'oraclejdk7'
34
- require 'rollbar/configuration'
35
- Rollbar::Configuration::DEFAULT_ENDPOINT = 'https://api-alt.rollbar.com/api/1/item/'
36
- end
37
-
38
- if Gem::Version.new(Rails.version) < Gem::Version.new('5.0')
39
- Rake::Task['dummy:db:setup'].invoke
40
- else
41
- Rake::Task['dummy:db:test:prepare'].invoke
42
- end
43
-
44
-
45
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
46
-
47
- RSpec.configure do |config|
48
- config.extend(Helpers)
49
- config.include(NotifierHelpers)
50
- config.include(FixtureHelpers)
51
- config.include(EncodingHelpers)
52
-
53
- config.color = true
54
- config.formatter = 'documentation'
55
-
56
- config.use_transactional_fixtures = true
57
- config.order = 'random'
58
- config.expect_with(:rspec) do |c|
59
- c.syntax = [:should, :expect]
60
- end
61
-
62
- config.mock_with :rspec do |mocks|
63
- mocks.syntax = [:should, :expect]
64
- end
65
-
66
- config.before(:suite) do
67
- DatabaseCleaner.strategy = :truncation
68
- end
69
-
70
- config.before(:each) do
71
- DatabaseCleaner.start
72
- DatabaseCleaner.clean
73
- Rollbar.clear_notifier!
74
-
75
- stub_request(:any, /api.rollbar.com/).to_rack(RollbarAPI.new) if defined?(WebMock)
76
- end
77
-
78
- config.after do
79
- DatabaseCleaner.clean
80
- end
81
-
82
- config.infer_spec_type_from_file_location! if config.respond_to?(:infer_spec_type_from_file_location!)
83
- config.backtrace_exclusion_patterns = [/gems\/rspec-.*/]
84
- end
@@ -1 +0,0 @@
1
- class CauseException < StandardError; end
@@ -1,8 +0,0 @@
1
- module EncodingHelpers
2
- def force_to_ascii(string)
3
- return string unless string.respond_to?('force_encoding')
4
-
5
- string.force_encoding('ASCII-8BIT')
6
- string
7
- end
8
- end
@@ -1 +0,0 @@
1
- ����������
@@ -1,10 +0,0 @@
1
- module FixtureHelpers
2
- def fixture_file(relative_path)
3
- root = File.expand_path('../../fixtures', __FILE__)
4
- File.join(root, relative_path)
5
- end
6
-
7
- def load_payload_fixture(relative_path)
8
- Rollbar::JSON.load(File.read(fixture_file(relative_path)))
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- class GetIpRaising
2
- class IpSpoofAttackError < StandardError; end
3
-
4
- def to_s
5
- raise IpSpoofAttackError, 'spoofing IP!'
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- module Helpers
2
- def local?
3
- ENV['LOCAL'] == '1'
4
- end
5
- end
@@ -1,23 +0,0 @@
1
- RSpec::Matchers.define :be_eql_hash_with_regexes do |expected|
2
- def check_value(actual_value, expected_value)
3
- if expected_value.is_a?(Hash)
4
- expected_value.all? { |k, _| check_value(actual_value[k], expected_value[k]) }
5
- elsif expected_value.is_a?(Array)
6
- expected_value.each_with_index.map do |v, i|
7
- check_value(actual_value[i], v)
8
- end.all?
9
- elsif expected_value.is_a?(Regexp)
10
- actual_value.match(expected_value)
11
- else
12
- actual_value == expected_value
13
- end
14
- end
15
-
16
- match do |actual|
17
- expected.all? do |key, expected_value|
18
- actual_value = actual[key]
19
-
20
- check_value(actual_value, expected_value)
21
- end
22
- end
23
- end
@@ -1,57 +0,0 @@
1
- module NotifierHelpers
2
- def reconfigure_notifier
3
- Rollbar.clear_notifier!
4
-
5
- Rollbar.reconfigure do |config|
6
- # special test access token
7
- config.access_token = test_access_token
8
- config.logger = ::Rails.logger
9
- config.root = ::Rails.root
10
- config.framework = "Rails: #{::Rails::VERSION::STRING}"
11
- config.open_timeout = 60
12
- config.request_timeout = 60
13
- end
14
- end
15
-
16
- def preconfigure_rails_notifier
17
- rails_logger = if defined?(::Rails.logger)
18
- ::Rails.logger
19
- elsif defined?(RAILS_DEFAULT_LOGGER)
20
- RAILS_DEFAULT_LOGGER
21
- end
22
-
23
- Rollbar.preconfigure do |config|
24
- config.logger = rails_logger
25
- config.environment = defined?(::Rails.env) && ::Rails.env || defined?(RAILS_ENV) && RAILS_ENV
26
- config.root = defined?(::Rails.root) && ::Rails.root || defined?(RAILS_ROOT) && RAILS_ROOT
27
- config.framework = defined?(::Rails.version) && "Rails: #{::Rails.version}" || defined?(::Rails::VERSION::STRING) && "Rails: #{::Rails::VERSION::STRING}"
28
- end
29
- end
30
-
31
- def test_access_token
32
- 'bfec94a1ede64984b862880224edd0ed'
33
- end
34
-
35
- def reset_configuration
36
- Rollbar.reconfigure do |config|
37
- end
38
- end
39
-
40
- def clear_proxy_env_vars
41
- env_vars = {}
42
- proxy_env_vars.each do |var|
43
- env_vars[var] = ENV.delete(var)
44
- end
45
- env_vars
46
- end
47
-
48
- def restore_proxy_env_vars(env_vars)
49
- proxy_env_vars.each do |var|
50
- ENV[var] = env_vars[var]
51
- end
52
- end
53
-
54
- def proxy_env_vars
55
- %w[http_proxy HTTP_PROXY https_proxy HTTPS_PROXY]
56
- end
57
- end
@@ -1,57 +0,0 @@
1
- require 'rack/request'
2
-
3
- class RollbarAPI
4
- def call(env)
5
- request = Rack::Request.new(env)
6
- json = JSON.parse(request.body.read)
7
-
8
- return bad_request(json) unless access_token?(json)
9
-
10
- success(json)
11
- end
12
-
13
- private
14
-
15
- def response_headers
16
- {
17
- 'Content-Type' => 'application/json'
18
- }
19
- end
20
-
21
- def access_token?(json)
22
-
23
- !!json['access_token']
24
- end
25
-
26
- def bad_request(json)
27
- # We don't have for now any test doing bad requests
28
- # so raise here in order to detect that scenario
29
- raise
30
-
31
-
32
- [400, response_headers, [bad_request_body]]
33
- end
34
-
35
- def success(json)
36
- [200, response_headers, [success_body(json)]]
37
- end
38
-
39
- def bad_request_body
40
- result(1, nil, 'bad request')
41
- end
42
-
43
- def success_body(json)
44
- result(0, {
45
- :id => rand(1_000_000),
46
- :uuid => json['data']['uuid']
47
- }, nil)
48
- end
49
-
50
- def result(err, body, message)
51
- {
52
- :err => err,
53
- :result => body,
54
- :message => message
55
- }.to_json
56
- end
57
- end
@@ -1,83 +0,0 @@
1
- module SecureHeadersMocks
2
- NONCE = 'lorem-ipsum-nonce'
3
-
4
- module CSP
5
- class << self
6
- attr_accessor :config
7
-
8
- def opt_out?
9
- config[:opt_out?]
10
- end
11
-
12
- def [](key)
13
- config[key]
14
- end
15
- end
16
- end
17
-
18
- module SecureHeaders20
19
- end
20
-
21
- module SecureHeaders30
22
- OPT_OUT = :opt_out
23
- class << self
24
- def content_security_policy_script_nonce(req)
25
- NONCE
26
- end
27
- end
28
-
29
- module Configuration
30
- module CSPProxy
31
- def self.csp
32
- return OPT_OUT if CSP.opt_out?
33
-
34
- CSP.config
35
- end
36
- end
37
-
38
- def self.get
39
- CSPProxy
40
- end
41
- end
42
- end
43
-
44
- module SecureHeaders35
45
- class << self
46
- def content_security_policy_script_nonce(req)
47
- NONCE
48
- end
49
- end
50
-
51
- module Configuration
52
- module CSPProxy
53
- def self.csp
54
- CSP
55
- end
56
- end
57
-
58
- def self.get
59
- CSPProxy
60
- end
61
- end
62
- end
63
-
64
- module SecureHeaders60
65
- class << self
66
- def content_security_policy_script_nonce(req)
67
- NONCE
68
- end
69
- end
70
-
71
- module Configuration
72
- module CSPProxy
73
- def self.csp
74
- CSP
75
- end
76
- end
77
-
78
- def self.dup
79
- CSPProxy
80
- end
81
- end
82
- end
83
- end
@@ -1,12 +0,0 @@
1
- shared_context 'reconfigure notifier', :reconfigure_notifier => true do
2
- before { reconfigure_notifier }
3
- end
4
-
5
- shared_context 'payload from fixture', :fixture => :payload do
6
- let(:payload) do
7
- {
8
- 'data' => load_payload_fixture(payload_fixture),
9
- 'access_token' => 'the-token'
10
- }
11
- end
12
- end