jackal-slack 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6980d689b226ec49e46c83345747e323925fc2e3
4
- data.tar.gz: 4088f36b9fa553d802b058d0456b53c7fdba260e
3
+ metadata.gz: f12d0d0ca32f93f7ed568f6f4ae105d326e74ddf
4
+ data.tar.gz: c3bbcb240a03d747127d6d38bf9f4f17990e1c2b
5
5
  SHA512:
6
- metadata.gz: 1a161ae1220298898dd93268a79f4cf4d84f0fff44638234809efb82fd9a3b3c6b0ba2d2fe6b734a9543a6e48c155fb1a698abb83ca6e786d47eaa4552ea7409
7
- data.tar.gz: f0fa4f05aeb87efea26997a7bcef4ba461207e04123430d5d7e274c261fc38bbaeaace6e912f15d202da7a473ddb70110fbd78e4b8276c798c0bb6cabf927c35
6
+ metadata.gz: 5afc1a3d05d5469eb8e7e344f3b5c3240a9781a91948ffe4d87d32da10e620e49653f040485ab6de0f393dc591606c293f6a8d693fa2f8459a142d1637345b7e
7
+ data.tar.gz: 7e91ac42c8750202f7fb8937c100c34ac86fdd7472f9c12c92243f8958c338134b6fb1afc50d3971df2782b01931e11dbb0bffc3c9daf1d677ca945795ce1e0e
@@ -1,4 +1,7 @@
1
- ## v0.1.4
1
+ # v0.1.6
2
+ * Add formatter to handle output formatting for general errors
3
+
4
+ # v0.1.4
2
5
  * Make more items configurable on messages
3
6
  * Enable markdown on messages by default
4
7
  * Add README
@@ -1,5 +1,4 @@
1
1
  require 'jackal'
2
- require 'jackal-slack/version'
3
2
 
4
3
  module Jackal
5
4
  module Slack
@@ -7,3 +6,5 @@ module Jackal
7
6
  end
8
7
  end
9
8
 
9
+ require 'jackal-slack/formatter'
10
+ require 'jackal-slack/version'
@@ -0,0 +1 @@
1
+ require 'jackal-slack/formatter/error'
@@ -0,0 +1,34 @@
1
+ require 'jackal-slack'
2
+
3
+ module Jackal
4
+ module Slack
5
+ module Formatter
6
+ # Format job errors for display
7
+ class Error < Jackal::Formatter
8
+
9
+ # Source service
10
+ SOURCE = '*'
11
+ # Destination service
12
+ DESTINATION = 'slack'
13
+
14
+ # Provide error message output
15
+ #
16
+ # @param payload [Smash]
17
+ def format(payload)
18
+ if(payload[:status] == 'error' && payload[:error])
19
+ msgs = payload.fetch(:data, :slack, :messages, [])
20
+ msgs.push(
21
+ Smash.new(
22
+ :message => "#{payload.get(:error, :reason)} (`#{payload.get(:error, :callback)}`)",
23
+ :color => 'danger',
24
+ :description => "Job Failure (#{payload[:id]})"
25
+ )
26
+ )
27
+ payload.set(:data, :slack, :messages, msgs)
28
+ end
29
+ end
30
+
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,6 +1,6 @@
1
1
  module Jackal
2
2
  module Slack
3
3
  # current library version
4
- VERSION = Gem::Version.new('0.1.4')
4
+ VERSION = Gem::Version.new('0.1.6')
5
5
  end
6
6
  end
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
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heavywater
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jackal
@@ -50,6 +50,8 @@ files:
50
50
  - README.md
51
51
  - jackal-slack.gemspec
52
52
  - lib/jackal-slack.rb
53
+ - lib/jackal-slack/formatter.rb
54
+ - lib/jackal-slack/formatter/error.rb
53
55
  - lib/jackal-slack/notification.rb
54
56
  - lib/jackal-slack/version.rb
55
57
  homepage: http://github.com/heavywater/jackal-slack