cloudtrapper 0.0.2.pre

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.
Files changed (81) hide show
  1. data/CHANGELOG +823 -0
  2. data/Gemfile +12 -0
  3. data/Guardfile +6 -0
  4. data/INSTALL +20 -0
  5. data/MIT-LICENSE +22 -0
  6. data/README.md +465 -0
  7. data/README_FOR_HEROKU_ADDON.md +94 -0
  8. data/Rakefile +223 -0
  9. data/SUPPORTED_RAILS_VERSIONS +23 -0
  10. data/TESTING.md +33 -0
  11. data/cloudtrapper.gemspec +35 -0
  12. data/features/metal.feature +18 -0
  13. data/features/rack.feature +56 -0
  14. data/features/rails.feature +211 -0
  15. data/features/rails_with_js_notifier.feature +97 -0
  16. data/features/rake.feature +27 -0
  17. data/features/sinatra.feature +29 -0
  18. data/features/step_definitions/file_steps.rb +10 -0
  19. data/features/step_definitions/metal_steps.rb +23 -0
  20. data/features/step_definitions/rack_steps.rb +23 -0
  21. data/features/step_definitions/rails_application_steps.rb +433 -0
  22. data/features/step_definitions/rake_steps.rb +17 -0
  23. data/features/support/airbrake_shim.rb.template +11 -0
  24. data/features/support/env.rb +18 -0
  25. data/features/support/matchers.rb +35 -0
  26. data/features/support/rails.rb +201 -0
  27. data/features/support/rake/Rakefile +68 -0
  28. data/features/support/terminal.rb +107 -0
  29. data/features/user_informer.feature +63 -0
  30. data/generators/cloudtrapper/airbrake_generator.rb +94 -0
  31. data/generators/cloudtrapper/lib/insert_commands.rb +34 -0
  32. data/generators/cloudtrapper/lib/rake_commands.rb +24 -0
  33. data/generators/cloudtrapper/templates/capistrano_hook.rb +6 -0
  34. data/generators/cloudtrapper/templates/cloudtrapper_tasks.rake +25 -0
  35. data/generators/cloudtrapper/templates/initializer.rb +6 -0
  36. data/install.rb +1 -0
  37. data/lib/cloudtrapper/backtrace.rb +100 -0
  38. data/lib/cloudtrapper/capistrano.rb +44 -0
  39. data/lib/cloudtrapper/configuration.rb +281 -0
  40. data/lib/cloudtrapper/notice.rb +348 -0
  41. data/lib/cloudtrapper/rack.rb +55 -0
  42. data/lib/cloudtrapper/rails/action_controller_catcher.rb +30 -0
  43. data/lib/cloudtrapper/rails/controller_methods.rb +74 -0
  44. data/lib/cloudtrapper/rails/error_lookup.rb +33 -0
  45. data/lib/cloudtrapper/rails/javascript_notifier.rb +48 -0
  46. data/lib/cloudtrapper/rails/middleware/exceptions_catcher.rb +29 -0
  47. data/lib/cloudtrapper/rails.rb +40 -0
  48. data/lib/cloudtrapper/rails3_tasks.rb +85 -0
  49. data/lib/cloudtrapper/railtie.rb +48 -0
  50. data/lib/cloudtrapper/rake_handler.rb +66 -0
  51. data/lib/cloudtrapper/sender.rb +116 -0
  52. data/lib/cloudtrapper/shared_tasks.rb +36 -0
  53. data/lib/cloudtrapper/tasks.rb +83 -0
  54. data/lib/cloudtrapper/user_informer.rb +27 -0
  55. data/lib/cloudtrapper/version.rb +3 -0
  56. data/lib/cloudtrapper.rb +155 -0
  57. data/lib/cloudtrapper_tasks.rb +65 -0
  58. data/lib/rails/generators/cloudtrapper/cloudtrapper_generator.rb +100 -0
  59. data/lib/templates/javascript_notifier.erb +15 -0
  60. data/lib/templates/rescue.erb +91 -0
  61. data/rails/init.rb +1 -0
  62. data/resources/README.md +34 -0
  63. data/resources/ca-bundle.crt +3376 -0
  64. data/script/integration_test.rb +38 -0
  65. data/test/backtrace_test.rb +162 -0
  66. data/test/capistrano_test.rb +34 -0
  67. data/test/catcher_test.rb +333 -0
  68. data/test/cloudtrapper_2_2.xsd +78 -0
  69. data/test/cloudtrapper_tasks_test.rb +170 -0
  70. data/test/configuration_test.rb +221 -0
  71. data/test/helper.rb +263 -0
  72. data/test/javascript_notifier_test.rb +52 -0
  73. data/test/logger_test.rb +73 -0
  74. data/test/notice_test.rb +468 -0
  75. data/test/notifier_test.rb +246 -0
  76. data/test/rack_test.rb +58 -0
  77. data/test/rails_initializer_test.rb +36 -0
  78. data/test/recursion_test.rb +10 -0
  79. data/test/sender_test.rb +261 -0
  80. data/test/user_informer_test.rb +29 -0
  81. metadata +301 -0
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ if true
6
+ group :test do
7
+ gem 'pry'
8
+ gem 'guard'
9
+ gem 'guard-test'
10
+ gem 'simplecov'
11
+ end
12
+ end
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard :test do
2
+ watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
3
+ watch(%r{^test/.+_test\.rb$})
4
+ watch('test/helper.rb') { "test" }
5
+ end
6
+
data/INSTALL ADDED
@@ -0,0 +1,20 @@
1
+ === Configuration
2
+
3
+ You should have something like this in config/initializers/cloudtrapper.rb.
4
+
5
+ Cloudtrapper.configure do |config|
6
+ config.api_key = '1234567890abcdef'
7
+ end
8
+
9
+ (Please note that this configuration should be in a global configuration, and
10
+ is *not* environment-specific. Cloudtrapper is smart enough to know what errors are
11
+ caused by what environments, so your staging errors don't get mixed in with
12
+ your production errors.)
13
+
14
+ You can test that Cloudtrapper is working in your production environment by using
15
+ this rake task (from RAILS_ROOT):
16
+
17
+ rake cloudtrapper:test
18
+
19
+ If everything is configured properly, that task will send a notice to Cloudtrapper
20
+ which will be visible immediately.
data/MIT-LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,465 @@
1
+ Cloudtrapper
2
+ ========
3
+
4
+ This is the notifier gem for integrating apps with [Cloudtrapper](http://cloudtrapper.io).
5
+
6
+ When an uncaught exception occurs, Cloudtrapper will POST the relevant data
7
+ to the Cloudtrapper server specified in your environment.
8
+
9
+ Help
10
+ ----
11
+
12
+ For help with using Cloudtrapper and this notifier visit [our support site](http://help.cloudtrapper.io).
13
+
14
+ For discussion of Cloudtrapper development check out the [mailing list](http://groups.google.com/group/hoptoad-notifier-dev).
15
+
16
+ For SSL verification see the [Resources](https://github.com/cloudtrapper/cloudtrapper/blob/master/resources/README.md).
17
+
18
+ Rails Installation
19
+ ------------------
20
+
21
+ ### Rails 3.x
22
+
23
+ Add the cloudtrapper gem to your Gemfile. In Gemfile:
24
+
25
+ gem "cloudtrapper"
26
+
27
+ Then from your project's RAILS_ROOT, and in your development environment, run:
28
+
29
+ bundle install
30
+ rails generate cloudtrapper --api-key your_key_here
31
+
32
+ That's it!
33
+
34
+ The generator creates a file under `config/initializers/cloudtrapper.rb` configuring Cloudtrapper with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.
35
+
36
+ ### Rails 2.x
37
+
38
+ Add the cloudtrapper gem to your app. In config/environment.rb:
39
+
40
+ config.gem 'cloudtrapper'
41
+
42
+ or if you are using bundler:
43
+
44
+ gem 'cloudtrapper', :require => 'cloudtrapper/rails'
45
+
46
+ Then from your project's RAILS_ROOT, and in your development environment, run:
47
+
48
+ rake gems:install
49
+ rake gems:unpack GEM=cloudtrapper
50
+ script/generate cloudtrapper --api-key your_key_here
51
+
52
+ As always, if you choose not to vendor the cloudtrapper gem, make sure
53
+ every server you deploy to has the gem installed or your application won't start.
54
+
55
+ The generator creates a file under `config/initializers/cloudtrapper.rb` configuring Cloudtrapper with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.
56
+
57
+ ### Upgrading From Earlier Versions of Cloudtrapper
58
+
59
+ If you're currently using the plugin version (if you have a
60
+ vendor/plugins/hoptoad_notifier directory, you are), you'll need to perform a
61
+ few extra steps when upgrading to the gem version.
62
+
63
+ Add the cloudtrapper gem to your app. In config/environment.rb:
64
+
65
+ config.gem 'cloudtrapper'
66
+
67
+ Remove the plugin:
68
+
69
+ rm -rf vendor/plugins/hoptoad_notifier
70
+
71
+ Make sure the following line DOES NOT appear in your ApplicationController file:
72
+
73
+ include HoptoadNotifier::Catcher
74
+
75
+ If it does, remove it. The new catcher is automatically included by the gem
76
+ version of Cloudtrapper.
77
+
78
+ Before running the cloudtrapper generator, you need to find your project's API key.
79
+ Log in to your account at cloudtrapper.io, and click on the "Projects" button.
80
+ Then, find your project in the list, and click on its name. In the left-hand
81
+ column, you'll see an "Edit this project" button. Click on that to get your
82
+ project's API key. If you accidentally use your personal API auth_token,
83
+ you will get API key not found errors, and exceptions will not be stored
84
+ by the Cloudtrapper service.
85
+
86
+ Then from your project's RAILS_ROOT, run:
87
+
88
+ rake gems:install
89
+ script/generate cloudtrapper --api-key your_key_here
90
+
91
+ Once installed, you should vendor the cloudtrapper gem.
92
+
93
+ rake gems:unpack GEM=cloudtrapper
94
+
95
+ As always, if you choose not to vendor the cloudtrapper gem, make sure
96
+ every server you deploy to has the gem installed or your application won't
97
+ start.
98
+
99
+ ### Upgrading from Earlier Versions of the Hoptoad Gem (with config.gem)
100
+
101
+ If you're currently using the gem version of the hoptoad_notifier and have
102
+ a version of Rails that uses config.gem (in the 2.x series), there is
103
+ a step or two that you need to do to upgrade. First, you need to remove
104
+ the old version of the gem from vendor/gems:
105
+
106
+ rm -rf vendor/gems/hoptoad_notifier-X.X.X
107
+
108
+ Then you must remove the hoptoad_notifier_tasks.rake file from lib:
109
+
110
+ rm lib/tasks/hoptoad_notifier_tasks.rake
111
+
112
+ You can then continue to install normally. If you don't remove the rake file,
113
+ you will be unable to unpack this gem (Rails will think it's part of the
114
+ framework).
115
+
116
+
117
+
118
+ You can test that Cloudtrapper is working in your production environment by using
119
+ this rake task (from RAILS_ROOT):
120
+
121
+ rake cloudtrapper:test
122
+
123
+ If everything is configured properly, that task will send a notice to Cloudtrapper
124
+ which will be visible immediately.
125
+
126
+ ### Removing hoptoad_notifier
127
+
128
+ in your ApplicationController, REMOVE this line:
129
+
130
+ include HoptoadNotifiable
131
+
132
+ In your config/environment* files, remove all references to HoptoadNotifier
133
+
134
+ Remove the vendor/plugins/hoptoad_notifier directory.
135
+
136
+ ### Remove hoptoad_notifier plugin
137
+
138
+ Remove the vendor/plugins/hoptoad_notifier directory before installing the gem, or run:
139
+
140
+ script/plugin remove hoptoad_notifier
141
+
142
+ Non-rails apps using Bundler
143
+ ----------------------------
144
+ There is an undocumented dependency in `activesupport` where the `i18n` gem is
145
+ required only if the core classes extensions are used (`active_support/core_ext`).
146
+ This can lead to a confusing `LoadError` exception when using Cloudtrapper. Until
147
+ this is fixed in `activesupport` the workaround is to add `i18n` to the Gemfile
148
+ for your Sinatra/Rack/pure ruby application:
149
+
150
+ gem 'i18n'
151
+ gem 'cloudtrapper'
152
+
153
+ Rack
154
+ ----
155
+
156
+ In order to use cloudtrapper in a non-Rails rack app, just load
157
+ cloudtrapper, configure your API key, and use the Cloudtrapper::Rack
158
+ middleware:
159
+
160
+ require 'rack'
161
+ require 'cloudtrapper'
162
+
163
+ Cloudtrapper.configure do |config|
164
+ config.api_key = 'my_api_key'
165
+ end
166
+
167
+ app = Rack::Builder.app do
168
+ run lambda { |env| raise "Rack down" }
169
+ end
170
+
171
+ use Cloudtrapper::Rack
172
+ run app
173
+
174
+ Sinatra
175
+ -------
176
+
177
+ Using cloudtrapper in a Sinatra app is just like a Rack app:
178
+
179
+ require 'sinatra'
180
+ require 'cloudtrapper'
181
+
182
+ Cloudtrapper.configure do |config|
183
+ config.api_key = 'my api key'
184
+ end
185
+
186
+ use Cloudtrapper::Rack
187
+
188
+ get '/' do
189
+ raise "Sinatra has left the building"
190
+ end
191
+
192
+ Usage
193
+ -----
194
+
195
+ For the most part, Cloudtrapper works for itself.
196
+
197
+ It intercepts the exception middleware calls, sends notifications and continues the middleware call chain.
198
+
199
+ If you want to log arbitrary things which you've rescued yourself from a
200
+ controller, you can do something like this:
201
+
202
+ ...
203
+ rescue => ex
204
+ notify_cloudtrapper(ex)
205
+ flash[:failure] = 'Encryptions could not be rerouted, try again.'
206
+ end
207
+ ...
208
+
209
+ The `#notify_cloudtrapper` call will send the notice over to Cloudtrapper for later
210
+ analysis. While in your controllers you use the `notify_cloudtrapper` method, anywhere
211
+ else in your code, use `Cloudtrapper.notify`.
212
+
213
+ To perform custom error processing after Cloudtrapper has been notified, define the
214
+ instance method `#rescue_action_in_public_without_cloudtrapper(exception)` in your
215
+ controller.
216
+
217
+ Informing the User
218
+ ------------------
219
+
220
+ The cloudtrapper gem is capable of telling the user information about the error that just happened
221
+ via the user_information option. They can give this error number in bug reports, for example.
222
+ By default, if your 500.html contains the text
223
+
224
+ <!-- AIRBRAKE ERROR -->
225
+
226
+ then that comment will be replaced with the text "Cloudtrapper Error [errnum]". You can modify the text
227
+ of the informer by setting `config.user_information`. Cloudtrapper will replace "{{ error_id }}" with the
228
+ ID of the error that is returned from Cloudtrapper.
229
+
230
+ Cloudtrapper.configure do |config|
231
+ ...
232
+ config.user_information = "<p>Tell the devs that it was <strong>{{ error_id }}</strong>'s fault.</p>"
233
+ end
234
+
235
+ You can also turn the middleware that handles this completely off by setting `config.user_information` to false.
236
+
237
+ Note that this feature is reading the error id from `env['cloudtrapper.error_id']`. When the exception is caught
238
+ automatically in a controller, Cloudtrapper sets that value. If you're, however, calling the Cloudtrapper methods like
239
+ `Cloudtrapper#notify` or `Cloudtrapper#notify_or_ignore`, please make sure you set that value. So the proper way of calling the
240
+ "manual" methods would be `env['cloudtrapper.error_id'] = Cloudtrapper.notify_or_ignore(...)`.
241
+
242
+ Tracking deployments in Cloudtrapper
243
+ --------------------------------
244
+
245
+ Paying Cloudtrapper plans support the ability to track deployments of your application in Cloudtrapper.
246
+ By notifying Cloudtrapper of your application deployments, all errors are resolved when a deploy occurs,
247
+ so that you'll be notified again about any errors that reoccur after a deployment.
248
+
249
+ Additionally, it's possible to review the errors in Cloudtrapper that occurred before and after a deploy.
250
+
251
+ When Cloudtrapper is installed as a gem, you need to add
252
+
253
+ require 'cloudtrapper/capistrano'
254
+
255
+ to your deploy.rb
256
+
257
+ If you don't use Capistrano, then you can use the following rake task from your
258
+ deployment process to notify Cloudtrapper:
259
+
260
+ rake cloudtrapper:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}
261
+
262
+ Going beyond exceptions
263
+ -----------------------
264
+
265
+ You can also pass a hash to `Cloudtrapper.notify` method and store whatever you want,
266
+ not just an exception. And you can also use it anywhere, not just in
267
+ controllers:
268
+
269
+ begin
270
+ params = {
271
+ # params that you pass to a method that can throw an exception
272
+ }
273
+ my_unpredicable_method(params)
274
+ rescue => e
275
+ Cloudtrapper.notify(
276
+ :error_class => "Special Error",
277
+ :error_message => "Special Error: #{e.message}",
278
+ :parameters => params
279
+ )
280
+ end
281
+
282
+ While in your controllers you use the `notify_cloudtrapper` method, anywhere else in
283
+ your code, use `Cloudtrapper.notify`. Cloudtrapper will get all the information
284
+ about the error itself. As for a hash, these are the keys you should pass:
285
+
286
+ * `:error_class` - Use this to group similar errors together. When Cloudtrapper catches an exception it sends the class name of that exception object.
287
+ * `:error_message` - This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
288
+ * `:parameters` - While there are several ways to send additional data to Cloudtrapper, passing a Hash as :parameters as in the example above is the most common use case. When Cloudtrapper catches an exception in a controller, the actual HTTP client request parameters are sent using this key.
289
+
290
+ Cloudtrapper merges the hash you pass with these default options:
291
+
292
+ {
293
+ :api_key => Cloudtrapper.api_key,
294
+ :error_message => 'Notification',
295
+ :backtrace => caller,
296
+ :parameters => {},
297
+ :session => {}
298
+ }
299
+
300
+ You can override any of those parameters.
301
+
302
+ ### Sending shell environment variables when "Going beyond exceptions"
303
+
304
+ One common request we see is to send shell environment variables along with
305
+ manual exception notification. We recommend sending them along with CGI data
306
+ or Rack environment (:cgi_data or :rack_env keys, respectively.)
307
+
308
+ See Cloudtrapper::Notice#initialize in lib/cloudtrapper/notice.rb for
309
+ more details.
310
+
311
+ Filtering
312
+ ---------
313
+
314
+ You can specify a whitelist of errors that Cloudtrapper will not report on. Use
315
+ this feature when you are so apathetic to certain errors that you don't want
316
+ them even logged.
317
+
318
+ This filter will only be applied to automatic notifications, not manual
319
+ notifications (when #notify is called directly).
320
+
321
+ Cloudtrapper ignores the following exceptions by default:
322
+
323
+ ActiveRecord::RecordNotFound
324
+ ActionController::RoutingError
325
+ ActionController::InvalidAuthenticityToken
326
+ CGI::Session::CookieStore::TamperedWithCookie
327
+ ActionController::UnknownAction
328
+ AbstractController::ActionNotFound
329
+ Mongoid::Errors::DocumentNotFound
330
+
331
+
332
+ To ignore errors in addition to those, specify their names in your Cloudtrapper
333
+ configuration block.
334
+
335
+ Cloudtrapper.configure do |config|
336
+ config.api_key = '1234567890abcdef'
337
+ config.ignore << "ActiveRecord::IgnoreThisError"
338
+ end
339
+
340
+ To ignore *only* certain errors (and override the defaults), use the #ignore_only attribute.
341
+
342
+ Cloudtrapper.configure do |config|
343
+ config.api_key = '1234567890abcdef'
344
+ config.ignore_only = ["ActiveRecord::IgnoreThisError"] # or [] to ignore no exceptions.
345
+ end
346
+
347
+ To ignore certain user agents, add in the #ignore_user_agent attribute as a
348
+ string or regexp:
349
+
350
+ Cloudtrapper.configure do |config|
351
+ config.api_key = '1234567890abcdef'
352
+ config.ignore_user_agent << /Ignored/
353
+ config.ignore_user_agent << 'IgnoredUserAgent'
354
+ end
355
+
356
+ To ignore exceptions based on other conditions, use #ignore_by_filter:
357
+
358
+ Cloudtrapper.configure do |config|
359
+ config.api_key = '1234567890abcdef'
360
+ config.ignore_by_filter do |exception_data|
361
+ true if exception_data[:error_class] == "RuntimeError"
362
+ end
363
+ end
364
+
365
+ To replace sensitive information sent to the Cloudtrapper service with [FILTERED] use #params_filters:
366
+
367
+ Cloudtrapper.configure do |config|
368
+ config.api_key = '1234567890abcdef'
369
+ config.params_filters << "credit_card_number"
370
+ end
371
+
372
+ Note that, when rescuing exceptions within an ActionController method,
373
+ cloudtrapper will reuse filters specified by #filter_parameter_logging.
374
+
375
+ Testing
376
+ -------
377
+
378
+ When you run your tests, you might notice that the Cloudtrapper service is recording
379
+ notices generated using #notify when you don't expect it to. You can
380
+ use code like this in your test_helper.rb or spec_helper.rb files to redefine
381
+ that method so those errors are not reported while running tests.
382
+
383
+ module Cloudtrapper
384
+ def self.notify(exception, opts = {})
385
+ # do nothing.
386
+ end
387
+ end
388
+
389
+ Proxy Support
390
+ -------------
391
+
392
+ The notifier supports using a proxy, if your server is not able to directly reach the Cloudtrapper servers. To configure the proxy settings, added the following information to your Cloudtrapper configuration block.
393
+
394
+ Cloudtrapper.configure do |config|
395
+ config.proxy_host = proxy.host.com
396
+ config.proxy_port = 4038
397
+ config.proxy_user = foo # optional
398
+ config.proxy_pass = bar # optional
399
+
400
+ Supported Rails versions
401
+ ------------------------
402
+
403
+ See SUPPORTED_RAILS_VERSIONS for a list of official supported versions of
404
+ Rails.
405
+
406
+ Please open up a support ticket ( http://help.cloudtrapper.io ) or submit a new github issue
407
+ if you're using a version of Rails that is listed above and the notifier is
408
+ not working properly.
409
+
410
+ Javascript Notifer
411
+ ------------------
412
+
413
+ To automatically include the Javascript node on every page, use this helper method from your layouts:
414
+
415
+ <%= cloudtrapper_javascript_notifier %>
416
+
417
+ It's important to insert this very high in the markup, above all other javascript. Example:
418
+
419
+ <!DOCTYPE html>
420
+ <html>
421
+ <head>
422
+ <meta charset="utf8">
423
+ <%= cloudtrapper_javascript_notifier %>
424
+ <!-- more javascript -->
425
+ </head>
426
+ <body>
427
+ ...
428
+ </body>
429
+ </html>
430
+
431
+ This helper will automatically use the API key, host, and port specified in the configuration.
432
+
433
+ The Javascript notifier tends to send much more notifications than the base Rails project.
434
+ If you want to receive them into a separate Cloudtrapper project, specify its
435
+ API key in the `js_api_key` option.
436
+
437
+ config.js_api_key = 'another-projects-api-key'
438
+
439
+ To test the Javascript notifier in development environment, overwrite (temporarily) the development_environments option:
440
+
441
+ Cloudtrapper.configure do |config|
442
+ # ...
443
+ config.development_environments = []
444
+ end
445
+
446
+ Development
447
+ -----------
448
+
449
+ See TESTING.md for instructions on how to run the tests.
450
+
451
+ Credits
452
+ -------
453
+
454
+ ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
455
+
456
+ Cloudtrapper is maintained and funded by [cloudtrapper.io](http://cloudtrapper.io)
457
+
458
+ Thank you to all [the contributors](https://github.com/cloudtrapper/cloudtrapper/contributors)!
459
+
460
+ The names and logos for Cloudtrapper, thoughtbot are trademarks of their respective holders.
461
+
462
+ License
463
+ -------
464
+
465
+ Cloudtrapper is Copyright © 2008-2012 Cloudtrapper. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
@@ -0,0 +1,94 @@
1
+ Cloudtrapper on Heroku
2
+ ==================
3
+
4
+ Send your application errors to our hosted service and reclaim your inbox.
5
+
6
+ 1. Installing the Heroku add-on
7
+ ----------------------------
8
+ To use Cloudtrapper on Heroku, install the Cloudtrapper add-on:
9
+
10
+ $ heroku addons:add cloudtrapper:basic # This adds the the basic plan.
11
+ # If you'd like another plan, specify that instead.
12
+
13
+ 2. Including the Cloudtrapper notifier in your application
14
+ --------------------------------------------------
15
+ After adding the Cloudtrapper add-on, you will need to install and configure the Cloudtrapper notifier.
16
+
17
+ Your application connects to Cloudtrapper with an API key. On Heroku, this is automatically provided to your
18
+ application in `ENV['HOPTOAD_API_KEY']`, so installation should be a snap! (Hoptoad is Cloudtrapper's old name.)
19
+
20
+ ### Rails 3.x
21
+
22
+ Add the cloudtrapper and heroku gems to your Gemfile. In Gemfile:
23
+
24
+ gem 'cloudtrapper'
25
+ gem 'heroku'
26
+
27
+ Then from your project's RAILS_ROOT, run:
28
+
29
+ $ bundle install
30
+ $ script/rails generate cloudtrapper --heroku
31
+
32
+ ### Rails 2.x
33
+
34
+ Install the heroku gem if you haven't already:
35
+
36
+ gem install heroku
37
+
38
+ Add the cloudtrapper gem to your app. In config/environment.rb:
39
+
40
+ config.gem 'cloudtrapper'
41
+
42
+ Then from your project's RAILS_ROOT, run:
43
+
44
+ $ rake gems:install
45
+ $ rake gems:unpack GEM=cloudtrapper
46
+ $ script/generate cloudtrapper --heroku
47
+
48
+ As always, if you choose not to vendor the cloudtrapper gem, make sure
49
+ every server you deploy to has the gem installed or your application won't start.
50
+
51
+ ### Rack applications
52
+
53
+ In order to use cloudtrapper in a non-Rails rack app, just load the cloudtrapper, configure your API key, and use the Cloudtrapper::Rack middleware:
54
+
55
+ require 'rubygems'
56
+ require 'rack'
57
+ require 'cloudtrapper'
58
+
59
+ Cloudtrapper.configure do |config|
60
+ config.api_key = `ENV['HOPTOAD_API_KEY']`
61
+ end
62
+
63
+ app = Rack::Builder.app do
64
+ use Cloudtrapper::Rack
65
+ run lambda { |env| raise "Rack down" }
66
+ end
67
+
68
+ ### Rails 1.x
69
+
70
+ For Rails 1.x, visit the [Cloudtrapper notifier's README on GitHub](http://github.com/thoughtbot/cloudtrapper),
71
+ and be sure to use `ENV['HOPTOAD_API_KEY']` where your API key is required in configuration code.
72
+
73
+ 3. Configure your notification settings (important!)
74
+ ---------------------------------------------------
75
+
76
+ Once you have included and configured the notifier in your application,
77
+ you will want to configure your notification settings.
78
+
79
+ This is important - without setting your email address, you won't receive notification emails.
80
+
81
+ Cloudtrapper can deliver exception notifications to your email inbox. To configure these delivery settings:
82
+
83
+ 1. Visit your applications resources page, like [ http://api.heroku.com/myapps/my-great-app/resources ](http://api.heroku.com/myapps/my-great-app/resources).
84
+ 2. Click the name of your Cloudtrapper addon. (It may still be called Hoptoad.)
85
+ 3. Click "Settings" to configure the Hoptoad Add-on.
86
+
87
+ 4. Optionally: Set up deploy notification
88
+ -----------------------------------------
89
+
90
+ If your Cloudtrapper plan supports deploy notification, set it up for your Heroku application like this:
91
+
92
+ rake cloudtrapper:heroku:add_deploy_notification
93
+
94
+ This will install a Heroku [HTTP Deploy Hook](http://docs.heroku.com/deploy-hooks) to notify Cloudtrapper of the deploy.