exceptio-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,60 @@
1
+ = exceptio-ruby
2
+
3
+ * http://github.com/kickcode/exceptio-ruby
4
+
5
+ == DESCRIPTION:
6
+
7
+ exceptio-ruby provides a Ruby client for the except.io error notification service (http://except.io).
8
+
9
+ == FEATURES:
10
+
11
+ Logs exceptions (error messages and backtraces) to except.io, with automated hooks for Rails 2.3/Rails 3, and a client class that can be used in other Ruby apps.
12
+
13
+ == SYNOPSIS:
14
+
15
+ Add to your Gemfile as follows:
16
+
17
+ gem 'exceptio-ruby'
18
+
19
+ Then run "bundle install", and once installed, you can configure your app:
20
+
21
+ ExceptIO::Client.configure "app-name", "api-key"
22
+
23
+ You can find these details in the except.io web app when you setup the application ready to receive error notifications.
24
+
25
+ == REQUIREMENTS:
26
+
27
+ exceptio-ruby depends upon httparty.
28
+
29
+ == INSTALL:
30
+
31
+ It's best to add the gem to your Gemfile, but if needed you can install it manually:
32
+
33
+ gem install exceptio-ruby
34
+
35
+ == CONTRIBUTORS:
36
+
37
+ Elliott Draper
38
+
39
+ == LICENSE:
40
+
41
+ Copyright 2011 Elliott Draper <el@kickcode.com>
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining
44
+ a copy of this software and associated documentation files (the
45
+ "Software"), to deal in the Software without restriction, including
46
+ without limitation the rights to use, copy, modify, merge, publish,
47
+ distribute, sublicense, and/or sell copies of the Software, and to
48
+ permit persons to whom the Software is furnished to do so, subject to
49
+ the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be
52
+ included in all copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
55
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
57
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
58
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
59
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
60
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "exceptio"))
data/lib/exceptio.rb ADDED
@@ -0,0 +1,2 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "exceptio", "client"))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), "exceptio", "hooks"))
@@ -0,0 +1,25 @@
1
+ require 'httparty'
2
+
3
+ module ExceptIO
4
+ class Client
5
+ include HTTParty
6
+
7
+ def self.configure(application, app_key, endpoint = 'except.io')
8
+ @application = application
9
+ @app_key = app_key
10
+ base_uri endpoint
11
+ if defined?(Rails)
12
+ if Rails.version.starts_with?("2.3")
13
+ ActionController::Base.send(:include, ExceptIO::Hooks::Rails23)
14
+ elsif Rails.version.starts_with?("3")
15
+ ActionController::Base.send(:include, ExceptIO::Hooks::Rails3)
16
+ end
17
+ end
18
+ end
19
+
20
+ def self.log(exception)
21
+ res = self.post("/applications/#{@application}/errors", {:query => {:app_key => @app_key}, :body => {:error => {:message => exception.message, :backtrace => exception.backtrace}}})
22
+ res.code == 201
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ module ExceptIO
2
+ module Hooks
3
+ module Rails23
4
+ def log_error(exception)
5
+ ExceptIO::Client.log(exception)
6
+ end
7
+ end
8
+
9
+ module Rails3
10
+ def rescue_to_exceptio(exception = nil)
11
+ ExceptIO::Client.log(exception)
12
+ raise exception
13
+ end
14
+
15
+ def self.included(klass)
16
+ klass.rescue_from Exception, :with => :rescue_to_exceptio
17
+ end
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: exceptio-ruby
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Elliott Draper
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-12-09 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httparty
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 8
31
+ - 1
32
+ version: 0.8.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: fakeweb
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 3
46
+ - 0
47
+ version: 1.3.0
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: mocha
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
60
+ - 10
61
+ - 0
62
+ version: 0.10.0
63
+ type: :development
64
+ version_requirements: *id003
65
+ description:
66
+ email: el@kickcode.com
67
+ executables: []
68
+
69
+ extensions: []
70
+
71
+ extra_rdoc_files:
72
+ - README.rdoc
73
+ files:
74
+ - README.rdoc
75
+ - lib/exceptio/client.rb
76
+ - lib/exceptio/hooks.rb
77
+ - lib/exceptio-ruby.rb
78
+ - lib/exceptio.rb
79
+ has_rdoc: true
80
+ homepage: http://github.com/kickcode/exceptio-ruby
81
+ licenses: []
82
+
83
+ post_install_message:
84
+ rdoc_options:
85
+ - --main
86
+ - README.rdoc
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ requirements: []
106
+
107
+ rubyforge_project:
108
+ rubygems_version: 1.3.7
109
+ signing_key:
110
+ specification_version: 3
111
+ summary: Ruby client library for the ExceptIO error notification service, with Rails 2.3/Rails 3 hooks
112
+ test_files: []
113
+