capistrano-slack-notify 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/capistrano/slack_notify.rb +32 -2
  3. metadata +3 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9c9d876cacd0930358b88ea764e8ce08f7fa8c66
4
- data.tar.gz: 932471917989dd5d0880fbd9d1a43bbba2c8da58
2
+ SHA256:
3
+ metadata.gz: 57a0eb2944158579496371339f532570ea04f016648aa85d4c55e70e520713b0
4
+ data.tar.gz: c4e878e1e4c8b7161ffcf63fc589840042fb72f64cec753d12c3df8f3a018429
5
5
  SHA512:
6
- metadata.gz: 831773b7cc6134d67eb8342d5849d87c69107c7e84ce6e6efb81d50c2ec722430a8852f4cbe87be7c7fd633ee75fc45f67f976a3e2148cee3273194e34e8faab
7
- data.tar.gz: 26ea4854388dcb8ff287857ab2ec639664b272bed4614c772d2704f90ec0ef4ae108ce37d8fd47da72492045999586a03a2df605ebf7d2195f714ee6a1b0305b
6
+ metadata.gz: 7302c7b62de1ed8404ee02b57499ed86eec0986d5c9fce2f2d7bad9630591b18653d4a09ca143450152bc2e2fbf63bc82f12098dfec0d41f6b1a284d73b9b409
7
+ data.tar.gz: 5b18dbd6dde80468e34ec77855bf62a71800bec5b3a4a504bf50c3b9769cfd4f599770a97ae6cea5b642f55bcef578a107590c45388424d7797d50e3aa510b07
@@ -95,12 +95,32 @@ module Capistrano
95
95
  fetch(:repository, 'origin')
96
96
  end
97
97
 
98
+ def revision_from_branch
99
+ `git ls-remote #{repository} #{branch}`.split(' ').first
100
+ end
101
+
98
102
  def rev
99
- @rev ||= `git ls-remote #{repository} #{branch}`.split(" ").first
103
+ @rev ||= if @branch.nil?
104
+ fetch(:revision)
105
+ else
106
+ revision_from_branch
107
+ end
108
+ end
109
+
110
+ def branch
111
+ @branch ||= fetch(:branch, '')
112
+ end
113
+
114
+ def slack_app_and_branch
115
+ if branch.nil?
116
+ slack_app_name
117
+ else
118
+ [slack_app_name, branch].join('/')
119
+ end
100
120
  end
101
121
 
102
122
  def deploy_target
103
- [slack_app_name, branch].join('/') + (rev ? " (#{rev[0..5]})" : "")
123
+ slack_app_and_branch + (rev ? " (#{rev[0..5]})" : '')
104
124
  end
105
125
 
106
126
  def self.extended(configuration)
@@ -113,10 +133,20 @@ module Capistrano
113
133
  namespace :slack do
114
134
  desc "Notify Slack that the deploy has started."
115
135
  task :starting do
136
+
137
+ on_rollback do
138
+ post_to_channel(:red, "#{deployer} *failed* to deploy #{deploy_target} to #{destination}")
139
+ end
140
+
116
141
  post_to_channel(:grey, "#{deployer} is deploying #{deploy_target} to #{destination}")
117
142
  set(:start_time, Time.now)
118
143
  end
119
144
 
145
+ desc "Notify Slack that the rollback has completed."
146
+ task :rolled_back do
147
+ post_to_channel(:green, "#{deployer} has rolled back #{deploy_target}")
148
+ end
149
+
120
150
  desc "Notify Slack that the deploy has completed successfully."
121
151
  task :finished do
122
152
  msg = "#{deployer} deployed #{deploy_target} to #{destination} *successfully*"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-slack-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.10'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.7'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.7'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
66
  - !ruby/object:Gem::Version
81
67
  version: '0'
82
68
  requirements: []
83
- rubyforge_project:
84
- rubygems_version: 2.5.1
69
+ rubygems_version: 3.0.3
85
70
  signing_key:
86
71
  specification_version: 4
87
72
  summary: Minimalist Capistrano 2 notifier for Slack.