capistrano-slack_notification 0.1.0 → 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: 8b66e86a0a879cdff824b86b70a7815e65f2a15e
4
- data.tar.gz: 3ecf96b8746375b1fc7ef8a4a60bb1ea82e78ec9
3
+ metadata.gz: 5a3751a9dbea2e8a4dc7f4aad0662930a71c50a1
4
+ data.tar.gz: 2a5eff99e99f41fd0ed59a793ed787be3ec5ac45
5
5
  SHA512:
6
- metadata.gz: ab8235df16b61cda6d4591dbc5fdb25e5e9f35a178f04744492f87c5cd8400ada4cb7aa4ffe403cf955ba487e36daf3cb69e91a5cc7c5c04acba9cf70c6105c8
7
- data.tar.gz: 8caac8579ce6fb0ac1333e6ff45f1499634d41210f713ddf9a107d36c3799931b7003b002e946fc7eb2b6ef5859d046f0c1d8a38b6d2be786b20c09f22e7fa65
6
+ metadata.gz: 5d8241e1d74a8a6c4e5715a344e4ba6c8ee1b6739d80912e30fe75fb0acc9ff4cecb408ddc0ef950c0cbdd540c90c8a436dd1abd3fb53e52cf275a5be84e69c5
7
+ data.tar.gz: 5614e1ddbf62d81c0a39ec31a93195fbcddf0cf2a5861ffa7e535bab92395f5fe7ca8b86068944e7be01e8c68a354e19ae69b7697160077eaaa90ed1d5b8e914
data/README.md CHANGED
@@ -3,6 +3,8 @@ Capistrano - Slack Notification
3
3
 
4
4
  Notify Capistrano ver3 deployment to Slack.
5
5
 
6
+ ![slack-notification-preview](https://raw.githubusercontent.com/linyows/capistrano-slack_notification/master/misc/preview.png)
7
+
6
8
  [![Gem version](https://img.shields.io/gem/v/capistrano-slack_notification.svg?style=flat-square)][gem]
7
9
  [gem]: https://rubygems.org/gems/capistrano-slack_notification
8
10
 
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module SlackNotification
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -48,30 +48,38 @@ namespace :slack do
48
48
  text = "Started deploying to #{fetch(:slack_stage)} by @#{fetch(:slack_deployer)}" +
49
49
  " (branch #{fetch(:branch)})"
50
50
 
51
- fetch(:slack_default_body).merge(
52
- attachments: JSON.dump([{
53
- color: "warning",
54
- title: fetch(:application),
55
- text: text,
56
- fallback: text,
57
- mrkdwn_in: ['text']
58
- }])
59
- )
51
+ attachments = [{
52
+ color: "warning",
53
+ title: fetch(:application),
54
+ text: text,
55
+ fallback: text,
56
+ mrkdwn_in: ['text']
57
+ }]
58
+
59
+ if fetch(:slack_token)
60
+ fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
61
+ else
62
+ JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
63
+ end
60
64
  }
61
65
 
62
66
  set :slack_failure_body, -> {
63
67
  text = "Failed deploying to #{fetch(:slack_stage)} by @#{fetch(:slack_deployer)}" +
64
68
  " (branch #{fetch(:branch)} at #{fetch(:current_revision)} / #{elapsed_time.call} sec)"
65
69
 
66
- fetch(:slack_default_body).merge(
67
- attachments: JSON.dump([{
70
+ attachments = [{
68
71
  color: 'danger',
69
72
  title: fetch(:application),
70
73
  text: text,
71
74
  fallback: text,
72
75
  mrkdwn_in: ['text']
73
- }])
74
- )
76
+ }]
77
+
78
+ if fetch(:slack_token)
79
+ fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
80
+ else
81
+ JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
82
+ end
75
83
  }
76
84
 
77
85
  set :slack_success_body, -> {
@@ -79,15 +87,19 @@ namespace :slack do
79
87
  text = "Successful #{task} to #{fetch(:slack_stage)} by @#{fetch(:slack_deployer)}" +
80
88
  " (branch #{fetch(:branch)} at #{fetch(:current_revision)} / #{elapsed_time.call} sec)"
81
89
 
82
- fetch(:slack_default_body).merge(
83
- attachments: JSON.dump([{
84
- color: 'good',
85
- title: fetch(:application),
86
- text: text,
87
- fallback: text,
88
- mrkdwn_in: ['text']
89
- }])
90
- )
90
+ attachments = [{
91
+ color: 'good',
92
+ title: fetch(:application),
93
+ text: text,
94
+ fallback: text,
95
+ mrkdwn_in: ['text']
96
+ }]
97
+
98
+ if fetch(:slack_token)
99
+ fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
100
+ else
101
+ JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
102
+ end
91
103
  }
92
104
 
93
105
  set :slack_client, -> {
data/misc/preview.png ADDED
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.1.0
4
+ version: 0.2.0
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-27 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -70,6 +70,7 @@ files:
70
70
  - lib/capistrano/slack_notification/version.rb
71
71
  - lib/capistrano/tasks/slack_notification.rake
72
72
  - misc/capistrano-icon.png
73
+ - misc/preview.png
73
74
  homepage: https://github.com/linyows/capistrano-slack_notification
74
75
  licenses:
75
76
  - MIT
@@ -90,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  version: '0'
91
92
  requirements: []
92
93
  rubyforge_project:
93
- rubygems_version: 2.2.2
94
+ rubygems_version: 2.4.5
94
95
  signing_key:
95
96
  specification_version: 4
96
97
  summary: Notify Capistrano deployment to Slack.