capistrano-slack_notification 0.0.1 → 0.0.2

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: 2a456e196bc170b8aa2023432c78699747aaeac8
4
- data.tar.gz: 27ca39f0e60279647fc546970a3acb9199c9fbd2
3
+ metadata.gz: db75cbbae716418d85b53f5c24424bb4ff32eac7
4
+ data.tar.gz: 90d4dc5051f289944c8d6de0ca53a0ccb3707563
5
5
  SHA512:
6
- metadata.gz: c44e5b46efd1365df569adb1f563e229aac416f9bfe802a74d6b531f496bae10e5c7146fcc39625752803ffeb3fec8c585209f0c73af3e9a2ba03ec0b90d05bb
7
- data.tar.gz: e9484ef9e324620fa573397c6e8b3fb8c8a226239797b2650e41857233ab5751c893a5ba66c36bd86424557c11ec10c0d8c14bc1f81d1dc25d0c78e710cf150f
6
+ metadata.gz: 8a0bbfa119e0ea605df96050ba7f150b53d22c7c50dc9bca95412db7fe38f9742b54325fac766afb33480514325c8578871bdd2aa0224d243d34a1d9d78b6992
7
+ data.tar.gz: 20205f1fe862f022d9a95107f47c53fb3c7e23903973f0f8b4efc3a7e5376c6e400c2d0ff97ff803bc029fc9ecd24cc13f996c37c2ebd32fc0a0b84efccdc3c1
data/README.md CHANGED
@@ -43,9 +43,9 @@ set :slack_channel, '#general'
43
43
  set :slack_endpoint, 'https://hooks.slack.com'
44
44
  set :slack_path, '/services/T00000000/B00000000/XXXXXXXXXXXXXXXXX'
45
45
 
46
- after 'deploy:started', 'slack:notify_start'
47
- after 'deploy:finishing', 'slack:notify_finish'
48
- after 'deploy:finishing_rollback', 'slack:notify_rollback'
46
+ after 'deploy:started', 'slack:deploy:start'
47
+ after 'deploy:finishing', 'slack:deploy:finish'
48
+ after 'deploy:finishing_rollback', 'slack:deploy:rollback'
49
49
  ```
50
50
 
51
51
  Contributing
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module SlackNotification
3
- VERSION = "0.0.1"
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ namespace :slack do
10
10
 
11
11
  set :slack_endpoint, 'https://slack.com'
12
12
  set :slack_username, 'capistrano'
13
- set :slack_icon_url, 'https://github.com/linyows/capistrano-slack_notification/misc/capistrano-icon.png'
13
+ set :slack_icon_url, 'https://raw.githubusercontent.com/linyows/capistrano-slack_notification/master/misc/capistrano-icon.png'
14
14
 
15
15
  set :slack_deployer, -> {
16
16
  username = `git config --get user.name`.strip
@@ -33,7 +33,8 @@ namespace :slack do
33
33
  username: fetch(:slack_username),
34
34
  channel: fetch(:slack_channel),
35
35
  icon_url: fetch(:slack_icon_url),
36
- text: ''
36
+ text: '',
37
+ link_names: 1
37
38
  }
38
39
  }
39
40
 
@@ -75,22 +76,26 @@ namespace :slack do
75
76
  }
76
77
 
77
78
  def post_to_slack(message = '')
78
- notify_to_slack_with(title: message)
79
+ post_to_slack_with fetch(:slack_default_body).merge(text: message)
79
80
  end
80
81
 
81
82
  def post_to_slack_with(body)
82
- conn = Faraday.new(fetch :slack_endpoint) do |c|
83
- c.request :url_encoded
84
- c.adapter Faraday.default_adapter
85
- c.options.timeout = 5
86
- c.options.open_timeout = 5
87
- c.response :logger
83
+ run_locally do
84
+ conn = Faraday.new(fetch :slack_endpoint) do |c|
85
+ c.request :url_encoded
86
+ c.adapter Faraday.default_adapter
87
+ c.options.timeout = 5
88
+ c.options.open_timeout = 5
89
+ end
90
+
91
+ res = conn.post fetch(:slack_path), body
92
+
93
+ if ENV['DEBUG']
94
+ require 'awesome_print'
95
+ ap body
96
+ ap res
97
+ end
88
98
  end
89
-
90
- require 'awesome_print'
91
- res = conn.post fetch(:slack_path), body
92
- ap body
93
- ap res
94
99
  end
95
100
 
96
101
  desc 'Post message to Slack (ex. cap production "slack:notify[yo!])"'
@@ -98,19 +103,21 @@ namespace :slack do
98
103
  post_to_slack args[:message]
99
104
  end
100
105
 
101
- desc 'Notify a deploy starting to Slack'
102
- task :notify_start do
103
- post_to_slack_with fetch(:slack_start_body)
104
- end
106
+ namespace :deploy do
107
+ desc 'Notify a deploy starting to Slack'
108
+ task :start do
109
+ post_to_slack_with fetch(:slack_start_body)
110
+ end
105
111
 
106
- desc 'Notify a deploy rollback to Slack'
107
- task :notify_rollback do
108
- post_to_slack_with fetch(
109
- :"slack_#{fetch(:deploying) ? :failure : :success}_body")
110
- end
112
+ desc 'Notify a deploy rollback to Slack'
113
+ task :rollback do
114
+ post_to_slack_with fetch(
115
+ :"slack_#{fetch(:deploying) ? :failure : :success}_body")
116
+ end
111
117
 
112
- desc 'Notify a deploy finish to Slack'
113
- task :notify_finish do
114
- post_to_slack_with fetch(:slack_success_body)
118
+ desc 'Notify a deploy finish to Slack'
119
+ task :finish do
120
+ post_to_slack_with fetch(:slack_success_body)
121
+ end
115
122
  end
116
123
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-slack_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - linyows
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -82,6 +82,7 @@ files:
82
82
  - lib/capistrano/slack_notification.rb
83
83
  - lib/capistrano/slack_notification/version.rb
84
84
  - lib/capistrano/tasks/slack_notification.rake
85
+ - misc/capistrano-icon.png
85
86
  homepage: https://github.com/linyows/capistrano-slack_notification
86
87
  licenses:
87
88
  - MIT
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  version: '0'
103
104
  requirements: []
104
105
  rubyforge_project:
105
- rubygems_version: 2.4.5
106
+ rubygems_version: 2.2.2
106
107
  signing_key:
107
108
  specification_version: 4
108
109
  summary: Notify Capistrano deployment to Slack.