jackal-slack 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/jackal-slack.gemspec +4 -1
- data/lib/jackal-slack.rb +2 -0
- data/lib/jackal-slack/notification.rb +18 -10
- data/lib/jackal-slack/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7ba4f579722e2964ad616888c7faa63c0311c5e
|
4
|
+
data.tar.gz: 87ad15afdbaa67669ca644dd7827d34146ad774e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eff8a0c45f56c52c5fe33ebe88ec8ad56dc52ae477c675306334eb0cc2fee005b895bec42701193bb0fe6f1969a1e444bc3b460d470cf9948db6ce9f3082e8ff
|
7
|
+
data.tar.gz: 9c8180b3ebbb78963512a170c6f46c4359a5ad8fe7554352240dab0f4f535db90be554ac33c145e23e56c6f1549d039b9f20ee3bcf6c0689d0436b060d67fb4f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/jackal-slack.gemspec
CHANGED
@@ -6,11 +6,14 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.summary = 'Jackal Slack'
|
7
7
|
s.author = 'Heavywater'
|
8
8
|
s.email = 'support@hw-ops.com'
|
9
|
-
s.homepage = 'http://github.com/
|
9
|
+
s.homepage = 'http://github.com/carnivore-rb/jackal-slack'
|
10
10
|
s.description = 'Jackal Slack'
|
11
11
|
s.license = 'Apache 2.0'
|
12
12
|
s.require_path = 'lib'
|
13
13
|
s.add_dependency 'jackal', '>= 0.3.3', '< 1.0'
|
14
14
|
s.add_dependency 'slack-notifier', '~> 1.0'
|
15
|
+
|
16
|
+
s.add_development_dependency 'carnivore-actor'
|
17
|
+
|
15
18
|
s.files = Dir['lib/**/*'] + %w(jackal-slack.gemspec README.md CHANGELOG.md CONTRIBUTING.md LICENSE)
|
16
19
|
end
|
data/lib/jackal-slack.rb
CHANGED
@@ -12,8 +12,10 @@ require 'jackal-slack/version'
|
|
12
12
|
Jackal.service(
|
13
13
|
:slack,
|
14
14
|
:description => 'Send messages to Slack',
|
15
|
+
:category => :notifier,
|
15
16
|
:configuration => {
|
16
17
|
:webhook_url => {
|
18
|
+
:type => :string,
|
17
19
|
:description => 'Webhook URL to send messages'
|
18
20
|
}
|
19
21
|
}
|
@@ -14,14 +14,17 @@ module Jackal
|
|
14
14
|
# @return [Truthy, Falsey]
|
15
15
|
def valid?(message)
|
16
16
|
super do |payload|
|
17
|
-
|
17
|
+
config[:webhook_url] &&
|
18
|
+
payload.get(:data, :slack, :messages)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
22
|
+
# Send messages to Slack
|
23
|
+
#
|
24
|
+
# @param message [Carnivore::Message]
|
21
25
|
def execute(message)
|
22
26
|
failure_wrap(message) do |payload|
|
23
27
|
payload[:data][:slack][:messages].each do |slack_msg|
|
24
|
-
notifier = slack_notifier
|
25
28
|
msg = slack_msg[:message].to_s
|
26
29
|
msg_attachment = {
|
27
30
|
fallback: msg,
|
@@ -29,19 +32,24 @@ module Jackal
|
|
29
32
|
color: slack_msg[:color],
|
30
33
|
mrkdwn_in: slack_msg.fetch(:markdown, true) ? [:text, :fallback] : []
|
31
34
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
)
|
35
|
+
|
36
|
+
desc = slack_msg.fetch(:description, 'Result:')
|
37
|
+
post_to_slack(desc, [msg_attachment])
|
36
38
|
end
|
39
|
+
payload[:data][:slack].delete(:messages)
|
37
40
|
job_completed(:slack_notification, payload, message)
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
41
|
-
#
|
42
|
-
#
|
43
|
-
|
44
|
-
|
44
|
+
# Post message to Slack
|
45
|
+
#
|
46
|
+
# @param description [String] slack output description
|
47
|
+
# @param attachments [Array<Hash>] slack output attachments
|
48
|
+
# @return [TrueClass]
|
49
|
+
def post_to_slack(description, attachments)
|
50
|
+
notifier = ::Slack::Notifier.new(config[:webhook_url])
|
51
|
+
notifier.ping(description, attachments: attachments)
|
52
|
+
true
|
45
53
|
end
|
46
54
|
|
47
55
|
end
|
data/lib/jackal-slack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackal-slack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heavywater
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jackal
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: carnivore-actor
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
47
61
|
description: Jackal Slack
|
48
62
|
email: support@hw-ops.com
|
49
63
|
executables: []
|
@@ -60,7 +74,7 @@ files:
|
|
60
74
|
- lib/jackal-slack/formatter/error.rb
|
61
75
|
- lib/jackal-slack/notification.rb
|
62
76
|
- lib/jackal-slack/version.rb
|
63
|
-
homepage: http://github.com/
|
77
|
+
homepage: http://github.com/carnivore-rb/jackal-slack
|
64
78
|
licenses:
|
65
79
|
- Apache 2.0
|
66
80
|
metadata: {}
|