capistrano3-notification 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/README.md +2 -2
- data/lib/capistrano3/notification/tasks/notification.rake +14 -9
- data/lib/capistrano3/notification/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21616767890c4e45b6ee17056648b909b7aa1739
|
4
|
+
data.tar.gz: 4072825cf9dd634c6b6f9221c2e750275e61decf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6021fccdb4ecf4dd2fe45455a30964d8dbd719dccd943bdff5d23297531c1017ec3bb6513c511fe6602d3aa6b1356a1442fe46f809dde7b7086a449596cd4335
|
7
|
+
data.tar.gz: e5894c79f74446570284dd1bb91fbe2b79d580377748fc194f1848a606ab0711f5f682b052cbc5b297d28aa3e84a8810347edb199b6990d525c9b05be048e618
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ in `deploy.rb` or staging files:
|
|
26
26
|
set :irc_host, 'example.com'
|
27
27
|
set :irc_port, 16667 # default: 6667
|
28
28
|
set :irc_channel, '#notice'
|
29
|
-
set :
|
29
|
+
set :notifier, 'myproject' # default: 'capistrano'
|
30
30
|
set :notification, -> { "#{fetch(:application)} was deployed to #{fetch(:stage)}" } # this message is default
|
31
31
|
```
|
32
32
|
|
@@ -34,10 +34,10 @@ set :notification, -> { "#{fetch(:application)} was deployed to #{fetch(:stage)}
|
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
set :slack_webhook_url, 'https://hooks.slack.com/services/EX/AM/PLE'
|
37
|
-
set :slack_user, 'myproject' # default: 'capistrano'
|
38
37
|
set :slack_channel, '#notice'
|
39
38
|
set :slack_icon, ':ghost:' # use emoji
|
40
39
|
set :slack_icon, 'http://example.com/icon.png' # use image
|
40
|
+
set :notifier, 'myproject' # default: 'capistrano'
|
41
41
|
set :notification, -> { "#{fetch(:application)} was deployed to #{fetch(:stage)}" } # this message is default
|
42
42
|
```
|
43
43
|
|
@@ -7,33 +7,39 @@ namespace :load do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
namespace :notification do
|
10
|
-
task :
|
10
|
+
task :notify_auto do
|
11
|
+
invoke 'notification:notify', fetch(:notification)
|
12
|
+
end
|
13
|
+
|
14
|
+
task :notify, [:message] do |t, args|
|
11
15
|
deprecated :irc_user, :notifier if fetch(:irc_user)
|
12
16
|
deprecated :slack_user, :notifier if fetch(:slack_user)
|
13
17
|
|
14
18
|
%w(irc slack).each do |adapter|
|
15
|
-
invoke "notification:#{adapter}"
|
19
|
+
invoke "notification:#{adapter}", args[:message]
|
16
20
|
end
|
21
|
+
t.reenable
|
17
22
|
end
|
18
23
|
|
19
|
-
task :irc do
|
24
|
+
task :irc, [:message] do |t, args|
|
20
25
|
user = fetch(:irc_user) || fetch(:notifier)
|
21
26
|
host = fetch(:irc_host)
|
22
27
|
port = fetch(:irc_port)
|
23
28
|
channel = fetch(:irc_channel)
|
24
|
-
message =
|
29
|
+
message = args[:message]
|
25
30
|
next unless user && host && port && channel && message
|
26
31
|
require 'shout-bot'
|
27
32
|
url = "irc://#{user}@#{host}:#{port}/#{channel}"
|
28
33
|
ShoutBot.shout(url) { |irc| irc.say message }
|
34
|
+
t.reenable
|
29
35
|
end
|
30
36
|
|
31
|
-
task :slack do
|
37
|
+
task :slack, [:message] do |t, args|
|
32
38
|
webhook_url = fetch(:slack_webhook_url)
|
33
39
|
user = fetch(:slack_user) || fetch(:notifier)
|
34
40
|
channel = fetch(:slack_channel)
|
35
41
|
icon = fetch(:slack_icon) || nil
|
36
|
-
message =
|
42
|
+
message = args[:message]
|
37
43
|
next unless user && channel && webhook_url && message
|
38
44
|
require 'slack-notifier'
|
39
45
|
notifier_options = { username: user, channel: channel }.reject { |_x, y| y.nil? }
|
@@ -42,19 +48,18 @@ namespace :notification do
|
|
42
48
|
:icon_emoji
|
43
49
|
when /^http/
|
44
50
|
:icon_url
|
45
|
-
else
|
46
|
-
nil
|
47
51
|
end
|
48
52
|
ping_options = {}.tap do |h|
|
49
53
|
h[icon_type] = icon if icon_type
|
50
54
|
end
|
51
55
|
notifier = Slack::Notifier.new webhook_url, notifier_options
|
52
56
|
notifier.ping message, ping_options
|
57
|
+
t.reenable
|
53
58
|
end
|
54
59
|
|
55
60
|
def deprecated(old, new)
|
56
61
|
puts format('%6s %s', 'WARN'.red, ":#{old} is deplicated. use set :#{new}, '#{fetch(old)}'")
|
57
62
|
end
|
58
63
|
|
59
|
-
after 'deploy:finished', 'notification:
|
64
|
+
after 'deploy:finished', 'notification:notify_auto'
|
60
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano3-notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masarakki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: notification for capistrano-3.x
|