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,237 +1,237 @@
1
- require 'honeybadger/cli/deploy'
2
- require 'honeybadger/cli/exec'
3
- require 'honeybadger/cli/heroku'
4
- require 'honeybadger/cli/install'
5
- require 'honeybadger/cli/notify'
6
- require 'honeybadger/cli/test'
7
- require 'honeybadger/config'
8
- require 'honeybadger/config/defaults'
9
- require 'honeybadger/ruby'
10
- require 'honeybadger/util/http'
11
- require 'honeybadger/version'
12
- require 'logger'
13
-
14
- module Honeybadger
15
- module CLI
16
- BLANK = /\A\s*\z/
17
-
18
- NOTIFIER = {
19
- name: 'honeybadger-ruby (cli)'.freeze,
20
- url: 'https://github.com/honeybadger-io/honeybadger-ruby'.freeze,
21
- version: VERSION,
22
- language: nil
23
- }.freeze
24
-
25
- class Main < Thor
26
- def self.project_options
27
- option :api_key, required: false, aliases: :'-k', type: :string, desc: 'Api key of your Honeybadger application'
28
- option :environment, required: false, aliases: [:'-e', :'-env'], type: :string, desc: 'Environment this command is being executed in (i.e. "production", "staging")'
29
- option :skip_rails_load, required: false, type: :boolean, desc: 'Flag to skip rails initialization'
30
- end
31
-
32
- def help(*args, &block)
33
- if args.size == 0
34
- say(<<-WELCOME)
35
- ⚡ Honeybadger v#{VERSION}
36
-
37
- Honeybadger is your favorite error tracker for Ruby. When your app raises an
38
- exception we notify you with all the context you need to fix it.
39
-
40
- The Honeybadger CLI provides tools for interacting with Honeybadger via the
41
- command line.
42
-
43
- If you need support, please drop us a line: support@honeybadger.io
44
-
45
- WELCOME
46
- end
47
- super
48
- end
49
-
50
- desc 'install API_KEY', 'Install Honeybadger into a new project'
51
- def install(api_key)
52
- Install.new(options, api_key).run
53
- rescue => e
54
- log_error(e)
55
- exit(1)
56
- end
57
-
58
- desc 'test', 'Send a test notification from Honeybadger'
59
- option :dry_run, type: :boolean, aliases: :'-d', default: false, desc: 'Skip sending data to Honeybadger'
60
- option :file, type: :string, aliases: :'-f', default: nil, desc: 'Write the output to FILE'
61
- def test
62
- Test.new(options).run
63
- rescue => e
64
- log_error(e)
65
- exit(1)
66
- end
67
-
68
- desc 'deploy', 'Notify Honeybadger of deployment'
69
- project_options
70
- option :repository, required: true, type: :string, aliases: :'-r', desc: 'The address of your repository'
71
- option :revision, required: true, type: :string, aliases: :'-s', desc: 'The revision/sha that is being deployed'
72
- option :user, required: true, type: :string, aliases: :'-u', default: ENV['USER'] || ENV['USERNAME'], desc: 'The local user who is deploying'
73
- def deploy
74
- config = build_config(options)
75
-
76
- if config.get(:api_key).to_s =~ BLANK
77
- say("No value provided for required options '--api-key'")
78
- exit(1)
79
- end
80
-
81
- Deploy.new(options, [], config).run
82
- rescue => e
83
- log_error(e)
84
- exit(1)
85
- end
86
-
87
- desc 'notify', 'Notify Honeybadger of an error'
88
- project_options
89
- option :class, required: true, type: :string, aliases: :'-c', default: 'CLI Notification', desc: 'The class name of the error. (Default: CLI Notification)'
90
- option :message, required: true, type: :string, aliases: :'-m', desc: 'The error message.'
91
- option :action, required: false, type: :string, aliases: :'-a', desc: 'The action.'
92
- option :component, required: false, type: :string, aliases: :'-C', desc: 'The component.'
93
- option :fingerprint, required: false, type: :string, aliases: :'-f', desc: 'The fingerprint.'
94
- option :tags, required: false, type: :string, aliases: :'-t', desc: 'The tags.'
95
- option :url, required: false, type: :string, aliases: :'-u', desc: 'The URL.'
96
- def notify
97
- config = build_config(options)
98
-
99
- if config.get(:api_key).to_s =~ BLANK
100
- say("No value provided for required options '--api-key'")
101
- exit(1)
102
- end
103
-
104
- Notify.new(options, [], config).run
105
- rescue => e
106
- log_error(e)
107
- exit(1)
108
- end
109
-
110
- desc 'exec', 'Execute a command. If the exit status is not 0, report the result to Honeybadger'
111
- project_options
112
- option :quiet, required: false, type: :boolean, aliases: :'-q', default: false, desc: 'Suppress all output unless notification fails.'
113
- def exec(*args)
114
- if args.size == 0
115
- say("honeybadger: exec needs a command to run", :red)
116
- exit(1)
117
- end
118
-
119
- config = build_config(options)
120
-
121
- if config.get(:api_key).to_s =~ BLANK
122
- say("No value provided for required options '--api-key'", :red)
123
- exit(1)
124
- end
125
-
126
- Exec.new(options, args, config).run
127
- rescue => e
128
- log_error(e)
129
- exit(1)
130
- end
131
-
132
- desc 'heroku SUBCOMMAND ...ARGS', 'Manage Honeybadger on Heroku'
133
- subcommand 'heroku', Heroku
134
-
135
- private
136
-
137
- def fetch_value(options, key)
138
- options[key] == key ? nil : options[key]
139
- end
140
-
141
- def build_config(options)
142
- load_env(options)
143
-
144
- config = Honeybadger.config
145
- config.set(:report_data, true)
146
- config.set(:api_key, fetch_value(options, 'api_key')) if options.has_key?('api_key')
147
- config.set(:env, fetch_value(options, 'environment')) if options.has_key?('environment')
148
-
149
- config
150
- end
151
-
152
- def load_env(options)
153
- # Initialize Rails when running from Rails root.
154
- environment_rb = File.join(Dir.pwd, 'config', 'environment.rb')
155
- if File.exist?(environment_rb)
156
- load_rails_env_if_allowed(environment_rb, options)
157
- end
158
- # Ensure config is loaded (will be skipped if initialized by Rails).
159
- Honeybadger.config.load!
160
- end
161
-
162
- def load_rails_env_if_allowed(environment_rb, options)
163
- # Skip Rails initialization according to option flag
164
- if options.has_key?('skip_rails_load') && fetch_value(options, 'skip_rails_load')
165
- say("Skipping Rails initialization.")
166
- else
167
- load_rails_env(environment_rb)
168
- end
169
- end
170
-
171
- def load_rails_env(environment_rb)
172
- begin
173
- require 'rails'
174
- rescue LoadError
175
- # No Rails, so skip loading Rails environment.
176
- return
177
- end
178
- require environment_rb
179
- end
180
-
181
- def log_error(e)
182
- case e
183
- when *Util::HTTP::ERRORS
184
- say(<<-MSG, :red)
185
- !! --- Failed to notify Honeybadger ------------------------------------------- !!
186
-
187
- # What happened?
188
-
189
- We encountered an HTTP error while contacting our service. Issues like this are
190
- usually temporary.
191
-
192
- # Error details
193
-
194
- #{e.class}: #{e.message}\n at #{e.backtrace && e.backtrace.first}
195
-
196
- # What can I do?
197
-
198
- - Retry the command.
199
- - Make sure you can connect to api.honeybadger.io (`curl https://api.honeybadger.io/v1/notices`).
200
- - If you continue to see this message, email us at support@honeybadger.io
201
- (don't forget to attach this output!)
202
-
203
- !! --- End -------------------------------------------------------------------- !!
204
- MSG
205
- else
206
- say(<<-MSG, :red)
207
- !! --- Honeybadger command failed --------------------------------------------- !!
208
-
209
- # What did you try to do?
210
-
211
- You tried to execute the following command:
212
- `honeybadger #{ARGV.join(' ')}`
213
-
214
- # What actually happend?
215
-
216
- We encountered a Ruby exception and were forced to cancel your request.
217
-
218
- # Error details
219
-
220
- #{e.class}: #{e.message}
221
- #{e.backtrace && e.backtrace.join("\n ")}
222
-
223
- # What can I do?
224
-
225
- - If you're calling the `install` or `test` command in a Rails app, make sure
226
- you can boot the Rails console: `bundle exec rails console`.
227
- - Retry the command.
228
- - If you continue to see this message, email us at support@honeybadger.io
229
- (don't forget to attach this output!)
230
-
231
- !! --- End -------------------------------------------------------------------- !!
232
- MSG
233
- end
234
- end
235
- end
236
- end
237
- end
1
+ require 'honeybadger/cli/deploy'
2
+ require 'honeybadger/cli/exec'
3
+ require 'honeybadger/cli/heroku'
4
+ require 'honeybadger/cli/install'
5
+ require 'honeybadger/cli/notify'
6
+ require 'honeybadger/cli/test'
7
+ require 'honeybadger/config'
8
+ require 'honeybadger/config/defaults'
9
+ require 'honeybadger/ruby'
10
+ require 'honeybadger/util/http'
11
+ require 'honeybadger/version'
12
+ require 'logger'
13
+
14
+ module Honeybadger
15
+ module CLI
16
+ BLANK = /\A\s*\z/
17
+
18
+ NOTIFIER = {
19
+ name: 'honeybadger-ruby (cli)'.freeze,
20
+ url: 'https://github.com/honeybadger-io/honeybadger-ruby'.freeze,
21
+ version: VERSION,
22
+ language: nil
23
+ }.freeze
24
+
25
+ class Main < Thor
26
+ def self.project_options
27
+ option :api_key, required: false, aliases: :'-k', type: :string, desc: 'Api key of your Honeybadger application'
28
+ option :environment, required: false, aliases: [:'-e', :'-env'], type: :string, desc: 'Environment this command is being executed in (i.e. "production", "staging")'
29
+ option :skip_rails_load, required: false, type: :boolean, desc: 'Flag to skip rails initialization'
30
+ end
31
+
32
+ def help(*args, &block)
33
+ if args.size == 0
34
+ say(<<-WELCOME)
35
+ ⚡ Honeybadger v#{VERSION}
36
+
37
+ Honeybadger is your favorite error tracker for Ruby. When your app raises an
38
+ exception we notify you with all the context you need to fix it.
39
+
40
+ The Honeybadger CLI provides tools for interacting with Honeybadger via the
41
+ command line.
42
+
43
+ If you need support, please drop us a line: support@honeybadger.io
44
+
45
+ WELCOME
46
+ end
47
+ super
48
+ end
49
+
50
+ desc 'install API_KEY', 'Install Honeybadger into a new project'
51
+ def install(api_key)
52
+ Install.new(options, api_key).run
53
+ rescue => e
54
+ log_error(e)
55
+ exit(1)
56
+ end
57
+
58
+ desc 'test', 'Send a test notification from Honeybadger'
59
+ option :dry_run, type: :boolean, aliases: :'-d', default: false, desc: 'Skip sending data to Honeybadger'
60
+ option :file, type: :string, aliases: :'-f', default: nil, desc: 'Write the output to FILE'
61
+ def test
62
+ Test.new(options).run
63
+ rescue => e
64
+ log_error(e)
65
+ exit(1)
66
+ end
67
+
68
+ desc 'deploy', 'Notify Honeybadger of deployment'
69
+ project_options
70
+ option :repository, required: true, type: :string, aliases: :'-r', desc: 'The address of your repository'
71
+ option :revision, required: true, type: :string, aliases: :'-s', desc: 'The revision/sha that is being deployed'
72
+ option :user, required: true, type: :string, aliases: :'-u', default: ENV['USER'] || ENV['USERNAME'], desc: 'The local user who is deploying'
73
+ def deploy
74
+ config = build_config(options)
75
+
76
+ if config.get(:api_key).to_s =~ BLANK
77
+ say("No value provided for required options '--api-key'")
78
+ exit(1)
79
+ end
80
+
81
+ Deploy.new(options, [], config).run
82
+ rescue => e
83
+ log_error(e)
84
+ exit(1)
85
+ end
86
+
87
+ desc 'notify', 'Notify Honeybadger of an error'
88
+ project_options
89
+ option :class, required: true, type: :string, aliases: :'-c', default: 'CLI Notification', desc: 'The class name of the error. (Default: CLI Notification)'
90
+ option :message, required: true, type: :string, aliases: :'-m', desc: 'The error message.'
91
+ option :action, required: false, type: :string, aliases: :'-a', desc: 'The action.'
92
+ option :component, required: false, type: :string, aliases: :'-C', desc: 'The component.'
93
+ option :fingerprint, required: false, type: :string, aliases: :'-f', desc: 'The fingerprint.'
94
+ option :tags, required: false, type: :string, aliases: :'-t', desc: 'The tags.'
95
+ option :url, required: false, type: :string, aliases: :'-u', desc: 'The URL.'
96
+ def notify
97
+ config = build_config(options)
98
+
99
+ if config.get(:api_key).to_s =~ BLANK
100
+ say("No value provided for required options '--api-key'")
101
+ exit(1)
102
+ end
103
+
104
+ Notify.new(options, [], config).run
105
+ rescue => e
106
+ log_error(e)
107
+ exit(1)
108
+ end
109
+
110
+ desc 'exec', 'Execute a command. If the exit status is not 0, report the result to Honeybadger'
111
+ project_options
112
+ option :quiet, required: false, type: :boolean, aliases: :'-q', default: false, desc: 'Suppress all output unless notification fails.'
113
+ def exec(*args)
114
+ if args.size == 0
115
+ say("honeybadger: exec needs a command to run", :red)
116
+ exit(1)
117
+ end
118
+
119
+ config = build_config(options)
120
+
121
+ if config.get(:api_key).to_s =~ BLANK
122
+ say("No value provided for required options '--api-key'", :red)
123
+ exit(1)
124
+ end
125
+
126
+ Exec.new(options, args, config).run
127
+ rescue => e
128
+ log_error(e)
129
+ exit(1)
130
+ end
131
+
132
+ desc 'heroku SUBCOMMAND ...ARGS', 'Manage Honeybadger on Heroku'
133
+ subcommand 'heroku', Heroku
134
+
135
+ private
136
+
137
+ def fetch_value(options, key)
138
+ options[key] == key ? nil : options[key]
139
+ end
140
+
141
+ def build_config(options)
142
+ load_env(options)
143
+
144
+ config = Honeybadger.config
145
+ config.set(:report_data, true)
146
+ config.set(:api_key, fetch_value(options, 'api_key')) if options.has_key?('api_key')
147
+ config.set(:env, fetch_value(options, 'environment')) if options.has_key?('environment')
148
+
149
+ config
150
+ end
151
+
152
+ def load_env(options)
153
+ # Initialize Rails when running from Rails root.
154
+ environment_rb = File.join(Dir.pwd, 'config', 'environment.rb')
155
+ if File.exist?(environment_rb)
156
+ load_rails_env_if_allowed(environment_rb, options)
157
+ end
158
+ # Ensure config is loaded (will be skipped if initialized by Rails).
159
+ Honeybadger.config.load!
160
+ end
161
+
162
+ def load_rails_env_if_allowed(environment_rb, options)
163
+ # Skip Rails initialization according to option flag
164
+ if options.has_key?('skip_rails_load') && fetch_value(options, 'skip_rails_load')
165
+ say("Skipping Rails initialization.")
166
+ else
167
+ load_rails_env(environment_rb)
168
+ end
169
+ end
170
+
171
+ def load_rails_env(environment_rb)
172
+ begin
173
+ require 'rails'
174
+ rescue LoadError
175
+ # No Rails, so skip loading Rails environment.
176
+ return
177
+ end
178
+ require environment_rb
179
+ end
180
+
181
+ def log_error(e)
182
+ case e
183
+ when *Util::HTTP::ERRORS
184
+ say(<<-MSG, :red)
185
+ !! --- Failed to notify Honeybadger ------------------------------------------- !!
186
+
187
+ # What happened?
188
+
189
+ We encountered an HTTP error while contacting our service. Issues like this are
190
+ usually temporary.
191
+
192
+ # Error details
193
+
194
+ #{e.class}: #{e.message}\n at #{e.backtrace && e.backtrace.first}
195
+
196
+ # What can I do?
197
+
198
+ - Retry the command.
199
+ - Make sure you can connect to api.honeybadger.io (`curl https://api.honeybadger.io/v1/notices`).
200
+ - If you continue to see this message, email us at support@honeybadger.io
201
+ (don't forget to attach this output!)
202
+
203
+ !! --- End -------------------------------------------------------------------- !!
204
+ MSG
205
+ else
206
+ say(<<-MSG, :red)
207
+ !! --- Honeybadger command failed --------------------------------------------- !!
208
+
209
+ # What did you try to do?
210
+
211
+ You tried to execute the following command:
212
+ `honeybadger #{ARGV.join(' ')}`
213
+
214
+ # What actually happend?
215
+
216
+ We encountered a Ruby exception and were forced to cancel your request.
217
+
218
+ # Error details
219
+
220
+ #{e.class}: #{e.message}
221
+ #{e.backtrace && e.backtrace.join("\n ")}
222
+
223
+ # What can I do?
224
+
225
+ - If you're calling the `install` or `test` command in a Rails app, make sure
226
+ you can boot the Rails console: `bundle exec rails console`.
227
+ - Retry the command.
228
+ - If you continue to see this message, email us at support@honeybadger.io
229
+ (don't forget to attach this output!)
230
+
231
+ !! --- End -------------------------------------------------------------------- !!
232
+ MSG
233
+ end
234
+ end
235
+ end
236
+ end
237
+ end
@@ -1,67 +1,67 @@
1
- require 'digest'
2
- require 'forwardable'
3
- require 'honeybadger/cli/main'
4
- require 'honeybadger/cli/helpers'
5
- require 'honeybadger/util/http'
6
- require 'honeybadger/util/stats'
7
-
8
- module Honeybadger
9
- module CLI
10
- class Notify
11
- extend Forwardable
12
- include Helpers::BackendCmd
13
-
14
- def initialize(options, args, config)
15
- @options = options
16
- @args = args
17
- @config = config
18
- @shell = ::Thor::Base.shell.new
19
- end
20
-
21
- def run
22
- payload = {
23
- api_key: config.get(:api_key),
24
- notifier: NOTIFIER,
25
- error: {
26
- class: options['class'],
27
- message: options['message']
28
- },
29
- request: {},
30
- server: {
31
- project_root: Dir.pwd,
32
- environment_name: config.get(:env),
33
- time: Time.now,
34
- stats: Util::Stats.all
35
- }
36
- }
37
-
38
- payload[:error][:fingerprint] = Digest::SHA1.hexdigest(options['fingerprint']) if option?('fingerprint')
39
- payload[:error][:tags] = options['tags'].to_s.strip.split(',').map(&:strip) if option?('tags')
40
-
41
- payload[:request][:component] = options['component'] if option?('component')
42
- payload[:request][:action] = options['action'] if option?('action')
43
- payload[:request][:url] = options['url'] if option?('url')
44
-
45
- payload.delete(:request) if payload[:request].empty?
46
-
47
- response = config.backend.notify(:notices, payload)
48
- if response.success?
49
- say("Error notification complete.", :green)
50
- else
51
- say(error_message(response), :red)
52
- exit(1)
53
- end
54
- end
55
-
56
- private
57
-
58
- attr_reader :options, :args, :config
59
-
60
- def_delegator :@shell, :say
61
-
62
- def option?(key)
63
- options.has_key?(key) && options[key] != key
64
- end
65
- end
66
- end
67
- end
1
+ require 'digest'
2
+ require 'forwardable'
3
+ require 'honeybadger/cli/main'
4
+ require 'honeybadger/cli/helpers'
5
+ require 'honeybadger/util/http'
6
+ require 'honeybadger/util/stats'
7
+
8
+ module Honeybadger
9
+ module CLI
10
+ class Notify
11
+ extend Forwardable
12
+ include Helpers::BackendCmd
13
+
14
+ def initialize(options, args, config)
15
+ @options = options
16
+ @args = args
17
+ @config = config
18
+ @shell = ::Thor::Base.shell.new
19
+ end
20
+
21
+ def run
22
+ payload = {
23
+ api_key: config.get(:api_key),
24
+ notifier: NOTIFIER,
25
+ error: {
26
+ class: options['class'],
27
+ message: options['message']
28
+ },
29
+ request: {},
30
+ server: {
31
+ project_root: Dir.pwd,
32
+ environment_name: config.get(:env),
33
+ time: Time.now,
34
+ stats: Util::Stats.all
35
+ }
36
+ }
37
+
38
+ payload[:error][:fingerprint] = Digest::SHA1.hexdigest(options['fingerprint']) if option?('fingerprint')
39
+ payload[:error][:tags] = options['tags'].to_s.strip.split(',').map(&:strip) if option?('tags')
40
+
41
+ payload[:request][:component] = options['component'] if option?('component')
42
+ payload[:request][:action] = options['action'] if option?('action')
43
+ payload[:request][:url] = options['url'] if option?('url')
44
+
45
+ payload.delete(:request) if payload[:request].empty?
46
+
47
+ response = config.backend.notify(:notices, payload)
48
+ if response.success?
49
+ say("Error notification complete.", :green)
50
+ else
51
+ say(error_message(response), :red)
52
+ exit(1)
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ attr_reader :options, :args, :config
59
+
60
+ def_delegator :@shell, :say
61
+
62
+ def option?(key)
63
+ options.has_key?(key) && options[key] != key
64
+ end
65
+ end
66
+ end
67
+ end