exception_hub 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +16 -0
  5. data/Guardfile +24 -0
  6. data/LICENSE +22 -0
  7. data/README.md +43 -0
  8. data/Rakefile +10 -0
  9. data/exception_hub.gemspec +23 -0
  10. data/lib/exception_hub/client/authorization.rb +26 -0
  11. data/lib/exception_hub/client.rb +26 -0
  12. data/lib/exception_hub/configuration.rb +81 -0
  13. data/lib/exception_hub/interceptor.rb +34 -0
  14. data/lib/exception_hub/issue.rb +25 -0
  15. data/lib/exception_hub/notifier.rb +64 -0
  16. data/lib/exception_hub/rack.rb +27 -0
  17. data/lib/exception_hub/rails/controller_interceptor.rb +21 -0
  18. data/lib/exception_hub/rails/middleware/exceptions_interceptor.rb +22 -0
  19. data/lib/exception_hub/railtie.rb +24 -0
  20. data/lib/exception_hub/rake_task.rb +27 -0
  21. data/lib/exception_hub/version.rb +3 -0
  22. data/lib/exception_hub.rb +20 -0
  23. data/lib/tasks/exception_hub.rake +3 -0
  24. data/spec/integration/exception_hub_integration/.gitignore +17 -0
  25. data/spec/integration/exception_hub_integration/Gemfile +40 -0
  26. data/spec/integration/exception_hub_integration/README.rdoc +261 -0
  27. data/spec/integration/exception_hub_integration/Rakefile +7 -0
  28. data/spec/integration/exception_hub_integration/app/assets/images/rails.png +0 -0
  29. data/spec/integration/exception_hub_integration/app/assets/javascripts/application.js +15 -0
  30. data/spec/integration/exception_hub_integration/app/assets/stylesheets/application.css +13 -0
  31. data/spec/integration/exception_hub_integration/app/controllers/application_controller.rb +3 -0
  32. data/spec/integration/exception_hub_integration/app/controllers/errors_controller.rb +5 -0
  33. data/spec/integration/exception_hub_integration/app/helpers/application_helper.rb +2 -0
  34. data/spec/integration/exception_hub_integration/app/mailers/.gitkeep +0 -0
  35. data/spec/integration/exception_hub_integration/app/models/.gitkeep +0 -0
  36. data/spec/integration/exception_hub_integration/app/views/layouts/application.html.erb +14 -0
  37. data/spec/integration/exception_hub_integration/config/application.rb +62 -0
  38. data/spec/integration/exception_hub_integration/config/boot.rb +6 -0
  39. data/spec/integration/exception_hub_integration/config/database.yml +25 -0
  40. data/spec/integration/exception_hub_integration/config/environment.rb +5 -0
  41. data/spec/integration/exception_hub_integration/config/environments/development.rb +37 -0
  42. data/spec/integration/exception_hub_integration/config/environments/production.rb +67 -0
  43. data/spec/integration/exception_hub_integration/config/environments/test.rb +37 -0
  44. data/spec/integration/exception_hub_integration/config/initializers/backtrace_silencers.rb +7 -0
  45. data/spec/integration/exception_hub_integration/config/initializers/inflections.rb +15 -0
  46. data/spec/integration/exception_hub_integration/config/initializers/mime_types.rb +5 -0
  47. data/spec/integration/exception_hub_integration/config/initializers/secret_token.rb +7 -0
  48. data/spec/integration/exception_hub_integration/config/initializers/session_store.rb +8 -0
  49. data/spec/integration/exception_hub_integration/config/initializers/wrap_parameters.rb +14 -0
  50. data/spec/integration/exception_hub_integration/config/locales/en.yml +5 -0
  51. data/spec/integration/exception_hub_integration/config/routes.rb +59 -0
  52. data/spec/integration/exception_hub_integration/config.ru +4 -0
  53. data/spec/integration/exception_hub_integration/db/seeds.rb +7 -0
  54. data/spec/integration/exception_hub_integration/lib/assets/.gitkeep +0 -0
  55. data/spec/integration/exception_hub_integration/lib/tasks/.gitkeep +0 -0
  56. data/spec/integration/exception_hub_integration/log/.gitkeep +0 -0
  57. data/spec/integration/exception_hub_integration/public/404.html +26 -0
  58. data/spec/integration/exception_hub_integration/public/422.html +26 -0
  59. data/spec/integration/exception_hub_integration/public/500.html +25 -0
  60. data/spec/integration/exception_hub_integration/public/favicon.ico +0 -0
  61. data/spec/integration/exception_hub_integration/public/index.html +241 -0
  62. data/spec/integration/exception_hub_integration/public/robots.txt +5 -0
  63. data/spec/integration/exception_hub_integration/script/rails +6 -0
  64. data/spec/integration/exception_hub_integration/test/fixtures/.gitkeep +0 -0
  65. data/spec/integration/exception_hub_integration/test/functional/.gitkeep +0 -0
  66. data/spec/integration/exception_hub_integration/test/integration/.gitkeep +0 -0
  67. data/spec/integration/exception_hub_integration/test/performance/browsing_test.rb +12 -0
  68. data/spec/integration/exception_hub_integration/test/test_helper.rb +13 -0
  69. data/spec/integration/exception_hub_integration/test/unit/.gitkeep +0 -0
  70. data/spec/integration/exception_hub_integration/vendor/assets/javascripts/.gitkeep +0 -0
  71. data/spec/integration/exception_hub_integration/vendor/assets/stylesheets/.gitkeep +0 -0
  72. data/spec/integration/exception_hub_integration/vendor/plugins/.gitkeep +0 -0
  73. data/spec/integration/rake_task_spec.rb +9 -0
  74. data/spec/lib/exception_hub/client/authorization_spec.rb +22 -0
  75. data/spec/lib/exception_hub/client_spec.rb +28 -0
  76. data/spec/lib/exception_hub/configuration_spec.rb +35 -0
  77. data/spec/lib/interceptor_spec.rb +112 -0
  78. data/spec/lib/issue_spec.rb +26 -0
  79. data/spec/lib/notifier_spec.rb +31 -0
  80. data/spec/lib/rack_spec.rb +22 -0
  81. data/spec/spec_helper.rb +16 -0
  82. metadata +249 -0
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe ExceptionHub::Issue do
4
+ before do
5
+ ExceptionHub.repo_name = 'exception_hub'
6
+ ExceptionHub.repo_owner = 'jessedearing'
7
+ end
8
+
9
+ after do
10
+ ExceptionHub.repo_name = nil
11
+ ExceptionHub.repo_owner = nil
12
+ end
13
+
14
+ subject {ExceptionHub::Issue.new}
15
+
16
+ it "should send issues to Github" do
17
+ ExceptionHub.current_octokit.should_receive(:create_issue).with("#{ExceptionHub.repo_owner}/#{ExceptionHub.repo_name}", "Tissue Issue", "Elaborate", :open_timeout => 5)
18
+
19
+ subject.title = "Tissue Issue"
20
+ subject.description = "Elaborate"
21
+
22
+ subject.send_to_github
23
+ end
24
+
25
+ its(:to_yaml_properties) {should_not include '@description'}
26
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe ExceptionHub::Notifier do
4
+ before do
5
+ @issue_mock = mock(:issue)
6
+ @issue_mock.stub(:description=)
7
+ @issue_mock.stub(:title=)
8
+ @issue_mock.stub(:send_to_github)
9
+ ExceptionHub::Issue.stub(:new => @issue_mock)
10
+ ExceptionHub.define_defaults
11
+ end
12
+
13
+ subject {ExceptionHub::Notifier.new(Exception.new("Production error!"), {})}
14
+
15
+ it "should notify Github" do
16
+ @issue_mock.should_receive(:send_to_github)
17
+ subject.notify!
18
+ end
19
+
20
+ it "should log but swallow exceptions" do
21
+ logger_mock = mock(:logger)
22
+ logger_mock.should_receive(:error).twice
23
+ ExceptionHub.logger = logger_mock
24
+ @issue_mock.stub(:send_to_github) { raise "error sending to Github" }
25
+
26
+ subject.notify!
27
+
28
+ ExceptionHub.logger = nil
29
+ ExceptionHub.define_defaults
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe ExceptionHub::Rack do
4
+ before do
5
+ @rack_app_mock = mock(:rack_app)
6
+ @rack = ExceptionHub::Rack.new(@rack_app_mock)
7
+ end
8
+
9
+ subject {@rack}
10
+
11
+ it "should catch and log exceptions" do
12
+ @rack_app_mock.stub(:call) {raise "Production error!"}
13
+ ExceptionHub.should_receive(:handle_exception)
14
+ expect { subject.call({}) }.to raise_error "Production error!"
15
+ end
16
+
17
+ it "should log rack errors" do
18
+ @rack_app_mock.stub(:call)
19
+ ExceptionHub.should_receive(:handle_exception)
20
+ subject.call({'rack.exception' => Exception.new("Rack error")})
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ require 'simplecov'
2
+ require 'bundler/setup'
3
+ SimpleCov.start
4
+ Bundler.require(:default, :test)
5
+ require 'exception_hub'
6
+
7
+
8
+ RSpec.configure do |config|
9
+ TAGS = [:slow_test]
10
+
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ TAGS.each do |tag|
14
+ config.filter_run_excluding tag => true unless ENV["RUN_#{tag.to_s.upcase}"]
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,249 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: exception_hub
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jesse Dearing
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: octokit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.8.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.8.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: faraday_middleware
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.10.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.10.0
78
+ description: exception_hub logs exceptions in your Rails application to Github issues
79
+ email:
80
+ - jesse.dearing@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - .rspec
87
+ - .rvmrc
88
+ - Gemfile
89
+ - Guardfile
90
+ - LICENSE
91
+ - README.md
92
+ - Rakefile
93
+ - exception_hub.gemspec
94
+ - lib/exception_hub.rb
95
+ - lib/exception_hub/client.rb
96
+ - lib/exception_hub/client/authorization.rb
97
+ - lib/exception_hub/configuration.rb
98
+ - lib/exception_hub/interceptor.rb
99
+ - lib/exception_hub/issue.rb
100
+ - lib/exception_hub/notifier.rb
101
+ - lib/exception_hub/rack.rb
102
+ - lib/exception_hub/rails/controller_interceptor.rb
103
+ - lib/exception_hub/rails/middleware/exceptions_interceptor.rb
104
+ - lib/exception_hub/railtie.rb
105
+ - lib/exception_hub/rake_task.rb
106
+ - lib/exception_hub/version.rb
107
+ - lib/tasks/exception_hub.rake
108
+ - spec/integration/exception_hub_integration/.gitignore
109
+ - spec/integration/exception_hub_integration/Gemfile
110
+ - spec/integration/exception_hub_integration/README.rdoc
111
+ - spec/integration/exception_hub_integration/Rakefile
112
+ - spec/integration/exception_hub_integration/app/assets/images/rails.png
113
+ - spec/integration/exception_hub_integration/app/assets/javascripts/application.js
114
+ - spec/integration/exception_hub_integration/app/assets/stylesheets/application.css
115
+ - spec/integration/exception_hub_integration/app/controllers/application_controller.rb
116
+ - spec/integration/exception_hub_integration/app/controllers/errors_controller.rb
117
+ - spec/integration/exception_hub_integration/app/helpers/application_helper.rb
118
+ - spec/integration/exception_hub_integration/app/mailers/.gitkeep
119
+ - spec/integration/exception_hub_integration/app/models/.gitkeep
120
+ - spec/integration/exception_hub_integration/app/views/layouts/application.html.erb
121
+ - spec/integration/exception_hub_integration/config.ru
122
+ - spec/integration/exception_hub_integration/config/application.rb
123
+ - spec/integration/exception_hub_integration/config/boot.rb
124
+ - spec/integration/exception_hub_integration/config/database.yml
125
+ - spec/integration/exception_hub_integration/config/environment.rb
126
+ - spec/integration/exception_hub_integration/config/environments/development.rb
127
+ - spec/integration/exception_hub_integration/config/environments/production.rb
128
+ - spec/integration/exception_hub_integration/config/environments/test.rb
129
+ - spec/integration/exception_hub_integration/config/initializers/backtrace_silencers.rb
130
+ - spec/integration/exception_hub_integration/config/initializers/inflections.rb
131
+ - spec/integration/exception_hub_integration/config/initializers/mime_types.rb
132
+ - spec/integration/exception_hub_integration/config/initializers/secret_token.rb
133
+ - spec/integration/exception_hub_integration/config/initializers/session_store.rb
134
+ - spec/integration/exception_hub_integration/config/initializers/wrap_parameters.rb
135
+ - spec/integration/exception_hub_integration/config/locales/en.yml
136
+ - spec/integration/exception_hub_integration/config/routes.rb
137
+ - spec/integration/exception_hub_integration/db/seeds.rb
138
+ - spec/integration/exception_hub_integration/lib/assets/.gitkeep
139
+ - spec/integration/exception_hub_integration/lib/tasks/.gitkeep
140
+ - spec/integration/exception_hub_integration/log/.gitkeep
141
+ - spec/integration/exception_hub_integration/public/404.html
142
+ - spec/integration/exception_hub_integration/public/422.html
143
+ - spec/integration/exception_hub_integration/public/500.html
144
+ - spec/integration/exception_hub_integration/public/favicon.ico
145
+ - spec/integration/exception_hub_integration/public/index.html
146
+ - spec/integration/exception_hub_integration/public/robots.txt
147
+ - spec/integration/exception_hub_integration/script/rails
148
+ - spec/integration/exception_hub_integration/test/fixtures/.gitkeep
149
+ - spec/integration/exception_hub_integration/test/functional/.gitkeep
150
+ - spec/integration/exception_hub_integration/test/integration/.gitkeep
151
+ - spec/integration/exception_hub_integration/test/performance/browsing_test.rb
152
+ - spec/integration/exception_hub_integration/test/test_helper.rb
153
+ - spec/integration/exception_hub_integration/test/unit/.gitkeep
154
+ - spec/integration/exception_hub_integration/vendor/assets/javascripts/.gitkeep
155
+ - spec/integration/exception_hub_integration/vendor/assets/stylesheets/.gitkeep
156
+ - spec/integration/exception_hub_integration/vendor/plugins/.gitkeep
157
+ - spec/integration/rake_task_spec.rb
158
+ - spec/lib/exception_hub/client/authorization_spec.rb
159
+ - spec/lib/exception_hub/client_spec.rb
160
+ - spec/lib/exception_hub/configuration_spec.rb
161
+ - spec/lib/interceptor_spec.rb
162
+ - spec/lib/issue_spec.rb
163
+ - spec/lib/notifier_spec.rb
164
+ - spec/lib/rack_spec.rb
165
+ - spec/spec_helper.rb
166
+ homepage: https://github.com/jessedearing/exception_hub
167
+ licenses: []
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ none: false
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 1.8.24
187
+ signing_key:
188
+ specification_version: 3
189
+ summary: Logs exceptions in your application to Github issues
190
+ test_files:
191
+ - spec/integration/exception_hub_integration/.gitignore
192
+ - spec/integration/exception_hub_integration/Gemfile
193
+ - spec/integration/exception_hub_integration/README.rdoc
194
+ - spec/integration/exception_hub_integration/Rakefile
195
+ - spec/integration/exception_hub_integration/app/assets/images/rails.png
196
+ - spec/integration/exception_hub_integration/app/assets/javascripts/application.js
197
+ - spec/integration/exception_hub_integration/app/assets/stylesheets/application.css
198
+ - spec/integration/exception_hub_integration/app/controllers/application_controller.rb
199
+ - spec/integration/exception_hub_integration/app/controllers/errors_controller.rb
200
+ - spec/integration/exception_hub_integration/app/helpers/application_helper.rb
201
+ - spec/integration/exception_hub_integration/app/mailers/.gitkeep
202
+ - spec/integration/exception_hub_integration/app/models/.gitkeep
203
+ - spec/integration/exception_hub_integration/app/views/layouts/application.html.erb
204
+ - spec/integration/exception_hub_integration/config.ru
205
+ - spec/integration/exception_hub_integration/config/application.rb
206
+ - spec/integration/exception_hub_integration/config/boot.rb
207
+ - spec/integration/exception_hub_integration/config/database.yml
208
+ - spec/integration/exception_hub_integration/config/environment.rb
209
+ - spec/integration/exception_hub_integration/config/environments/development.rb
210
+ - spec/integration/exception_hub_integration/config/environments/production.rb
211
+ - spec/integration/exception_hub_integration/config/environments/test.rb
212
+ - spec/integration/exception_hub_integration/config/initializers/backtrace_silencers.rb
213
+ - spec/integration/exception_hub_integration/config/initializers/inflections.rb
214
+ - spec/integration/exception_hub_integration/config/initializers/mime_types.rb
215
+ - spec/integration/exception_hub_integration/config/initializers/secret_token.rb
216
+ - spec/integration/exception_hub_integration/config/initializers/session_store.rb
217
+ - spec/integration/exception_hub_integration/config/initializers/wrap_parameters.rb
218
+ - spec/integration/exception_hub_integration/config/locales/en.yml
219
+ - spec/integration/exception_hub_integration/config/routes.rb
220
+ - spec/integration/exception_hub_integration/db/seeds.rb
221
+ - spec/integration/exception_hub_integration/lib/assets/.gitkeep
222
+ - spec/integration/exception_hub_integration/lib/tasks/.gitkeep
223
+ - spec/integration/exception_hub_integration/log/.gitkeep
224
+ - spec/integration/exception_hub_integration/public/404.html
225
+ - spec/integration/exception_hub_integration/public/422.html
226
+ - spec/integration/exception_hub_integration/public/500.html
227
+ - spec/integration/exception_hub_integration/public/favicon.ico
228
+ - spec/integration/exception_hub_integration/public/index.html
229
+ - spec/integration/exception_hub_integration/public/robots.txt
230
+ - spec/integration/exception_hub_integration/script/rails
231
+ - spec/integration/exception_hub_integration/test/fixtures/.gitkeep
232
+ - spec/integration/exception_hub_integration/test/functional/.gitkeep
233
+ - spec/integration/exception_hub_integration/test/integration/.gitkeep
234
+ - spec/integration/exception_hub_integration/test/performance/browsing_test.rb
235
+ - spec/integration/exception_hub_integration/test/test_helper.rb
236
+ - spec/integration/exception_hub_integration/test/unit/.gitkeep
237
+ - spec/integration/exception_hub_integration/vendor/assets/javascripts/.gitkeep
238
+ - spec/integration/exception_hub_integration/vendor/assets/stylesheets/.gitkeep
239
+ - spec/integration/exception_hub_integration/vendor/plugins/.gitkeep
240
+ - spec/integration/rake_task_spec.rb
241
+ - spec/lib/exception_hub/client/authorization_spec.rb
242
+ - spec/lib/exception_hub/client_spec.rb
243
+ - spec/lib/exception_hub/configuration_spec.rb
244
+ - spec/lib/interceptor_spec.rb
245
+ - spec/lib/issue_spec.rb
246
+ - spec/lib/notifier_spec.rb
247
+ - spec/lib/rack_spec.rb
248
+ - spec/spec_helper.rb
249
+ has_rdoc: