honeybadger 5.0.2 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +713 -701
  3. data/LICENSE +19 -19
  4. data/README.md +57 -57
  5. data/TROUBLESHOOTING.md +3 -3
  6. data/bin/honeybadger +5 -5
  7. data/lib/honeybadger/agent.rb +488 -488
  8. data/lib/honeybadger/backend/base.rb +116 -116
  9. data/lib/honeybadger/backend/debug.rb +22 -22
  10. data/lib/honeybadger/backend/null.rb +29 -29
  11. data/lib/honeybadger/backend/server.rb +62 -62
  12. data/lib/honeybadger/backend/test.rb +46 -46
  13. data/lib/honeybadger/backend.rb +27 -27
  14. data/lib/honeybadger/backtrace.rb +181 -181
  15. data/lib/honeybadger/breadcrumbs/active_support.rb +119 -119
  16. data/lib/honeybadger/breadcrumbs/breadcrumb.rb +53 -53
  17. data/lib/honeybadger/breadcrumbs/collector.rb +82 -82
  18. data/lib/honeybadger/breadcrumbs/logging.rb +51 -51
  19. data/lib/honeybadger/breadcrumbs/ring_buffer.rb +44 -44
  20. data/lib/honeybadger/breadcrumbs.rb +8 -8
  21. data/lib/honeybadger/cli/deploy.rb +43 -43
  22. data/lib/honeybadger/cli/exec.rb +143 -143
  23. data/lib/honeybadger/cli/helpers.rb +28 -28
  24. data/lib/honeybadger/cli/heroku.rb +129 -129
  25. data/lib/honeybadger/cli/install.rb +101 -101
  26. data/lib/honeybadger/cli/main.rb +237 -237
  27. data/lib/honeybadger/cli/notify.rb +67 -67
  28. data/lib/honeybadger/cli/test.rb +267 -267
  29. data/lib/honeybadger/cli.rb +14 -14
  30. data/lib/honeybadger/config/defaults.rb +336 -333
  31. data/lib/honeybadger/config/env.rb +42 -42
  32. data/lib/honeybadger/config/ruby.rb +146 -146
  33. data/lib/honeybadger/config/yaml.rb +76 -76
  34. data/lib/honeybadger/config.rb +413 -413
  35. data/lib/honeybadger/const.rb +20 -20
  36. data/lib/honeybadger/context_manager.rb +55 -55
  37. data/lib/honeybadger/conversions.rb +16 -16
  38. data/lib/honeybadger/init/rails.rb +38 -38
  39. data/lib/honeybadger/init/rake.rb +66 -66
  40. data/lib/honeybadger/init/ruby.rb +11 -11
  41. data/lib/honeybadger/init/sinatra.rb +51 -51
  42. data/lib/honeybadger/logging.rb +177 -177
  43. data/lib/honeybadger/notice.rb +579 -568
  44. data/lib/honeybadger/plugin.rb +210 -210
  45. data/lib/honeybadger/plugins/breadcrumbs.rb +111 -111
  46. data/lib/honeybadger/plugins/delayed_job/plugin.rb +56 -56
  47. data/lib/honeybadger/plugins/delayed_job.rb +22 -22
  48. data/lib/honeybadger/plugins/faktory.rb +52 -52
  49. data/lib/honeybadger/plugins/lambda.rb +71 -71
  50. data/lib/honeybadger/plugins/local_variables.rb +44 -44
  51. data/lib/honeybadger/plugins/passenger.rb +23 -23
  52. data/lib/honeybadger/plugins/rails.rb +72 -63
  53. data/lib/honeybadger/plugins/resque.rb +72 -72
  54. data/lib/honeybadger/plugins/shoryuken.rb +52 -52
  55. data/lib/honeybadger/plugins/sidekiq.rb +71 -62
  56. data/lib/honeybadger/plugins/sucker_punch.rb +18 -18
  57. data/lib/honeybadger/plugins/thor.rb +32 -32
  58. data/lib/honeybadger/plugins/warden.rb +19 -19
  59. data/lib/honeybadger/rack/error_notifier.rb +92 -92
  60. data/lib/honeybadger/rack/user_feedback.rb +88 -88
  61. data/lib/honeybadger/rack/user_informer.rb +45 -45
  62. data/lib/honeybadger/ruby.rb +2 -2
  63. data/lib/honeybadger/singleton.rb +103 -103
  64. data/lib/honeybadger/tasks.rb +22 -22
  65. data/lib/honeybadger/templates/feedback_form.erb +84 -84
  66. data/lib/honeybadger/util/http.rb +92 -92
  67. data/lib/honeybadger/util/lambda.rb +32 -32
  68. data/lib/honeybadger/util/request_hash.rb +73 -73
  69. data/lib/honeybadger/util/request_payload.rb +41 -41
  70. data/lib/honeybadger/util/revision.rb +39 -39
  71. data/lib/honeybadger/util/sanitizer.rb +214 -214
  72. data/lib/honeybadger/util/sql.rb +34 -34
  73. data/lib/honeybadger/util/stats.rb +50 -50
  74. data/lib/honeybadger/version.rb +4 -4
  75. data/lib/honeybadger/worker.rb +253 -253
  76. data/lib/honeybadger.rb +11 -11
  77. data/resources/ca-bundle.crt +3376 -3376
  78. data/vendor/capistrano-honeybadger/lib/capistrano/honeybadger.rb +5 -5
  79. data/vendor/capistrano-honeybadger/lib/capistrano/tasks/deploy.cap +89 -89
  80. data/vendor/capistrano-honeybadger/lib/honeybadger/capistrano/legacy.rb +47 -47
  81. data/vendor/capistrano-honeybadger/lib/honeybadger/capistrano.rb +2 -2
  82. data/vendor/cli/inifile.rb +628 -628
  83. data/vendor/cli/thor/actions/create_file.rb +103 -103
  84. data/vendor/cli/thor/actions/create_link.rb +59 -59
  85. data/vendor/cli/thor/actions/directory.rb +118 -118
  86. data/vendor/cli/thor/actions/empty_directory.rb +135 -135
  87. data/vendor/cli/thor/actions/file_manipulation.rb +316 -316
  88. data/vendor/cli/thor/actions/inject_into_file.rb +107 -107
  89. data/vendor/cli/thor/actions.rb +319 -319
  90. data/vendor/cli/thor/base.rb +656 -656
  91. data/vendor/cli/thor/command.rb +133 -133
  92. data/vendor/cli/thor/core_ext/hash_with_indifferent_access.rb +77 -77
  93. data/vendor/cli/thor/core_ext/io_binary_read.rb +10 -10
  94. data/vendor/cli/thor/core_ext/ordered_hash.rb +98 -98
  95. data/vendor/cli/thor/error.rb +32 -32
  96. data/vendor/cli/thor/group.rb +281 -281
  97. data/vendor/cli/thor/invocation.rb +178 -178
  98. data/vendor/cli/thor/line_editor/basic.rb +35 -35
  99. data/vendor/cli/thor/line_editor/readline.rb +88 -88
  100. data/vendor/cli/thor/line_editor.rb +17 -17
  101. data/vendor/cli/thor/parser/argument.rb +73 -73
  102. data/vendor/cli/thor/parser/arguments.rb +175 -175
  103. data/vendor/cli/thor/parser/option.rb +125 -125
  104. data/vendor/cli/thor/parser/options.rb +218 -218
  105. data/vendor/cli/thor/parser.rb +4 -4
  106. data/vendor/cli/thor/rake_compat.rb +71 -71
  107. data/vendor/cli/thor/runner.rb +322 -322
  108. data/vendor/cli/thor/shell/basic.rb +421 -421
  109. data/vendor/cli/thor/shell/color.rb +149 -149
  110. data/vendor/cli/thor/shell/html.rb +126 -126
  111. data/vendor/cli/thor/shell.rb +81 -81
  112. data/vendor/cli/thor/util.rb +267 -267
  113. data/vendor/cli/thor/version.rb +3 -3
  114. data/vendor/cli/thor.rb +484 -484
  115. metadata +10 -5
