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: cfc1a1b79468f75feab46ebf083d00d8411075b8
4
- data.tar.gz: 74986a47b8b44aece6bcf10ae7d6170b2081f7a4
3
+ metadata.gz: af12e61d4578b21bdcdff8f57c51e2bebacab3c1
4
+ data.tar.gz: becaf60c672e51fd7c68090a94471a2ac0d92300
5
5
  SHA512:
6
- metadata.gz: df0313a786ae120a27705d7822c95a1955deb9165370c0cbe8e455075b954dc1ce9eb41929ee06f8591cae1e8b447a0830637a5888be50917761a1ee66a01a63
7
- data.tar.gz: dc32646913a04454039840f4e2e26edc9716c10891650874e7c06170e03ceacf0db8538ddfc7eae94621a14259d4a6c8c7bb11126dbf56b60109ca345f7a0e50
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 :irc_user, 'capistrano'
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
- name = fetch(:slack_user) || nil
32
- channel = fetch(:slack_channel) || nil
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: name, channel: channel }.reject { |_x, y| y.nil? }
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
@@ -1,5 +1,5 @@
1
1
  module Capistrano3
2
2
  module Notification
3
- VERSION = '0.0.3'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - masarakki