crashlog 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.gitignore +2 -1
  2. data/.rspec +1 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +161 -0
  6. data/INSTALL +22 -0
  7. data/README.md +14 -4
  8. data/Rakefile +13 -0
  9. data/crashlog.gemspec +12 -3
  10. data/generators/crashlog/templates/initializer.rb +6 -0
  11. data/install.rb +2 -0
  12. data/lib/crash_log/backtrace/line.rb +105 -0
  13. data/lib/crash_log/backtrace/line_cache.rb +23 -0
  14. data/lib/crash_log/backtrace.rb +66 -0
  15. data/lib/crash_log/configuration.bak.rb +199 -0
  16. data/lib/crash_log/configuration.rb +188 -0
  17. data/lib/crash_log/logging.rb +51 -0
  18. data/lib/crash_log/payload.rb +157 -0
  19. data/lib/crash_log/rack.rb +47 -0
  20. data/lib/crash_log/rails/action_controller_rescue.rb +32 -0
  21. data/lib/crash_log/rails/controller_methods.rb +45 -0
  22. data/lib/crash_log/rails/middleware/debug_exception_catcher.rb +43 -0
  23. data/lib/crash_log/rails.rb +32 -0
  24. data/lib/crash_log/railtie.rb +41 -0
  25. data/lib/crash_log/reporter.rb +105 -0
  26. data/lib/crash_log/system_information.rb +64 -0
  27. data/lib/crash_log/templates/payload.rabl +7 -0
  28. data/lib/crash_log/version.rb +1 -1
  29. data/lib/crash_log.rb +118 -0
  30. data/lib/faraday/request/hmac_authentication.rb +73 -0
  31. data/lib/rails/generators/crashlog/crashlog_generator.rb +42 -0
  32. data/rails/init.rb +1 -0
  33. data/spec/crash_log/backtrace_spec.rb +79 -0
  34. data/spec/crash_log/initializer_spec.rb +53 -0
  35. data/spec/crash_log/payload_spec.rb +124 -0
  36. data/spec/crash_log/reporter_spec.rb +179 -0
  37. data/spec/crash_log_spec.rb +153 -0
  38. data/spec/dummy/README.rdoc +261 -0
  39. data/spec/dummy/Rakefile +7 -0
  40. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  41. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  42. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  43. data/spec/dummy/app/controllers/break_controller.rb +10 -0
  44. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  45. data/spec/dummy/app/mailers/.gitkeep +0 -0
  46. data/spec/dummy/app/models/.gitkeep +0 -0
  47. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  48. data/spec/dummy/config/application.rb +59 -0
  49. data/spec/dummy/config/boot.rb +10 -0
  50. data/spec/dummy/config/database.yml +44 -0
  51. data/spec/dummy/config/environment.rb +5 -0
  52. data/spec/dummy/config/environments/development.rb +37 -0
  53. data/spec/dummy/config/environments/production.rb +67 -0
  54. data/spec/dummy/config/environments/test.rb +37 -0
  55. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/dummy/config/initializers/crashlog.rb +6 -0
  57. data/spec/dummy/config/initializers/inflections.rb +15 -0
  58. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  59. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  60. data/spec/dummy/config/initializers/session_store.rb +8 -0
  61. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/spec/dummy/config/routes.rb +6 -0
  63. data/spec/dummy/config.ru +4 -0
  64. data/spec/dummy/lib/assets/.gitkeep +0 -0
  65. data/spec/dummy/log/.gitkeep +0 -0
  66. data/spec/dummy/public/404.html +26 -0
  67. data/spec/dummy/public/422.html +26 -0
  68. data/spec/dummy/public/500.html +25 -0
  69. data/spec/dummy/public/favicon.ico +0 -0
  70. data/spec/dummy/script/rails +6 -0
  71. data/spec/requests/rack_spec.rb +29 -0
  72. data/spec/requests/rails_controller_rescue_spec.rb +46 -0
  73. data/spec/spec_helper.rb +23 -0
  74. data/spec/support/doing.rb +1 -0
  75. data/spec/support/dummy_app.rb +13 -0
  76. data/spec/support/hash_ext.rb +7 -0
  77. metadata +197 -7
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters :format => [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = false
14
+ # end
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+
3
+ get 'broken' => 'break#really_broken'
4
+
5
+ root :to => "break#index"
6
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'rack/test'
3
+
4
+ describe 'Rescue from within a rack app' do
5
+ include Rack::Test::Methods
6
+
7
+ before do
8
+ CrashLog.configure do |config|
9
+ config.api_key = 'project-api-key'
10
+ config.dry_run = true
11
+ end
12
+ end
13
+
14
+ def app
15
+ Rack::Builder.app do
16
+ use CrashLog::Rack
17
+ run lambda { |env| raise "Fully Racked" }
18
+ end
19
+ end
20
+
21
+ it 'should capture exception within rack app' do
22
+ CrashLog.should_receive(:notify).with(kind_of(RuntimeError), kind_of(Hash)).once
23
+
24
+ lambda {
25
+ get '/'
26
+ }.should raise_error
27
+ end
28
+
29
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'rack/test'
3
+
4
+ describe 'Rescue from within a Rails 3.x controller' do
5
+ include RSpec::Rails::RequestExampleGroup
6
+ include Rack::Test::Methods
7
+
8
+ describe 'dummy app' do
9
+ it 'should response nicely to index' do
10
+ get '/'
11
+ last_response.should be_ok
12
+ last_response.body.should == 'Works fine here'
13
+ end
14
+ end
15
+
16
+ it 'should intercept error and notify crashlog' do
17
+ CrashLog.should_receive(:notify).with(kind_of(RuntimeError)).once
18
+
19
+ begin
20
+ get '/broken'
21
+ last_response.status.should == 500
22
+ last_response.body.should match /We're sorry, but something went wrong/
23
+ rescue
24
+ end
25
+
26
+ end
27
+
28
+ it 'should capture current user'
29
+ it 'should capture crash log custom data'
30
+
31
+ it 'should raise error again after notifying' do
32
+ ENV['RAILS_ENV']='production'
33
+
34
+ logger = stub("Logger")
35
+ ActionDispatch::DebugExceptions.any_instance.stub(:logger).and_return(logger)
36
+ logger.should_receive(:fatal).once
37
+
38
+ begin
39
+ get '/broken'
40
+ last_response.status.should == 500
41
+ rescue
42
+ end
43
+ end
44
+
45
+ it 'should be able to defer reporting to another thread'
46
+ end
@@ -0,0 +1,23 @@
1
+ if ENV['COV']
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ end
5
+
6
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
7
+
8
+ require 'rspec/rails'
9
+ require 'delorean'
10
+ require 'json_spec'
11
+ require 'uuid'
12
+ require "crash_log"
13
+
14
+ # require File.expand_path("../dummy/config/environment.rb", __FILE__)
15
+
16
+ Dir[File.expand_path("../support/*.rb", __FILE__)].each { |file| require file }
17
+
18
+ RSpec.configure do |config|
19
+ config.mock_with :rspec
20
+
21
+ config.before do
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ alias :doing :lambda
@@ -0,0 +1,13 @@
1
+ def load_dummy_app
2
+ stubs = Faraday::Adapter::Test::Stubs.new do |stub|
3
+ stub.post('/announce') { [200, {}, {}.to_json] }
4
+ end
5
+
6
+ test_connection = Faraday.new(:url => 'https://stdin.crashlog.io') do |builder|
7
+ builder.adapter :test, stubs
8
+ end
9
+
10
+ CrashLog::Reporter.any_instance.stub(:connection).and_return(test_connection)
11
+
12
+ require File.expand_path("../../dummy/config/environment.rb", __FILE__)
13
+ end
@@ -0,0 +1,7 @@
1
+ class Hash
2
+ def has_keys?(*keys)
3
+ keys.all? do |key|
4
+ has_key?(key)
5
+ end
6
+ end
7
+ end
metadata CHANGED
@@ -1,33 +1,179 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crashlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Ivan Vanderbyl
8
+ - TestPilot CI
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-10 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &70175970544380 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70175970544380
25
+ - !ruby/object:Gem::Dependency
26
+ name: faraday
27
+ requirement: &70175970543240 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70175970543240
36
+ - !ruby/object:Gem::Dependency
37
+ name: crashlog-auth-hmac
38
+ requirement: &70175970541460 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.1.5
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70175970541460
47
+ - !ruby/object:Gem::Dependency
48
+ name: yajl-ruby
49
+ requirement: &70175970540800 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70175970540800
58
+ - !ruby/object:Gem::Dependency
59
+ name: rabl
60
+ requirement: &70175970540040 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 0.6.14
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70175970540040
69
+ - !ruby/object:Gem::Dependency
70
+ name: uuid
71
+ requirement: &70175970539280 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *70175970539280
80
+ - !ruby/object:Gem::Dependency
81
+ name: hashr
82
+ requirement: &70175970538820 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *70175970538820
14
91
  description: CrashLog Exception reporter
15
92
  email:
16
- - ivanvanderbyl@me.com
93
+ - support@crashlog.io
17
94
  executables: []
18
95
  extensions: []
19
96
  extra_rdoc_files: []
20
97
  files:
21
98
  - .gitignore
99
+ - .rspec
100
+ - .travis.yml
22
101
  - Gemfile
102
+ - Gemfile.lock
103
+ - INSTALL
23
104
  - LICENSE
24
105
  - README.md
25
106
  - Rakefile
26
107
  - crashlog.gemspec
108
+ - generators/crashlog/templates/initializer.rb
109
+ - install.rb
27
110
  - lib/crash_log.rb
111
+ - lib/crash_log/backtrace.rb
112
+ - lib/crash_log/backtrace/line.rb
113
+ - lib/crash_log/backtrace/line_cache.rb
114
+ - lib/crash_log/configuration.bak.rb
115
+ - lib/crash_log/configuration.rb
116
+ - lib/crash_log/logging.rb
117
+ - lib/crash_log/payload.rb
118
+ - lib/crash_log/rack.rb
119
+ - lib/crash_log/rails.rb
120
+ - lib/crash_log/rails/action_controller_rescue.rb
121
+ - lib/crash_log/rails/controller_methods.rb
122
+ - lib/crash_log/rails/middleware/debug_exception_catcher.rb
123
+ - lib/crash_log/railtie.rb
124
+ - lib/crash_log/reporter.rb
125
+ - lib/crash_log/system_information.rb
126
+ - lib/crash_log/templates/payload.rabl
28
127
  - lib/crash_log/version.rb
29
128
  - lib/crashlog.rb
30
- homepage: ''
129
+ - lib/faraday/request/hmac_authentication.rb
130
+ - lib/rails/generators/crashlog/crashlog_generator.rb
131
+ - rails/init.rb
132
+ - spec/crash_log/backtrace_spec.rb
133
+ - spec/crash_log/initializer_spec.rb
134
+ - spec/crash_log/payload_spec.rb
135
+ - spec/crash_log/reporter_spec.rb
136
+ - spec/crash_log_spec.rb
137
+ - spec/dummy/README.rdoc
138
+ - spec/dummy/Rakefile
139
+ - spec/dummy/app/assets/javascripts/application.js
140
+ - spec/dummy/app/assets/stylesheets/application.css
141
+ - spec/dummy/app/controllers/application_controller.rb
142
+ - spec/dummy/app/controllers/break_controller.rb
143
+ - spec/dummy/app/helpers/application_helper.rb
144
+ - spec/dummy/app/mailers/.gitkeep
145
+ - spec/dummy/app/models/.gitkeep
146
+ - spec/dummy/app/views/layouts/application.html.erb
147
+ - spec/dummy/config.ru
148
+ - spec/dummy/config/application.rb
149
+ - spec/dummy/config/boot.rb
150
+ - spec/dummy/config/database.yml
151
+ - spec/dummy/config/environment.rb
152
+ - spec/dummy/config/environments/development.rb
153
+ - spec/dummy/config/environments/production.rb
154
+ - spec/dummy/config/environments/test.rb
155
+ - spec/dummy/config/initializers/backtrace_silencers.rb
156
+ - spec/dummy/config/initializers/crashlog.rb
157
+ - spec/dummy/config/initializers/inflections.rb
158
+ - spec/dummy/config/initializers/mime_types.rb
159
+ - spec/dummy/config/initializers/secret_token.rb
160
+ - spec/dummy/config/initializers/session_store.rb
161
+ - spec/dummy/config/initializers/wrap_parameters.rb
162
+ - spec/dummy/config/routes.rb
163
+ - spec/dummy/lib/assets/.gitkeep
164
+ - spec/dummy/log/.gitkeep
165
+ - spec/dummy/public/404.html
166
+ - spec/dummy/public/422.html
167
+ - spec/dummy/public/500.html
168
+ - spec/dummy/public/favicon.ico
169
+ - spec/dummy/script/rails
170
+ - spec/requests/rack_spec.rb
171
+ - spec/requests/rails_controller_rescue_spec.rb
172
+ - spec/spec_helper.rb
173
+ - spec/support/doing.rb
174
+ - spec/support/dummy_app.rb
175
+ - spec/support/hash_ext.rb
176
+ homepage: http://crashlog.io
31
177
  licenses: []
32
178
  post_install_message:
33
179
  rdoc_options: []
@@ -51,4 +197,48 @@ rubygems_version: 1.8.15
51
197
  signing_key:
52
198
  specification_version: 3
53
199
  summary: CrashLog is an exception handler for production applications
54
- test_files: []
200
+ test_files:
201
+ - spec/crash_log/backtrace_spec.rb
202
+ - spec/crash_log/initializer_spec.rb
203
+ - spec/crash_log/payload_spec.rb
204
+ - spec/crash_log/reporter_spec.rb
205
+ - spec/crash_log_spec.rb
206
+ - spec/dummy/README.rdoc
207
+ - spec/dummy/Rakefile
208
+ - spec/dummy/app/assets/javascripts/application.js
209
+ - spec/dummy/app/assets/stylesheets/application.css
210
+ - spec/dummy/app/controllers/application_controller.rb
211
+ - spec/dummy/app/controllers/break_controller.rb
212
+ - spec/dummy/app/helpers/application_helper.rb
213
+ - spec/dummy/app/mailers/.gitkeep
214
+ - spec/dummy/app/models/.gitkeep
215
+ - spec/dummy/app/views/layouts/application.html.erb
216
+ - spec/dummy/config.ru
217
+ - spec/dummy/config/application.rb
218
+ - spec/dummy/config/boot.rb
219
+ - spec/dummy/config/database.yml
220
+ - spec/dummy/config/environment.rb
221
+ - spec/dummy/config/environments/development.rb
222
+ - spec/dummy/config/environments/production.rb
223
+ - spec/dummy/config/environments/test.rb
224
+ - spec/dummy/config/initializers/backtrace_silencers.rb
225
+ - spec/dummy/config/initializers/crashlog.rb
226
+ - spec/dummy/config/initializers/inflections.rb
227
+ - spec/dummy/config/initializers/mime_types.rb
228
+ - spec/dummy/config/initializers/secret_token.rb
229
+ - spec/dummy/config/initializers/session_store.rb
230
+ - spec/dummy/config/initializers/wrap_parameters.rb
231
+ - spec/dummy/config/routes.rb
232
+ - spec/dummy/lib/assets/.gitkeep
233
+ - spec/dummy/log/.gitkeep
234
+ - spec/dummy/public/404.html
235
+ - spec/dummy/public/422.html
236
+ - spec/dummy/public/500.html
237
+ - spec/dummy/public/favicon.ico
238
+ - spec/dummy/script/rails
239
+ - spec/requests/rack_spec.rb
240
+ - spec/requests/rails_controller_rescue_spec.rb
241
+ - spec/spec_helper.rb
242
+ - spec/support/doing.rb
243
+ - spec/support/dummy_app.rb
244
+ - spec/support/hash_ext.rb