capistrano-slackify 2.9.0 → 2.10.0

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
- SHA1:
3
- metadata.gz: 2c1ce687a6a8d75cb09a1d5f1e1b4011548cb9c7
4
- data.tar.gz: 333a05e6aeb30849c73484471ab1e7bc0a35aff0
2
+ SHA256:
3
+ metadata.gz: 35fc2f96960796099362bb09b57bbf525d3107c0a845c1a704cdc35dedca6ce3
4
+ data.tar.gz: 182a06a52fc60b0ad7545322e1778ed4ab98ff0d6391df8385c386417ffce0df
5
5
  SHA512:
6
- metadata.gz: 0bf327f9e7abea13eecffffb4ce555565ba006825c644c77010075553645117255bb00886a367d67d097b54ff1a845768c126a93435254a3244476819580a50f
7
- data.tar.gz: 1af5d9defc5846fad95a6b7590fedef9d46ed665f72f8e4af57bcf2d7dd22ccca9af91d0616df1e792ae230c0246649870c6ba3739de0842ade2ac8c43a8fb60
6
+ metadata.gz: 3c4e34ca96039293f2f97946ec3714ce56f95be0ed1a885546b699faa0beb8a4ba9a4a927b0a66cda9b1ba6de1f45b926409cc0a082c4fdb524f6a10384ce563
7
+ data.tar.gz: 88f52f67ba1a25b93aff6f911eb4ed3692d8376e275cc294d8556a57bec0d7d8051082d81bd48777cc8b1479cb45f056a176d7a23f46297ccc27153539384168
data/README.md CHANGED
@@ -53,7 +53,7 @@ As with the other tasks, it is also possible to notify failures manually:
53
53
 
54
54
  Any of the defaults can be over-ridden in `config/deploy.rb`:
55
55
 
56
- set :slack_channel, '#devops'
56
+ set :slack_channel, ['#devops', '#other-channel']
57
57
  set :slack_username, 'Deploybot'
58
58
  set :slack_emoji, ':trollface:'
59
59
  set :slack_user, ENV['GIT_AUTHOR_NAME']
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'capistrano-slackify'
7
- spec.version = '2.9.0'
7
+ spec.version = '2.10.0'
8
8
  spec.authors = ['seenmyfate']
9
9
  spec.email = ['seenmyfate@gmail.com']
10
10
  spec.summary = %q{Publish deployment notifications to Slack via the incoming webhooks integration}
@@ -7,10 +7,11 @@ namespace :slack do
7
7
 
8
8
  if fetch(:slack_notify_events).include? :started
9
9
  info 'Notifying Slack of deploy starting'
10
-
11
- execute :curl, '-X POST', '-s', '--data-urlencode',
12
- Slackify::Payload.build(self, :starting),
13
- fetch(:slack_url)
10
+ Array(fetch(:slack_channel)).each {|channel|
11
+ execute :curl, '-X POST', '-s', '--data-urlencode',
12
+ Slackify::Payload.build(self, :starting, channel),
13
+ fetch(:slack_url)
14
+ }
14
15
  end
15
16
  end
16
17
  end
@@ -24,11 +25,12 @@ namespace :slack do
24
25
 
25
26
  if fetch(:slack_notify_events).include? :finished
26
27
  info 'Notifying Slack of deploy finished'
27
-
28
- execute :curl, '-X POST', '-s', '--data-urlencode',
29
- Slackify::Payload.build(self, :success),
30
- fetch(:slack_url)
31
- end
28
+ Array(fetch(:slack_channel)).each {|channel|
29
+ execute :curl, '-X POST', '-s', '--data-urlencode',
30
+ Slackify::Payload.build(self, :success, channel),
31
+ fetch(:slack_url)
32
+ }
33
+ end
32
34
  end
33
35
  end
34
36
  after 'deploy:finished', 'slack:notify_finished'
@@ -42,9 +44,11 @@ namespace :slack do
42
44
  if fetch(:slack_notify_events).include? :failed
43
45
  info 'Notifying Slack of deploy failed'
44
46
 
45
- execute :curl, '-X POST', '-s', '--data-urlencode',
46
- Slackify::Payload.build(self, :failed),
47
- fetch(:slack_url)
47
+ Array(fetch(:slack_channel)).each {|channel|
48
+ execute :curl, '-X POST', '-s', '--data-urlencode',
49
+ Slackify::Payload.build(self, :failed, channel),
50
+ fetch(:slack_url)
51
+ }
48
52
  end
49
53
  end
50
54
  end
@@ -53,7 +57,7 @@ end
53
57
 
54
58
  namespace :load do
55
59
  task :defaults do
56
- set :slack_channel, '#general'
60
+ set :slack_channel, ['#general']
57
61
  set :slack_username, 'Capistrano'
58
62
  set :slack_emoji, ':ghost:'
59
63
  set :slack_parse, 'default'
@@ -8,15 +8,15 @@ module Slackify
8
8
  @status = status
9
9
  end
10
10
 
11
- def self.build(context, status)
12
- new(context, status).build
11
+ def self.build(context, status, channel)
12
+ new(context, status).build(channel)
13
13
  end
14
14
 
15
- def build
16
- "'payload=#{payload}'"
15
+ def build(channel)
16
+ "'payload=#{payload(channel)}'"
17
17
  end
18
18
 
19
- def payload
19
+ def payload(channel)
20
20
  fields = fetch(:slack_fields).each_with_object([]) { |field, fields|
21
21
  if fields_map[field].fetch(:value).respond_to?(:call)
22
22
  field_data = fields_map[field]
@@ -29,7 +29,7 @@ module Slackify
29
29
 
30
30
  MultiJson.dump(
31
31
  {
32
- channel: fetch(:slack_channel),
32
+ channel: channel,
33
33
  username: fetch(:slack_username),
34
34
  icon_emoji: fetch(:slack_emoji),
35
35
  parse: fetch(:slack_parse),
@@ -6,7 +6,7 @@ module Slackify
6
6
  let(:context) {
7
7
  {
8
8
  slack_channel: '#general',
9
- slack_username:'Capistrano',
9
+ slack_username: 'Capistrano',
10
10
  slack_emoji: ':ghost:',
11
11
  slack_parse: 'default',
12
12
  slack_user: 'You',
@@ -42,7 +42,11 @@ module Slackify
42
42
  let(:text) { context.fetch(:slack_text) }
43
43
 
44
44
  let(:builded_payload) {
45
- Payload.build(context, :success)
45
+ Payload.build(context, :success, slack_channel)
46
+ }
47
+
48
+ let(:slack_channel) {
49
+ context.fetch(:slack_channel)
46
50
  }
47
51
 
48
52
  it 'returns the payload with the specified text' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-slackify
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - seenmyfate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2018-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.5.1
124
+ rubygems_version: 2.7.2
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Publish deployment notifications to Slack via the incoming webhooks integration