capistrano3-notification 0.0.3 → 0.1.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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af12e61d4578b21bdcdff8f57c51e2bebacab3c1
|
4
|
+
data.tar.gz: becaf60c672e51fd7c68090a94471a2ac0d92300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea867a1676da99138ca7e558c36a52a51f945657f52579215af6792cfd7344ea8520bdb848b5ad96d648262a0cc580a06d265b2abc87d9aaa5671588d2c14204
|
7
|
+
data.tar.gz: f97263174f48b16743d5974a5c94f324accc74ddeef362e0572c863808d27a6b9ab97bda1419989083627a9a24c643ede4e3b67930585afc806f54aeda6af7a9
|
@@ -1,21 +1,23 @@
|
|
1
1
|
namespace :load do
|
2
2
|
task :defaults do
|
3
3
|
set :irc_port, 6667
|
4
|
-
set :
|
5
|
-
set :slack_user, 'capistrano'
|
4
|
+
set :notifier, 'capistrano'
|
6
5
|
set :notification, -> { "#{fetch(:application)} was deployed to #{fetch(:stage)}" }
|
7
6
|
end
|
8
7
|
end
|
9
8
|
|
10
9
|
namespace :notification do
|
11
10
|
task :notify do
|
11
|
+
deprecated :irc_user, :notifier if fetch(:irc_user)
|
12
|
+
deprecated :slack_user, :notifier if fetch(:slack_user)
|
13
|
+
|
12
14
|
%w(irc slack).each do |adapter|
|
13
15
|
invoke "notification:#{adapter}"
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
19
|
task :irc do
|
18
|
-
user = fetch(:irc_user)
|
20
|
+
user = fetch(:irc_user) || fetch(:notifier)
|
19
21
|
host = fetch(:irc_host)
|
20
22
|
port = fetch(:irc_port)
|
21
23
|
channel = fetch(:irc_channel)
|
@@ -28,13 +30,13 @@ namespace :notification do
|
|
28
30
|
|
29
31
|
task :slack do
|
30
32
|
webhook_url = fetch(:slack_webhook_url)
|
31
|
-
|
32
|
-
channel = fetch(:slack_channel)
|
33
|
+
user = fetch(:slack_user) || fetch(:notifier)
|
34
|
+
channel = fetch(:slack_channel)
|
33
35
|
icon = fetch(:slack_icon) || nil
|
34
36
|
message = fetch(:notification)
|
35
|
-
return unless webhook_url && message
|
37
|
+
return unless user && channel && webhook_url && message
|
36
38
|
require 'slack-notifier'
|
37
|
-
notifier_options = { username:
|
39
|
+
notifier_options = { username: user, channel: channel }.reject { |_x, y| y.nil? }
|
38
40
|
icon_type = case icon
|
39
41
|
when /^:.+:/
|
40
42
|
:icon_emoji
|
@@ -50,5 +52,9 @@ namespace :notification do
|
|
50
52
|
notifier.ping message, ping_options
|
51
53
|
end
|
52
54
|
|
55
|
+
def deprecated(old, new)
|
56
|
+
puts format('%6s %s', 'WARN'.red, ":#{old} is deplicated. use set :#{new}, '#{fetch(old)}'")
|
57
|
+
end
|
58
|
+
|
53
59
|
after 'deploy:finished', 'notification:notify'
|
54
60
|
end
|