@@ -1,116 +1,116 @@
1
- require 'forwardable'
2
- require 'net/http'
3
- require 'json'
4
-
5
- require 'honeybadger/logging'
6
-
7
- module Honeybadger
8
- module Backend
9
- class Response
10
- NOT_BLANK = /\S/
11
-
12
- attr_reader :code, :body, :message, :error
13
-
14
- FRIENDLY_ERRORS = {
15
- 429 => "Your project is currently sending too many errors.\nThis issue should resolve itself once error traffic is reduced.".freeze,
16
- 503 => "Your project is currently sending too many errors.\nThis issue should resolve itself once error traffic is reduced.".freeze,
17
- 402 => "The project owner's billing information has expired (or the trial has ended).\nPlease check your payment details or email support@honeybadger.io for help.".freeze,
18
- 403 => "The API key is invalid. Please check your API key and try again.".freeze
19
- }.freeze
20
-
21
- # Initializes the Response instance.
22
- #
23
- # @overload initialize(response)
24
- # Creates an instance from a +Net::HTTPResponse+.
25
- # @param [Net::HTTPResponse] response With 1 argument, the code, body,
26
- # and message will be determined automatically.
27
- #
28
- # @overload initialize(code, body, message)
29
- # Creates an instance from parameters.
30
- # @param [Integer] code The status code. May also be :error for requests
31
- # which failed to reach the server.
32
- # @param [String] body The String body of the response.
33
- # @param [String] message The String message returned by the server (or
34
- # set by the backend in the case of an :error code).
35
- def initialize(*args)
36
- if (response = args.first).kind_of?(Net::HTTPResponse)
37
- @code, @body, @message = response.code.to_i, response.body.to_s, response.message
38
- else
39
- @code, @body, @message = args
40
- end
41
-
42
- @success = (200..299).cover?(@code)
43
- @error = parse_error(body) unless @success
44
- end
45
-
46
- def success?
47
- @success
48
- end
49
-
50
- def error_message
51
- return message if code == :error
52
- return FRIENDLY_ERRORS[code] if FRIENDLY_ERRORS[code]
53
- return error if error =~ NOT_BLANK
54
- msg = "The server responded with #{code}"
55
- msg << ": #{message}" if message =~ NOT_BLANK
56
- msg
57
- end
58
-
59
- private
60
-
61
- def parse_error(body)
62
- return unless body =~ NOT_BLANK
63
- obj = JSON.parse(body)
64
- return obj['error'] if obj.kind_of?(Hash)
65
- rescue JSON::ParserError
66
- nil
67
- end
68
- end
69
-
70
- class Base
71
- extend Forwardable
72
-
73
- include Honeybadger::Logging::Helper
74
-
75
- def initialize(config)
76
- @config = config
77
- end
78
-
79
- # Process payload for feature.
80
- #
81
- # @example
82
- # backend.notify(:notices, Notice.new(...))
83
- #
84
- # @param [Symbol] feature The feature name (corresponds to HTTP
85
- # endpoint). Current options are: `:notices`, `:deploys`, `:ping`.
86
- # @param [#to_json] payload The JSON payload to send.
87
- #
88
- # @raise NotImplementedError
89
- def notify(feature, payload)
90
- raise NotImplementedError, 'must define #notify on subclass.'
91
- end
92
-
93
- # Does a check in using the input id.
94
- #
95
- # @param [String] id The unique check_in id.
96
- #
97
- # @raise NotImplementedError
98
- def check_in(id)
99
- raise NotImplementedError, 'must define #check_in on subclass.'
100
- end
101
-
102
- # Track a deployment
103
- # @example
104
- # backend.track_deployment({ revision: 'be2ceb6' })
105
- #
106
- # @param [#to_json] payload The JSON payload containing all deployment data.
107
- def track_deployment(payload)
108
- notify(:deploys, payload)
109
- end
110
-
111
- private
112
-
113
- attr_reader :config
114
- end
115
- end
116
- end
1
+ require 'forwardable'
2
+ require 'net/http'
3
+ require 'json'
4
+
5
+ require 'honeybadger/logging'
6
+
7
+ module Honeybadger
8
+ module Backend
9
+ class Response
10
+ NOT_BLANK = /\S/
11
+
12
+ attr_reader :code, :body, :message, :error
13
+
14
+ FRIENDLY_ERRORS = {
15
+ 429 => "Your project is currently sending too many errors.\nThis issue should resolve itself once error traffic is reduced.".freeze,
16
+ 503 => "Your project is currently sending too many errors.\nThis issue should resolve itself once error traffic is reduced.".freeze,
17
+ 402 => "The project owner's billing information has expired (or the trial has ended).\nPlease check your payment details or email support@honeybadger.io for help.".freeze,
18
+ 403 => "The API key is invalid. Please check your API key and try again.".freeze
19
+ }.freeze
20
+
21
+ # Initializes the Response instance.
22
+ #
23
+ # @overload initialize(response)
24
+ # Creates an instance from a +Net::HTTPResponse+.
25
+ # @param [Net::HTTPResponse] response With 1 argument, the code, body,
26
+ # and message will be determined automatically.
27
+ #
28
+ # @overload initialize(code, body, message)
29
+ # Creates an instance from parameters.
30
+ # @param [Integer] code The status code. May also be :error for requests
31
+ # which failed to reach the server.
32
+ # @param [String] body The String body of the response.
33
+ # @param [String] message The String message returned by the server (or
34
+ # set by the backend in the case of an :error code).
35
+ def initialize(*args)
36
+ if (response = args.first).kind_of?(Net::HTTPResponse)
37
+ @code, @body, @message = response.code.to_i, response.body.to_s, response.message
38
+ else
39
+ @code, @body, @message = args
40
+ end
41
+
42
+ @success = (200..299).cover?(@code)
43
+ @error = parse_error(body) unless @success
44
+ end
45
+
46
+ def success?
47
+ @success
48
+ end
49
+
50
+ def error_message
51
+ return message if code == :error
52
+ return FRIENDLY_ERRORS[code] if FRIENDLY_ERRORS[code]
53
+ return error if error =~ NOT_BLANK
54
+ msg = "The server responded with #{code}"
55
+ msg << ": #{message}" if message =~ NOT_BLANK
56
+ msg
57
+ end
58
+
59
+ private
60
+
61
+ def parse_error(body)
62
+ return unless body =~ NOT_BLANK
63
+ obj = JSON.parse(body)
64
+ return obj['error'] if obj.kind_of?(Hash)
65
+ rescue JSON::ParserError
66
+ nil
67
+ end
68
+ end
69
+
70
+ class Base
71
+ extend Forwardable
72
+
73
+ include Honeybadger::Logging::Helper
74
+
75
+ def initialize(config)
76
+ @config = config
77
+ end
78
+
79
+ # Process payload for feature.
80
+ #
81
+ # @example
82
+ # backend.notify(:notices, Notice.new(...))
83
+ #
84
+ # @param [Symbol] feature The feature name (corresponds to HTTP
85
+ # endpoint). Current options are: `:notices`, `:deploys`, `:ping`.
86
+ # @param [#to_json] payload The JSON payload to send.
87
+ #
88
+ # @raise NotImplementedError
89
+ def notify(feature, payload)
90
+ raise NotImplementedError, 'must define #notify on subclass.'
91
+ end
92
+
93
+ # Does a check in using the input id.
94
+ #
95
+ # @param [String] id The unique check_in id.
96
+ #
97
+ # @raise NotImplementedError
98
+ def check_in(id)
99
+ raise NotImplementedError, 'must define #check_in on subclass.'
100
+ end
101
+
102
+ # Track a deployment
103
+ # @example
104
+ # backend.track_deployment({ revision: 'be2ceb6' })
105
+ #
106
+ # @param [#to_json] payload The JSON payload containing all deployment data.
107
+ def track_deployment(payload)
108
+ notify(:deploys, payload)
109
+ end
110
+
111
+ private
112
+
113
+ attr_reader :config
114
+ end
115
+ end
116
+ end
@@ -1,22 +1,22 @@
1
- require 'honeybadger/backend/null'
2
-
3
- module Honeybadger
4
- module Backend
5
- # Logs the notice payload rather than sending it. The purpose of this
6
- # backend is primarily for programmatically inspecting JSON payloads in
7
- # integration tests.
8
- class Debug < Null
9
- def notify(feature, payload)
10
- logger.unknown("notifying debug backend of feature=#{feature}\n\t#{payload.to_json}")
11
- return Response.new(ENV['DEBUG_BACKEND_STATUS'].to_i, nil) if ENV['DEBUG_BACKEND_STATUS']
12
- super
13
- end
14
-
15
- def check_in(id)
16
- logger.unknown("checking in debug backend with id=#{id}")
17
- return Response.new(ENV['DEBUG_BACKEND_STATUS'].to_i, nil) if ENV['DEBUG_BACKEND_STATUS']
18
- super
19
- end
20
- end
21
- end
22
- end
1
+ require 'honeybadger/backend/null'
2
+
3
+ module Honeybadger
4
+ module Backend
5
+ # Logs the notice payload rather than sending it. The purpose of this
6
+ # backend is primarily for programmatically inspecting JSON payloads in
7
+ # integration tests.
8
+ class Debug < Null
9
+ def notify(feature, payload)
10
+ logger.unknown("notifying debug backend of feature=#{feature}\n\t#{payload.to_json}")
11
+ return Response.new(ENV['DEBUG_BACKEND_STATUS'].to_i, nil) if ENV['DEBUG_BACKEND_STATUS']
12
+ super
13
+ end
14
+
15
+ def check_in(id)
16
+ logger.unknown("checking in debug backend with id=#{id}")
17
+ return Response.new(ENV['DEBUG_BACKEND_STATUS'].to_i, nil) if ENV['DEBUG_BACKEND_STATUS']
18
+ super
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,29 +1,29 @@
1
- require 'honeybadger/backend/base'
2
-
3
- module Honeybadger
4
- module Backend
5
- class Null < Base
6
- class StubbedResponse < Response
7
- def initialize
8
- super(:stubbed, '{}'.freeze)
9
- end
10
-
11
- def success?
12
- true
13
- end
14
- end
15
-
16
- def initialize(*args)
17
- super
18
- end
19
-
20
- def notify(feature, payload)
21
- StubbedResponse.new
22
- end
23
-
24
- def check_in(id)
25
- StubbedResponse.new
26
- end
27
- end
28
- end
29
- end
1
+ require 'honeybadger/backend/base'
2
+
3
+ module Honeybadger
4
+ module Backend
5
+ class Null < Base
6
+ class StubbedResponse < Response
7
+ def initialize
8
+ super(:stubbed, '{}'.freeze)
9
+ end
10
+
11
+ def success?
12
+ true
13
+ end
14
+ end
15
+
16
+ def initialize(*args)
17
+ super
18
+ end
19
+
20
+ def notify(feature, payload)
21
+ StubbedResponse.new
22
+ end
23
+
24
+ def check_in(id)
25
+ StubbedResponse.new
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,62 +1,62 @@
1
- require 'net/http'
2
- require 'json'
3
- require 'zlib'
4
- require 'openssl'
5
-
6
- require 'honeybadger/backend/base'
7
- require 'honeybadger/util/http'
8
-
9
- module Honeybadger
10
- module Backend
11
- class Server < Base
12
- ENDPOINTS = {
13
- notices: '/v1/notices'.freeze,
14
- deploys: '/v1/deploys'.freeze
15
- }.freeze
16
-
17
- CHECK_IN_ENDPOINT = '/v1/check_in'.freeze
18
-
19
-
20
- HTTP_ERRORS = Util::HTTP::ERRORS
21
-
22
- def initialize(config)
23
- @http = Util::HTTP.new(config)
24
- super
25
- end
26
-
27
- # Post payload to endpoint for feature.
28
- #
29
- # @param [Symbol] feature The feature which is being notified.
30
- # @param [#to_json] payload The JSON payload to send.
31
- #
32
- # @return [Response]
33
- def notify(feature, payload)
34
- ENDPOINTS[feature] or raise(BackendError, "Unknown feature: #{feature}")
35
- Response.new(@http.post(ENDPOINTS[feature], payload, payload_headers(payload)))
36
- rescue *HTTP_ERRORS => e
37
- Response.new(:error, nil, "HTTP Error: #{e.class}")
38
- end
39
-
40
- # Does a check in using the input id.
41
- #
42
- # @param [String] id The unique check_in id.
43
- #
44
- # @return [Response]
45
- def check_in(id)
46
- Response.new(@http.get("#{CHECK_IN_ENDPOINT}/#{id}"))
47
- rescue *HTTP_ERRORS => e
48
- Response.new(:error, nil, "HTTP Error: #{e.class}")
49
- end
50
-
51
- private
52
-
53
- def payload_headers(payload)
54
- if payload.respond_to?(:api_key) && payload.api_key
55
- {
56
- 'X-API-Key' => payload.api_key
57
- }
58
- end
59
- end
60
- end
61
- end
62
- end
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'zlib'
4
+ require 'openssl'
5
+
6
+ require 'honeybadger/backend/base'
7
+ require 'honeybadger/util/http'
8
+
9
+ module Honeybadger
10
+ module Backend
11
+ class Server < Base
12
+ ENDPOINTS = {
13
+ notices: '/v1/notices'.freeze,
14
+ deploys: '/v1/deploys'.freeze
15
+ }.freeze
16
+
17
+ CHECK_IN_ENDPOINT = '/v1/check_in'.freeze
18
+
19
+
20
+ HTTP_ERRORS = Util::HTTP::ERRORS
21
+
22
+ def initialize(config)
23
+ @http = Util::HTTP.new(config)
24
+ super
25
+ end
26
+
27
+ # Post payload to endpoint for feature.
28
+ #
29
+ # @param [Symbol] feature The feature which is being notified.
30
+ # @param [#to_json] payload The JSON payload to send.
31
+ #
32
+ # @return [Response]
33
+ def notify(feature, payload)
34
+ ENDPOINTS[feature] or raise(BackendError, "Unknown feature: #{feature}")
35
+ Response.new(@http.post(ENDPOINTS[feature], payload, payload_headers(payload)))
36
+ rescue *HTTP_ERRORS => e
37
+ Response.new(:error, nil, "HTTP Error: #{e.class}")
38
+ end
39
+
40
+ # Does a check in using the input id.
41
+ #
42
+ # @param [String] id The unique check_in id.
43
+ #
44
+ # @return [Response]
45
+ def check_in(id)
46
+ Response.new(@http.get("#{CHECK_IN_ENDPOINT}/#{id}"))
47
+ rescue *HTTP_ERRORS => e
48
+ Response.new(:error, nil, "HTTP Error: #{e.class}")
49
+ end
50
+
51
+ private
52
+
53
+ def payload_headers(payload)
54
+ if payload.respond_to?(:api_key) && payload.api_key
55
+ {
56
+ 'X-API-Key' => payload.api_key
57
+ }
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,46 +1,46 @@
1
- require 'honeybadger/backend/null'
2
-
3
- module Honeybadger
4
- module Backend
5
- class Test < Null
6
- # The notification list.
7
- #
8
- # @example
9
- # Test.notifications[:notices] # => [Notice, Notice, ...]
10
- #
11
- # @return [Hash] Notifications hash.
12
- def self.notifications
13
- @notifications ||= Hash.new {|h,k| h[k] = [] }
14
- end
15
-
16
- # @api public
17
- # The check in list.
18
- #
19
- # @example
20
- # Test.check_ins # => ["foobar", "danny", ...]
21
- #
22
- # @return [Array<Object>] List of check ins.
23
- def self.check_ins
24
- @check_ins ||= []
25
- end
26
-
27
- def notifications
28
- self.class.notifications
29
- end
30
-
31
- def check_ins
32
- self.class.check_ins
33
- end
34
-
35
- def notify(feature, payload)
36
- notifications[feature] << payload
37
- super
38
- end
39
-
40
- def check_in(id)
41
- check_ins << id
42
- super
43
- end
44
- end
45
- end
46
- end
1
+ require 'honeybadger/backend/null'
2
+
3
+ module Honeybadger
4
+ module Backend
5
+ class Test < Null
6
+ # The notification list.
7
+ #
8
+ # @example
9
+ # Test.notifications[:notices] # => [Notice, Notice, ...]
10
+ #
11
+ # @return [Hash] Notifications hash.
12
+ def self.notifications
13
+ @notifications ||= Hash.new {|h,k| h[k] = [] }
14
+ end
15
+
16
+ # @api public
17
+ # The check in list.
18
+ #
19
+ # @example
20
+ # Test.check_ins # => ["foobar", "danny", ...]
21
+ #
22
+ # @return [Array<Object>] List of check ins.
23
+ def self.check_ins
24
+ @check_ins ||= []
25
+ end
26
+
27
+ def notifications
28
+ self.class.notifications
29
+ end
30
+
31
+ def check_ins
32
+ self.class.check_ins
33
+ end
34
+
35
+ def notify(feature, payload)
36
+ notifications[feature] << payload
37
+ super
38
+ end
39
+
40
+ def check_in(id)
41
+ check_ins << id
42
+ super
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,27 +1,27 @@
1
- require 'forwardable'
2
-
3
- require 'honeybadger/backend/base'
4
- require 'honeybadger/backend/server'
5
- require 'honeybadger/backend/test'
6
- require 'honeybadger/backend/null'
7
- require 'honeybadger/backend/debug'
8
-
9
- module Honeybadger
10
- # @api private
11
- module Backend
12
- class BackendError < StandardError; end
13
-
14
- def self.mapping
15
- @@mapping ||= {
16
- server: Server,
17
- test: Test,
18
- null: Null,
19
- debug: Debug
20
- }.freeze
21
- end
22
-
23
- def self.for(backend)
24
- mapping[backend] or raise(BackendError, "Unable to locate backend: #{backend}")
25
- end
26
- end
27
- end
1
+ require 'forwardable'
2
+
3
+ require 'honeybadger/backend/base'
4
+ require 'honeybadger/backend/server'
5
+ require 'honeybadger/backend/test'
6
+ require 'honeybadger/backend/null'
7
+ require 'honeybadger/backend/debug'
8
+
9
+ module Honeybadger
10
+ # @api private
11
+ module Backend
12
+ class BackendError < StandardError; end
13
+
14
+ def self.mapping
15
+ @@mapping ||= {
16
+ server: Server,
17
+ test: Test,
18
+ null: Null,
19
+ debug: Debug
20
+ }.freeze
21
+ end
22
+
23
+ def self.for(backend)
24
+ mapping[backend] or raise(BackendError, "Unable to locate backend: #{backend}")
25
+ end
26
+ end
27
+ end