exceptions_to_slack 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/exceptions_to_slack.gemspec +1 -1
- data/lib/exceptions_to_slack/notifier.rb +3 -7
- data/lib/exceptions_to_slack/version.rb +1 -1
- data/test/exceptions_to_slack/notifier_test.rb +3 -5
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8044bd9d13db7f23842129dd74a4a246be8047d3
|
4
|
+
data.tar.gz: 137e8d0c5a0585c1c67c900f00d7cdfd968d0aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c44792653cda9d21eea74bd6ff15ccf7a325cb9208bfebfbfc6f82c9d36001cb161dd7d619fc0471f25541c80f5f72b71a85bc85dd5d79cc3233e69bd9edda33
|
7
|
+
data.tar.gz: 4194838037dd11717e12342324d41d592a8bf28ec0c930c9ba14fa9fb3cdf6d949f04a174aff6c860bfdf6faffed8eb6249306b8068d4444abc92772859443f3
|
data/README.md
CHANGED
@@ -14,8 +14,7 @@ Rails 3: add as rack middleware to `application.rb'
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
config.middleware.use ExceptionsToSlack::Notifier,
|
17
|
-
|
18
|
-
token: 'your-api-token', # required, https://my.slack.com/services/new/incoming-webhook
|
17
|
+
url: 'your-incoming-webhook-url', # required, https://my.slack.com/services/new/incoming-webhook
|
19
18
|
channel: '#general', # required
|
20
19
|
user: 'Exception Notifier', # optional, defaults to Notifier
|
21
20
|
ignore: /Foo/, # optional pattern for exceptions not to be sent
|
data/exceptions_to_slack.gemspec
CHANGED
@@ -14,6 +14,6 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.version = ExceptionsToSlack::VERSION
|
16
16
|
|
17
|
-
gem.add_dependency("slack-notifier", "~>
|
17
|
+
gem.add_dependency("slack-notifier", "~> 1.4.0")
|
18
18
|
gem.add_development_dependency("webmock", "~> 1.18.0")
|
19
19
|
end
|
@@ -4,7 +4,7 @@ module ExceptionsToSlack
|
|
4
4
|
class Notifier
|
5
5
|
def initialize(app, options = {})
|
6
6
|
@app = app
|
7
|
-
@notifier = Slack::Notifier.new(
|
7
|
+
@notifier = Slack::Notifier.new(url(options))
|
8
8
|
@notifier.channel = options[:channel] || raise("Channel is required")
|
9
9
|
@notifier.username = options[:user] || "Notifier"
|
10
10
|
@ignore = options[:ignore]
|
@@ -28,12 +28,8 @@ module ExceptionsToSlack
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
options[:
|
33
|
-
end
|
34
|
-
|
35
|
-
def token(options)
|
36
|
-
options[:token] || raise("Token is required")
|
31
|
+
def url(options)
|
32
|
+
options[:url] || raise("URL is required")
|
37
33
|
end
|
38
34
|
|
39
35
|
def message_for(exception)
|
@@ -1,16 +1,14 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
|
3
3
|
class TestNotifier < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
TOKEN = 'the-token'
|
4
|
+
URL = 'https://the.url.com'
|
6
5
|
CHANNEL = 'the-channel'
|
7
6
|
|
8
7
|
def setup
|
9
8
|
@app = MiniTest::Mock.new
|
10
9
|
|
11
10
|
@notifier = ExceptionsToSlack::Notifier.new(@app, {
|
12
|
-
|
13
|
-
token: TOKEN,
|
11
|
+
url: URL,
|
14
12
|
channel: CHANNEL,
|
15
13
|
ignore: /ignored/
|
16
14
|
})
|
@@ -19,7 +17,7 @@ class TestNotifier < MiniTest::Unit::TestCase
|
|
19
17
|
def test_exceptions_are_sent_to_slack
|
20
18
|
def @app.call(env) raise ':boom:' end
|
21
19
|
|
22
|
-
WebMock.stub_request(:post, 'https://the
|
20
|
+
WebMock.stub_request(:post, 'https://the.url.com').with do |request|
|
23
21
|
form = URI.decode_www_form(request.body)
|
24
22
|
|
25
23
|
assert_equal 1, form.size
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exceptions_to_slack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darrin Holst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-notifier
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: webmock
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.18.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.18.0
|
41
41
|
description:
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
49
|
- Gemfile
|
50
50
|
- LICENSE
|
51
51
|
- README.md
|
@@ -65,17 +65,17 @@ require_paths:
|
|
65
65
|
- lib
|
66
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.4.6
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Send rails exceptions to Slack
|