capistrano3-notification 0.1.1 → 0.2.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: 25a8933628d07ceacd3ec62fa4a90ce8fbdcdbfc
4
- data.tar.gz: a0e8e7b144e6e126d478ef2df066800cef41928a
3
+ metadata.gz: 21616767890c4e45b6ee17056648b909b7aa1739
4
+ data.tar.gz: 4072825cf9dd634c6b6f9221c2e750275e61decf
5
5
  SHA512:
6
- metadata.gz: c85805264a8cf7d34f03d4eef836ba2562f8dfe35e06fdf58c2c9186546336c9e7d94f2cafcb4d4652423a961e04f200bda15a63833863be6d5f7074602da902
7
- data.tar.gz: 95b094bbefb35116b3039faa5cb78730f1fec066e083b53fab9f247348697749b3d4985d5cec6ea7b95ef88ccd3a4c3242496460c58fc0564974a4bce40ef002
6
+ metadata.gz: 6021fccdb4ecf4dd2fe45455a30964d8dbd719dccd943bdff5d23297531c1017ec3bb6513c511fe6602d3aa6b1356a1442fe46f809dde7b7086a449596cd4335
7
+ data.tar.gz: e5894c79f74446570284dd1bb91fbe2b79d580377748fc194f1848a606ab0711f5f682b052cbc5b297d28aa3e84a8810347edb199b6990d525c9b05be048e618
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: false
1
4
  rvm:
2
- - 2.0.0
3
- - 2.1.4
5
+ - 2.2.5
6
+ - 2.3.1
4
7
  script:
5
8
  - bundle exec rubocop
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 :irc_user, 'myproject' # default: 'capistrano'
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 :notify do
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 = fetch(:notification)
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 = fetch(:notification)
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:notify'
64
+ after 'deploy:finished', 'notification:notify_auto'
60
65
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano3
2
2
  module Notification
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  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.1.1
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: 2014-11-26 00:00:00.000000000 Z
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.2.2
137
+ rubygems_version: 2.5.1
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: notification for capistrano-3.x