rails_exception_handler 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile +2 -1
- data/Gemfile.lock +6 -0
- data/HISTORY +8 -0
- data/README.markdown +8 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/rails_exception_handler/parser.rb +1 -1
- data/rails_exception_handler.gemspec +17 -2
- data/spec/integration/configuration_spec.rb +2 -2
- data/spec/integration/rails_exception_handler_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -4
- data/spec/unit/configuration_spec.rb +1 -1
- data/spec/unit/handler_spec.rb +2 -2
- data/spec/unit/parser_spec.rb +1 -1
- metadata +58 -4
- data/spec/testapp_30/config/database.yml +0 -12
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -33,7 +33,12 @@ GEM
|
|
33
33
|
diff-lcs (1.1.2)
|
34
34
|
erubis (2.6.6)
|
35
35
|
abstract (>= 1.0.0)
|
36
|
+
git (1.2.5)
|
36
37
|
i18n (0.5.0)
|
38
|
+
jeweler (1.6.3)
|
39
|
+
bundler (~> 1.0)
|
40
|
+
git (>= 1.2.5)
|
41
|
+
rake
|
37
42
|
mail (2.2.19)
|
38
43
|
activesupport (>= 2.3.6)
|
39
44
|
i18n (>= 0.4.0)
|
@@ -85,6 +90,7 @@ PLATFORMS
|
|
85
90
|
ruby
|
86
91
|
|
87
92
|
DEPENDENCIES
|
93
|
+
jeweler
|
88
94
|
mysql2 (= 0.2.6)
|
89
95
|
rack-test (= 0.5.7)
|
90
96
|
rails (= 3.0.9)
|
data/HISTORY
ADDED
data/README.markdown
CHANGED
@@ -2,11 +2,17 @@
|
|
2
2
|
|
3
3
|
This is an exception handler for Rails 3 built as Rack middleware. It enables you to save the key information from the error message in a database somewhere and display a customized error message to the user within the applications layout file. You can hook this gem into all your rails apps and gather the exception reports in one place. If you make yourself a simple web front on top of that you have a user friendly way of keeping track of exceptions raised by your rails apps.
|
4
4
|
|
5
|
+
## Compatiblity
|
6
|
+
|
7
|
+
The gem is tested against Rails 3.0.9. It does not work with Rails 2.
|
8
|
+
See travis-ci for info on which rubies it is tested against:
|
9
|
+
http://travis-ci.org/#!/Sharagoz/rails_exception_handler
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
Add this line to your Gemfile:
|
7
13
|
|
8
14
|
```
|
9
|
-
|
15
|
+
gem 'rails_exception_handler', '~> 1.0'
|
10
16
|
```
|
11
17
|
|
12
18
|
Create an initializer in **config/initializers** called **rails_exception_handler.rb** and uncomment the options where you want something other than the default:
|
@@ -188,5 +194,5 @@ activesupport (3.0.7) lib/active_support/notifications.rb:54:in `instrument'
|
|
188
194
|
```ruby
|
189
195
|
config.storage_strategies = [:remote_url => {:target => 'http://example.com/error_messages'}]
|
190
196
|
```
|
191
|
-
This option is meant for those who want to store the exception in a database table, but does not have direct access to the database itself, making
|
197
|
+
This option is meant for those who want to store the exception in a database table, but does not have direct access to the database itself, making active record store unsuitable. You need a web app on a server that has access to the database. An HTTP POST request will be sent to the specified URL with the error message as data.
|
192
198
|
If you use a Rails app at the other end you should simply be able to do _ErrorMessage.create(params[:error_message])_ to save the report.
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake'
|
4
|
+
require 'jeweler'
|
4
5
|
|
5
6
|
task :default => :test
|
6
7
|
|
@@ -15,7 +16,6 @@ task :test do
|
|
15
16
|
system "bundle exec rspec #{files.join(' ')}"
|
16
17
|
end
|
17
18
|
|
18
|
-
require 'jeweler'
|
19
19
|
Jeweler::Tasks.new do |gem|
|
20
20
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
21
21
|
gem.name = "rails_exception_handler"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
@@ -26,7 +26,7 @@ class RailsExceptionHandler::Parser
|
|
26
26
|
if(filter.class == Symbol)
|
27
27
|
result = send("filter_#{filter}")
|
28
28
|
elsif(filter.class == Hash)
|
29
|
-
result = send("filter_#{filter.
|
29
|
+
result = send("filter_#{filter.keys[0]}", filter.values[0])
|
30
30
|
else
|
31
31
|
raise "RailsExceptionHandler: Unknown filter #{filter.inspect}"
|
32
32
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails_exception_handler}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sharagoz"]
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
".travis.yml",
|
20
20
|
"Gemfile",
|
21
21
|
"Gemfile.lock",
|
22
|
+
"HISTORY",
|
22
23
|
"LICENCE",
|
23
24
|
"README.markdown",
|
24
25
|
"Rakefile",
|
@@ -49,7 +50,6 @@ Gem::Specification.new do |s|
|
|
49
50
|
"spec/testapp_30/config.ru",
|
50
51
|
"spec/testapp_30/config/application.rb",
|
51
52
|
"spec/testapp_30/config/boot.rb",
|
52
|
-
"spec/testapp_30/config/database.yml",
|
53
53
|
"spec/testapp_30/config/environment.rb",
|
54
54
|
"spec/testapp_30/config/environments/development.rb",
|
55
55
|
"spec/testapp_30/config/environments/production.rb",
|
@@ -79,9 +79,24 @@ Gem::Specification.new do |s|
|
|
79
79
|
s.specification_version = 3
|
80
80
|
|
81
81
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
82
|
+
s.add_development_dependency(%q<rails>, ["= 3.0.9"])
|
83
|
+
s.add_development_dependency(%q<rspec-rails>, [">= 0"])
|
84
|
+
s.add_development_dependency(%q<rack-test>, ["= 0.5.7"])
|
85
|
+
s.add_development_dependency(%q<mysql2>, ["= 0.2.6"])
|
86
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
82
87
|
else
|
88
|
+
s.add_dependency(%q<rails>, ["= 3.0.9"])
|
89
|
+
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
90
|
+
s.add_dependency(%q<rack-test>, ["= 0.5.7"])
|
91
|
+
s.add_dependency(%q<mysql2>, ["= 0.2.6"])
|
92
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
83
93
|
end
|
84
94
|
else
|
95
|
+
s.add_dependency(%q<rails>, ["= 3.0.9"])
|
96
|
+
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
97
|
+
s.add_dependency(%q<rack-test>, ["= 0.5.7"])
|
98
|
+
s.add_dependency(%q<mysql2>, ["= 0.2.6"])
|
99
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
85
100
|
end
|
86
101
|
end
|
87
102
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe RailsExceptionHandler::Configuration do
|
4
4
|
describe ".storage_strategies" do
|
@@ -13,7 +13,7 @@ describe RailsExceptionHandler::Configuration do
|
|
13
13
|
get('/home/model_error')
|
14
14
|
read_test_log.should match /NoMethodError \(undefined method `foo' for nil:NilClass\)/
|
15
15
|
read_test_log.should match /lib\/active_support\/whiny_nil\.rb:48/
|
16
|
-
read_test_log.should match /PARAMS:\s
|
16
|
+
read_test_log.should match /PARAMS:\s+\{/
|
17
17
|
read_test_log.should match /TARGET:\s+http:\/\/example\.org\/home\/model_error/
|
18
18
|
end
|
19
19
|
|
data/spec/spec_helper.rb
CHANGED
@@ -14,12 +14,11 @@ ActionController::Base.logger = nil
|
|
14
14
|
RSpec.configure do |config|
|
15
15
|
config.include Rack::Test::Methods
|
16
16
|
config.include TestMacros
|
17
|
-
config.
|
17
|
+
config.color_enabled = true
|
18
|
+
config.full_backtrace = true
|
19
|
+
config.before(:each) do
|
18
20
|
ErrorMessage.delete_all
|
19
21
|
clear_test_log
|
20
22
|
reset_configuration
|
21
|
-
example.call
|
22
23
|
end
|
23
|
-
config.color_enabled = true
|
24
|
-
config.full_backtrace = true
|
25
24
|
end
|
data/spec/unit/handler_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe RailsExceptionHandler::Handler do
|
4
4
|
before(:each) do
|
@@ -54,7 +54,7 @@ describe RailsExceptionHandler::Handler do
|
|
54
54
|
@handler.handle_exception
|
55
55
|
read_test_log.should match /NoMethodError \(undefined method `foo' for nil:NilClass\)/
|
56
56
|
read_test_log.should match /lib\/active_support\/whiny_nil\.rb:48/
|
57
|
-
read_test_log.should match /PARAMS:\s
|
57
|
+
read_test_log.should match /PARAMS:\s+\{\"foo\"=>\"bar\"\}/
|
58
58
|
read_test_log.should match /USER_AGENT:\s+Mozilla\/4.0 \(compatible; MSIE 8\.0\)/
|
59
59
|
read_test_log.should match /TARGET:\s+http:\/\/example\.org\/home\?foo=bar/
|
60
60
|
read_test_log.should match /REFERER:\s+http:\/\/google\.com\//
|
data/spec/unit/parser_spec.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rails_exception_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sharagoz
|
@@ -12,8 +12,62 @@ cert_chain: []
|
|
12
12
|
|
13
13
|
date: 2011-07-17 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rails
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.0.9
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-rails
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rack-test
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.5.7
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: mysql2
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - "="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.2.6
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: jeweler
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
17
71
|
description: ""
|
18
72
|
email: contact@sharagoz.com
|
19
73
|
executables: []
|
@@ -26,6 +80,7 @@ files:
|
|
26
80
|
- .travis.yml
|
27
81
|
- Gemfile
|
28
82
|
- Gemfile.lock
|
83
|
+
- HISTORY
|
29
84
|
- LICENCE
|
30
85
|
- README.markdown
|
31
86
|
- Rakefile
|
@@ -56,7 +111,6 @@ files:
|
|
56
111
|
- spec/testapp_30/config.ru
|
57
112
|
- spec/testapp_30/config/application.rb
|
58
113
|
- spec/testapp_30/config/boot.rb
|
59
|
-
- spec/testapp_30/config/database.yml
|
60
114
|
- spec/testapp_30/config/environment.rb
|
61
115
|
- spec/testapp_30/config/environments/development.rb
|
62
116
|
- spec/testapp_30/config/environments/production.rb
|