jackal-slack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f4e069d97855cb4b0318683b0ff4556fd03fbe87
4
+ data.tar.gz: 3a9e29c5938f89f0efa960977a5e8f6905b8b2ec
5
+ SHA512:
6
+ metadata.gz: 3d2f18686affee05e9a754a35d28898e685102ae3c1378da35c29b81d35ae8c9d88de69b68a10eb42c5a3509ad2bc256ac744e129cef0ca85f4126925cb963bd
7
+ data.tar.gz: 7d97debffc22395df2e4cf950346b7ebe209d078b3018a38047253f9daafd2ddc9b288ca8197ec7c3edc169f20e2f2a8c26c44cebe697064eccb6e72b83fa08b
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) + '/lib/'
2
+ require 'jackal-slack/version'
3
+ Gem::Specification.new do |s|
4
+ s.name = 'jackal-slack'
5
+ s.version = Jackal::Slack::VERSION.version
6
+ s.summary = 'Jackal Slack'
7
+ s.author = 'Heavywater'
8
+ s.email = 'support@hw-ops.com'
9
+ s.homepage = 'http://github.com/heavywater/jackal-slack'
10
+ s.description = 'Jackal Slack'
11
+ s.require_path = 'lib'
12
+ s.add_dependency 'jackal'
13
+ s.add_dependency 'slack-notifier'
14
+ s.files = Dir['**/*']
15
+ end
@@ -0,0 +1,9 @@
1
+ require 'jackal'
2
+ require 'jackal-slack/version'
3
+
4
+ module Jackal
5
+ module Slack
6
+ autoload :Notification, 'jackal-slack/notification'
7
+ end
8
+ end
9
+
@@ -0,0 +1,46 @@
1
+ require 'jackal-slack'
2
+ module Jackal
3
+ # Status on Slack
4
+ module Slack
5
+ class Notification < Jackal::Callback
6
+
7
+ def setup(*_)
8
+ require 'slack-notifier'
9
+ end
10
+
11
+ # Validity of message
12
+ #
13
+ # @param message [Carnivore::Message]
14
+ # @return [Truthy, Falsey]
15
+ def valid?(message)
16
+ super do |payload|
17
+ payload.get(:data, :slack)
18
+ end
19
+ end
20
+
21
+ def execute(message)
22
+ failure_wrap(message) do |payload|
23
+ payload[:data][:slack][:messages].each do |slack_msg|
24
+ notifier = slack_notifier
25
+ msg = slack_msg[:message].to_s
26
+ a_ok_note = {
27
+ fallback: msg,
28
+ text: msg,
29
+ color: slack_msg[:color]
30
+ }
31
+ notifier.ping(msg, attachments: [a_ok_note])
32
+ end
33
+
34
+ job_completed(:slack_notification, payload, message)
35
+ end
36
+ end
37
+
38
+ # Return slack_notifier object using team & token from data or config
39
+ # depending on what's loaded in the environment
40
+ def slack_notifier
41
+ ::Slack::Notifier.new(config(:team), config(:token))
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,6 @@
1
+ module Jackal
2
+ module Slack
3
+ # current library version
4
+ VERSION = Gem::Version.new('0.1.0')
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jackal-slack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Heavywater
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jackal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: slack-notifier
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Jackal Slack
42
+ email: support@hw-ops.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - CHANGELOG.md
48
+ - README.md
49
+ - jackal-slack.gemspec
50
+ - lib/jackal-slack.rb
51
+ - lib/jackal-slack/notification.rb
52
+ - lib/jackal-slack/version.rb
53
+ homepage: http://github.com/heavywater/jackal-slack
54
+ licenses: []
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.2.2
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Jackal Slack
76
+ test_files: []
77
+ has_rdoc: