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,267 +1,267 @@
1
- require 'erb'
2
- require 'forwardable'
3
- require 'honeybadger/cli/main'
4
- require 'pathname'
5
-
6
- module Honeybadger
7
- module CLI
8
- class Test
9
- extend Forwardable
10
-
11
- TEST_EXCEPTION = begin
12
- exception_name = ENV['EXCEPTION'] || 'HoneybadgerTestingException'
13
- Object.const_get(exception_name)
14
- rescue
15
- Object.const_set(exception_name, Class.new(Exception))
16
- end.new('Testing honeybadger via "honeybadger test". If you can see this, it works.')
17
-
18
- class TestBackend
19
- def initialize(backend)
20
- @backend = backend
21
- end
22
-
23
- def self.callings
24
- @callings ||= Hash.new {|h,k| h[k] = [] }
25
- end
26
-
27
- def notify(feature, payload)
28
- response = @backend.notify(feature, payload)
29
- self.class.callings[feature] << [payload, response]
30
- response
31
- end
32
- end
33
-
34
- def initialize(options)
35
- @options = options
36
- @shell = ::Thor::Base.shell.new
37
- end
38
-
39
- def run
40
- begin
41
- require File.join(Dir.pwd, 'config', 'environment.rb')
42
- raise LoadError unless defined?(::Rails.application)
43
- say("Detected Rails #{Rails::VERSION::STRING}")
44
- rescue LoadError
45
- require 'honeybadger/init/ruby'
46
- end
47
-
48
- if Honeybadger.config.get(:api_key).to_s =~ BLANK
49
- say("Unable to send test: Honeybadger API key is missing.", :red)
50
- exit(1)
51
- end
52
-
53
- Honeybadger.config.set(:report_data, !options[:dry_run])
54
- test_backend = TestBackend.new(Honeybadger.config.backend)
55
- Honeybadger.config.backend = test_backend
56
-
57
- at_exit do
58
- # Exceptions will already be reported when exiting.
59
- verify_test unless $!
60
- end
61
-
62
- run_test
63
- end
64
-
65
- private
66
-
67
- attr_reader :options
68
-
69
- def_delegator :@shell, :say
70
-
71
- def run_test
72
- if defined?(::Rails.application) && ::Rails.application
73
- run_rails_test
74
- else
75
- run_standalone_test
76
- end
77
- end
78
-
79
- def test_exception_class
80
- exception_name = ENV['EXCEPTION'] || 'HoneybadgerTestingException'
81
- Object.const_get(exception_name)
82
- rescue
83
- Object.const_set(exception_name, Class.new(Exception))
84
- end
85
-
86
- def run_standalone_test
87
- Honeybadger.notify(TEST_EXCEPTION)
88
- end
89
-
90
- def run_rails_test
91
- # Suppress error logging in Rails' exception handling middleware. Rails 3.0
92
- # uses ActionDispatch::ShowExceptions to rescue/show exceptions, but does
93
- # not log anything but application trace. Rails 3.2 now falls back to
94
- # logging the framework trace (moved to ActionDispatch::DebugExceptions),
95
- # which caused cluttered output while running the test task.
96
- defined?(::ActionDispatch::DebugExceptions) and
97
- ::ActionDispatch::DebugExceptions.class_eval { def logger(*args) ; @logger ||= Logger.new(nil) ; end }
98
- defined?(::ActionDispatch::ShowExceptions) and
99
- ::ActionDispatch::ShowExceptions.class_eval { def logger(*args) ; @logger ||= Logger.new(nil) ; end }
100
-
101
- # Detect and disable the better_errors gem
102
- if defined?(::BetterErrors::Middleware)
103
- say('Better Errors detected: temporarily disabling middleware.', :yellow)
104
- ::BetterErrors::Middleware.class_eval { def call(env) @app.call(env); end }
105
- end
106
-
107
- begin
108
- require './app/controllers/application_controller'
109
- rescue LoadError
110
- nil
111
- end
112
-
113
- unless defined?(::ApplicationController)
114
- say('Error: No ApplicationController found.', :red)
115
- return false
116
- end
117
-
118
- eval(<<-CONTROLLER)
119
- class Honeybadger::TestController < ApplicationController
120
- # This is to bypass any filters that may prevent access to the action.
121
- if respond_to?(:prepend_before_action)
122
- prepend_before_action :test_honeybadger
123
- else
124
- prepend_before_filter :test_honeybadger
125
- end
126
- def test_honeybadger
127
- puts "Raising '#{Honeybadger::CLI::Test::TEST_EXCEPTION.class.name}' to simulate application failure."
128
- raise Honeybadger::CLI::Test::TEST_EXCEPTION
129
- end
130
- # Ensure we actually have an action to go to.
131
- def verify; end
132
- end
133
- CONTROLLER
134
-
135
- ::Rails.application.routes.tap do |r|
136
- # RouteSet#disable_clear_and_finalize prevents existing routes from
137
- # being cleared. We'll set it back to the original value when we're
138
- # done so not to mess with Rails state.
139
- d = r.disable_clear_and_finalize
140
- begin
141
- r.disable_clear_and_finalize = true
142
- r.clear!
143
- r.draw do
144
- match 'verify' => 'honeybadger/test#verify', :as => "verify_#{SecureRandom.hex}", :via => :get
145
- end
146
- ::Rails.application.routes_reloader.paths.each{ |path| load(path) }
147
- ::ActiveSupport.on_load(:action_controller) { r.finalize! }
148
- ensure
149
- r.disable_clear_and_finalize = d
150
- end
151
- end
152
-
153
- ssl = defined?(::Rails.configuration.force_ssl) && ::Rails.configuration.force_ssl
154
- env = ::Rack::MockRequest.env_for("http#{ ssl ? 's' : nil }://www.example.com/verify", 'REMOTE_ADDR' => '127.0.0.1', 'HTTP_HOST' => 'localhost')
155
-
156
- ::Rails.application.call(env)
157
- end
158
-
159
- def verify_test
160
- Honeybadger.flush
161
-
162
- if calling = TestBackend.callings[:notices].find {|c| c[0].exception.eql?(TEST_EXCEPTION) }
163
- notice, response = *calling
164
-
165
- if !response.success?
166
- host = Honeybadger.config.get(:'connection.host')
167
- say(<<-MSG, :red)
168
- !! --- Honeybadger test failed ------------------------------------------------ !!
169
-
170
- The error notifier is installed, but we encountered an error:
171
-
172
- #{response.error_message}
173
-
174
- To fix this issue, please try the following:
175
-
176
- - Make sure the gem is configured properly.
177
- - Retry executing this command a few times.
178
- - Make sure you can connect to #{host} (`curl https://#{host}/v1/notices`).
179
- - Email support@honeybadger.io for help. Include as much debug info as you
180
- can for a faster resolution!
181
-
182
- !! --- End -------------------------------------------------------------------- !!
183
- MSG
184
- exit(1)
185
- end
186
-
187
- say(generate_success_message(response), :green)
188
-
189
- exit(0)
190
- end
191
-
192
- say(<<-MSG, :red)
193
- !! --- Honeybadger test failed ------------------------------------------------ !!
194
-
195
- Error: The test exception was not reported; the application may not be
196
- configured properly.
197
-
198
- This is usually caused by one of the following issues:
199
-
200
- - There was a problem loading your application. Check your logs to see if a
201
- different exception is being raised.
202
- - The exception is being rescued before it reaches our Rack middleware. If
203
- you're using `rescue` or `rescue_from` you may need to notify Honeybadger
204
- manually: `Honeybadger.notify(exception)`.
205
- - The honeybadger gem is misconfigured. Check the settings in your
206
- honeybadger.yml file.
207
- MSG
208
-
209
- notices = TestBackend.callings[:notices].map(&:first)
210
- unless notices.empty?
211
- say("\nThe following errors were reported:", :red)
212
- notices.each {|n| say("\n - #{n.error_class}: #{n.error_message}", :red) }
213
- end
214
-
215
- say("\nSee https://docs.honeybadger.io/gem-troubleshooting for more troubleshooting help.\n\n", :red)
216
- say("!! --- End -------------------------------------------------------------------- !!", :red)
217
-
218
- exit(1)
219
- end
220
-
221
- def generate_success_message(response)
222
- notice_id = JSON.parse(response.body)['id']
223
- notice_url = "https://app.honeybadger.io/notice/#{notice_id}"
224
-
225
- unless options[:install]
226
- return "⚡ Success: #{notice_url}"
227
- end
228
-
229
- <<-MSG
230
- ⚡ --- Honeybadger is installed! -----------------------------------------------
231
-
232
- Good news: You're one deploy away from seeing all of your exceptions in
233
- Honeybadger. For now, we've generated a test exception for you:
234
-
235
- #{notice_url}
236
-
237
- Optional steps:
238
-
239
- - Show a feedback form on your error page:
240
- https://docs.honeybadger.io/gem-feedback
241
- - Show a UUID or link to Honeybadger on your error page:
242
- https://docs.honeybadger.io/gem-informer
243
- - Track deployments (if you're using Capistrano, we already did this):
244
- https://docs.honeybadger.io/gem-deploys
245
-
246
- If you ever need help:
247
-
248
- - Read the gem troubleshooting guide: https://docs.honeybadger.io/gem-troubleshooting
249
- - Check out our documentation: https://docs.honeybadger.io/
250
- - Email the founders: support@honeybadger.io
251
-
252
- Most people don't realize that Honeybadger is a small, bootstrapped company. We
253
- really couldn't do this without you. Thank you for allowing us to do what we
254
- love: making developers awesome.
255
-
256
- Happy 'badgering!
257
-
258
- Sincerely,
259
- The Honeybadger Crew
260
- https://www.honeybadger.io/about/
261
-
262
- ⚡ --- End --------------------------------------------------------------------
263
- MSG
264
- end
265
- end
266
- end
267
- end
1
+ require 'erb'
2
+ require 'forwardable'
3
+ require 'honeybadger/cli/main'
4
+ require 'pathname'
5
+
6
+ module Honeybadger
7
+ module CLI
8
+ class Test
9
+ extend Forwardable
10
+
11
+ TEST_EXCEPTION = begin
12
+ exception_name = ENV['EXCEPTION'] || 'HoneybadgerTestingException'
13
+ Object.const_get(exception_name)
14
+ rescue
15
+ Object.const_set(exception_name, Class.new(Exception))
16
+ end.new('Testing honeybadger via "honeybadger test". If you can see this, it works.')
17
+
18
+ class TestBackend
19
+ def initialize(backend)
20
+ @backend = backend
21
+ end
22
+
23
+ def self.callings
24
+ @callings ||= Hash.new {|h,k| h[k] = [] }
25
+ end
26
+
27
+ def notify(feature, payload)
28
+ response = @backend.notify(feature, payload)
29
+ self.class.callings[feature] << [payload, response]
30
+ response
31
+ end
32
+ end
33
+
34
+ def initialize(options)
35
+ @options = options
36
+ @shell = ::Thor::Base.shell.new
37
+ end
38
+
39
+ def run
40
+ begin
41
+ require File.join(Dir.pwd, 'config', 'environment.rb')
42
+ raise LoadError unless defined?(::Rails.application)
43
+ say("Detected Rails #{Rails::VERSION::STRING}")
44
+ rescue LoadError
45
+ require 'honeybadger/init/ruby'
46
+ end
47
+
48
+ if Honeybadger.config.get(:api_key).to_s =~ BLANK
49
+ say("Unable to send test: Honeybadger API key is missing.", :red)
50
+ exit(1)
51
+ end
52
+
53
+ Honeybadger.config.set(:report_data, !options[:dry_run])
54
+ test_backend = TestBackend.new(Honeybadger.config.backend)
55
+ Honeybadger.config.backend = test_backend
56
+
57
+ at_exit do
58
+ # Exceptions will already be reported when exiting.
59
+ verify_test unless $!
60
+ end
61
+
62
+ run_test
63
+ end
64
+
65
+ private
66
+
67
+ attr_reader :options
68
+
69
+ def_delegator :@shell, :say
70
+
71
+ def run_test
72
+ if defined?(::Rails.application) && ::Rails.application
73
+ run_rails_test
74
+ else
75
+ run_standalone_test
76
+ end
77
+ end
78
+
79
+ def test_exception_class
80
+ exception_name = ENV['EXCEPTION'] || 'HoneybadgerTestingException'
81
+ Object.const_get(exception_name)
82
+ rescue
83
+ Object.const_set(exception_name, Class.new(Exception))
84
+ end
85
+
86
+ def run_standalone_test
87
+ Honeybadger.notify(TEST_EXCEPTION)
88
+ end
89
+
90
+ def run_rails_test
91
+ # Suppress error logging in Rails' exception handling middleware. Rails 3.0
92
+ # uses ActionDispatch::ShowExceptions to rescue/show exceptions, but does
93
+ # not log anything but application trace. Rails 3.2 now falls back to
94
+ # logging the framework trace (moved to ActionDispatch::DebugExceptions),
95
+ # which caused cluttered output while running the test task.
96
+ defined?(::ActionDispatch::DebugExceptions) and
97
+ ::ActionDispatch::DebugExceptions.class_eval { def logger(*args) ; @logger ||= Logger.new(nil) ; end }
98
+ defined?(::ActionDispatch::ShowExceptions) and
99
+ ::ActionDispatch::ShowExceptions.class_eval { def logger(*args) ; @logger ||= Logger.new(nil) ; end }
100
+
101
+ # Detect and disable the better_errors gem
102
+ if defined?(::BetterErrors::Middleware)
103
+ say('Better Errors detected: temporarily disabling middleware.', :yellow)
104
+ ::BetterErrors::Middleware.class_eval { def call(env) @app.call(env); end }
105
+ end
106
+
107
+ begin
108
+ require './app/controllers/application_controller'
109
+ rescue LoadError
110
+ nil
111
+ end
112
+
113
+ unless defined?(::ApplicationController)
114
+ say('Error: No ApplicationController found.', :red)
115
+ return false
116
+ end
117
+
118
+ eval(<<-CONTROLLER)
119
+ class Honeybadger::TestController < ApplicationController
120
+ # This is to bypass any filters that may prevent access to the action.
121
+ if respond_to?(:prepend_before_action)
122
+ prepend_before_action :test_honeybadger
123
+ else
124
+ prepend_before_filter :test_honeybadger
125
+ end
126
+ def test_honeybadger
127
+ puts "Raising '#{Honeybadger::CLI::Test::TEST_EXCEPTION.class.name}' to simulate application failure."
128
+ raise Honeybadger::CLI::Test::TEST_EXCEPTION
129
+ end
130
+ # Ensure we actually have an action to go to.
131
+ def verify; end
132
+ end
133
+ CONTROLLER
134
+
135
+ ::Rails.application.routes.tap do |r|
136
+ # RouteSet#disable_clear_and_finalize prevents existing routes from
137
+ # being cleared. We'll set it back to the original value when we're
138
+ # done so not to mess with Rails state.
139
+ d = r.disable_clear_and_finalize
140
+ begin
141
+ r.disable_clear_and_finalize = true
142
+ r.clear!
143
+ r.draw do
144
+ match 'verify' => 'honeybadger/test#verify', :as => "verify_#{SecureRandom.hex}", :via => :get
145
+ end
146
+ ::Rails.application.routes_reloader.paths.each{ |path| load(path) }
147
+ ::ActiveSupport.on_load(:action_controller) { r.finalize! }
148
+ ensure
149
+ r.disable_clear_and_finalize = d
150
+ end
151
+ end
152
+
153
+ ssl = defined?(::Rails.configuration.force_ssl) && ::Rails.configuration.force_ssl
154
+ env = ::Rack::MockRequest.env_for("http#{ ssl ? 's' : nil }://www.example.com/verify", 'REMOTE_ADDR' => '127.0.0.1', 'HTTP_HOST' => 'localhost')
155
+
156
+ ::Rails.application.call(env)
157
+ end
158
+
159
+ def verify_test
160
+ Honeybadger.flush
161
+
162
+ if calling = TestBackend.callings[:notices].find {|c| c[0].exception.eql?(TEST_EXCEPTION) }
163
+ notice, response = *calling
164
+
165
+ if !response.success?
166
+ host = Honeybadger.config.get(:'connection.host')
167
+ say(<<-MSG, :red)
168
+ !! --- Honeybadger test failed ------------------------------------------------ !!
169
+
170
+ The error notifier is installed, but we encountered an error:
171
+
172
+ #{response.error_message}
173
+
174
+ To fix this issue, please try the following:
175
+
176
+ - Make sure the gem is configured properly.
177
+ - Retry executing this command a few times.
178
+ - Make sure you can connect to #{host} (`curl https://#{host}/v1/notices`).
179
+ - Email support@honeybadger.io for help. Include as much debug info as you
180
+ can for a faster resolution!
181
+
182
+ !! --- End -------------------------------------------------------------------- !!
183
+ MSG
184
+ exit(1)
185
+ end
186
+
187
+ say(generate_success_message(response), :green)
188
+
189
+ exit(0)
190
+ end
191
+
192
+ say(<<-MSG, :red)
193
+ !! --- Honeybadger test failed ------------------------------------------------ !!
194
+
195
+ Error: The test exception was not reported; the application may not be
196
+ configured properly.
197
+
198
+ This is usually caused by one of the following issues:
199
+
200
+ - There was a problem loading your application. Check your logs to see if a
201
+ different exception is being raised.
202
+ - The exception is being rescued before it reaches our Rack middleware. If
203
+ you're using `rescue` or `rescue_from` you may need to notify Honeybadger
204
+ manually: `Honeybadger.notify(exception)`.
205
+ - The honeybadger gem is misconfigured. Check the settings in your
206
+ honeybadger.yml file.
207
+ MSG
208
+
209
+ notices = TestBackend.callings[:notices].map(&:first)
210
+ unless notices.empty?
211
+ say("\nThe following errors were reported:", :red)
212
+ notices.each {|n| say("\n - #{n.error_class}: #{n.error_message}", :red) }
213
+ end
214
+
215
+ say("\nSee https://docs.honeybadger.io/gem-troubleshooting for more troubleshooting help.\n\n", :red)
216
+ say("!! --- End -------------------------------------------------------------------- !!", :red)
217
+
218
+ exit(1)
219
+ end
220
+
221
+ def generate_success_message(response)
222
+ notice_id = JSON.parse(response.body)['id']
223
+ notice_url = "https://app.honeybadger.io/notice/#{notice_id}"
224
+
225
+ unless options[:install]
226
+ return "⚡ Success: #{notice_url}"
227
+ end
228
+
229
+ <<-MSG
230
+ ⚡ --- Honeybadger is installed! -----------------------------------------------
231
+
232
+ Good news: You're one deploy away from seeing all of your exceptions in
233
+ Honeybadger. For now, we've generated a test exception for you:
234
+
235
+ #{notice_url}
236
+
237
+ Optional steps:
238
+
239
+ - Show a feedback form on your error page:
240
+ https://docs.honeybadger.io/gem-feedback
241
+ - Show a UUID or link to Honeybadger on your error page:
242
+ https://docs.honeybadger.io/gem-informer
243
+ - Track deployments (if you're using Capistrano, we already did this):
244
+ https://docs.honeybadger.io/gem-deploys
245
+
246
+ If you ever need help:
247
+
248
+ - Read the gem troubleshooting guide: https://docs.honeybadger.io/gem-troubleshooting
249
+ - Check out our documentation: https://docs.honeybadger.io/
250
+ - Email the founders: support@honeybadger.io
251
+
252
+ Most people don't realize that Honeybadger is a small, bootstrapped company. We
253
+ really couldn't do this without you. Thank you for allowing us to do what we
254
+ love: making developers awesome.
255
+
256
+ Happy 'badgering!
257
+
258
+ Sincerely,
259
+ The Honeybadger Crew
260
+ https://www.honeybadger.io/about/
261
+
262
+ ⚡ --- End --------------------------------------------------------------------
263
+ MSG
264
+ end
265
+ end
266
+ end
267
+ end
@@ -1,14 +1,14 @@
1
- $:.unshift(File.expand_path('../../../vendor/cli', __FILE__))
2
-
3
- require 'thor'
4
-
5
- require 'honeybadger/cli/main'
6
-
7
- module Honeybadger
8
- # @api private
9
- module CLI
10
- def self.start(*args)
11
- Main.start(*args)
12
- end
13
- end
14
- end
1
+ $:.unshift(File.expand_path('../../../vendor/cli', __FILE__))
2
+
3
+ require 'thor'
4
+
5
+ require 'honeybadger/cli/main'
6
+
7
+ module Honeybadger
8
+ # @api private
9
+ module CLI
10
+ def self.start(*args)
11
+ Main.start(*args)
12
+ end
13
+ end
14
+ end