exception_notification-hato_notifier 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/Gemfile +9 -0
- data/example/Procfile +2 -0
- data/example/app.rb +22 -0
- data/example/config.ru +2 -0
- data/example/hato_config.rb +20 -0
- data/lib/exception_notifier/hato_notifier.rb +3 -2
- data/lib/exception_notifier/hato_notifier/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60cb9db24591ce464fc563916c17b68252cc51e6
|
4
|
+
data.tar.gz: 5fc6ca50095d94d32c698c8ca07c7cb7d668d6ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aea5d9c10382207483bbc8334b89587a7db2308a88222a9b713e7f0b3ee2a87e53477d7c118e8e1d2c4756204538b1e3b7cd84e01ae3f3d6349bbf5e8fc5130
|
7
|
+
data.tar.gz: de19f498d78de46a68695ce42c81b3aaa60e99ae483569ed1aac14c4b7bc87babacae3e1a1055b98e6dfbe00e4eca8e91a37f2a5d8949acde4164c5f17c8b061
|
data/example/Gemfile
ADDED
data/example/Procfile
ADDED
data/example/app.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'exception_notification'
|
3
|
+
require 'exception_notifier/hato_notifier'
|
4
|
+
|
5
|
+
class ExampleApp < Sinatra::Base
|
6
|
+
use ExceptionNotification::Rack,
|
7
|
+
hato: {
|
8
|
+
host: 'localhost',
|
9
|
+
port: 9699,
|
10
|
+
api_key: 'example',
|
11
|
+
template: {
|
12
|
+
tag: ->(exception, options) { "exception.#{exception.class}" },
|
13
|
+
message: ->(exception, options) { "Exception: #{exception.class}: #{exception.message}" },
|
14
|
+
},
|
15
|
+
}
|
16
|
+
|
17
|
+
class Exception < ::Exception; end
|
18
|
+
|
19
|
+
get '/' do
|
20
|
+
raise Exception.new('Example exception')
|
21
|
+
end
|
22
|
+
end
|
data/example/config.ru
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
services = {
|
2
|
+
'ExampleApp' => %w[example_app_team],
|
3
|
+
}
|
4
|
+
|
5
|
+
Hato::Config.define do
|
6
|
+
api_key 'example'
|
7
|
+
host '0.0.0.0'
|
8
|
+
port 9699
|
9
|
+
|
10
|
+
# ExampleApp::Exception will be sent to #example_app_team channel via Ikachan
|
11
|
+
tag /^exception\.([^.:]+)/ do |service|
|
12
|
+
if channel = services[service]
|
13
|
+
plugin 'Ikachan' do
|
14
|
+
host 'ikachan.example.com'
|
15
|
+
port 4979
|
16
|
+
channel channel
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -43,8 +43,9 @@ module ExceptionNotifier
|
|
43
43
|
client = Net::HTTP.new(@host, @port)
|
44
44
|
req = Net::HTTP::Post.new('/notify')
|
45
45
|
|
46
|
-
|
47
|
-
|
46
|
+
form_data = { 'tag' => tag, 'message' => message }
|
47
|
+
form_data.merge!('api_key' => @api_key) if @api_key
|
48
|
+
req.set_form_data(form_data)
|
48
49
|
|
49
50
|
client.request(req)
|
50
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_notification-hato_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Kuribayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webmock
|
@@ -79,6 +79,11 @@ files:
|
|
79
79
|
- LICENSE.txt
|
80
80
|
- README.md
|
81
81
|
- Rakefile
|
82
|
+
- example/Gemfile
|
83
|
+
- example/Procfile
|
84
|
+
- example/app.rb
|
85
|
+
- example/config.ru
|
86
|
+
- example/hato_config.rb
|
82
87
|
- exception_notification-hato_nitifier.gemspec
|
83
88
|
- lib/exception_notifier/hato_notifier.rb
|
84
89
|
- lib/exception_notifier/hato_notifier/version.rb
|