slackistrano 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/README.md +25 -1
- data/lib/slackistrano/messaging/base.rb +7 -1
- data/lib/slackistrano/messaging/default.rb +4 -0
- data/lib/slackistrano/messaging/null.rb +4 -0
- data/lib/slackistrano/tasks/slack.rake +14 -6
- data/lib/slackistrano/version.rb +1 -1
- data/spec/capistrano_deploy_stubs.rake +2 -0
- data/spec/disabling_posting_to_slack_spec.rb +1 -1
- data/spec/dry_run_spec.rb +1 -1
- data/spec/posting_to_multiple_channels_spec.rb +1 -1
- data/spec/task_hooks_spec.rb +5 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6360f02d5cef2b9905f62b56bc447c20f19ead2c2eb395c5d75fab47acac5b40
|
4
|
+
data.tar.gz: 5fc2245b992c98e4e48cbe8ba648d7a6b990947c054614acb6b4946dba848817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3eb27e2685c88ad3a6961ab78e9b568d13becdcfbac9a94f0b7bb51d43d7b91121acfab080718276efdffe6fd33900c0d6a0897079528c7e8020c7fac2b526
|
7
|
+
data.tar.gz: 53df379711d05ff2b08f0ec98d5b42ecfacb9f07790f6412839f039fd16230e677a46463c1945c2a747e2f544733e4d52baf6499ed2d265e675e5d06166ef647
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Slackistrano Change Log
|
2
2
|
|
3
|
+
4.0.2
|
4
|
+
-----
|
5
|
+
|
6
|
+
- Make it possible to overwrite all slackistrano hooks [#98]
|
7
|
+
|
8
|
+
4.0.1
|
9
|
+
-----
|
10
|
+
|
11
|
+
- Send message on deploy:starting in addition to deploy:updating [#93]
|
12
|
+
|
3
13
|
4.0.0
|
4
14
|
-----
|
5
15
|
|
@@ -63,4 +73,3 @@
|
|
63
73
|
- **BREAKING:** Renamed all `***_starting` settings to `***_updating`
|
64
74
|
- **BREAKING:** Renamed all `***_finished` settings to `***_updated`
|
65
75
|
- Added rollback options `***_reverting` and `***_reverted` [#19, #31]
|
66
|
-
|
data/README.md
CHANGED
@@ -100,6 +100,25 @@ $ cap production slack:deploy:test
|
|
100
100
|
Deploy your application like normal and you should see messages in the channel
|
101
101
|
you specified.
|
102
102
|
|
103
|
+
## Customizing the hooks
|
104
|
+
|
105
|
+
If you wish to take control over when and what slackistrano hooks are fired, then you can use the option in `deploy.rb`:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
set :use_custom_slackistrano_hooks, true
|
109
|
+
```
|
110
|
+
|
111
|
+
This allows you to set custom hooks for all the slackistrano tasks:
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
'slack:deploy:starting'
|
115
|
+
'slack:deploy:updating'
|
116
|
+
'slack:deploy:reverting'
|
117
|
+
'slack:deploy:updated'
|
118
|
+
'slack:deploy:reverted'
|
119
|
+
'slack:deploy:failed'
|
120
|
+
```
|
121
|
+
|
103
122
|
## Customizing the Messaging
|
104
123
|
|
105
124
|
You can customize the messaging posted to Slack by providing your own messaging
|
@@ -120,6 +139,11 @@ if defined?(Slackistrano::Messaging)
|
|
120
139
|
end
|
121
140
|
end
|
122
141
|
|
142
|
+
# Suppress starting message.
|
143
|
+
def payload_for_starting
|
144
|
+
nil
|
145
|
+
end
|
146
|
+
|
123
147
|
# Suppress updating message.
|
124
148
|
def payload_for_updating
|
125
149
|
nil
|
@@ -216,7 +240,7 @@ To set this up:
|
|
216
240
|
|
217
241
|
## Disabling posting to Slack
|
218
242
|
|
219
|
-
You can disable deployment notifications to a specific stage by setting the `:slackistrano`
|
243
|
+
You can disable deployment notifications to a specific stage by setting the `:slackistrano`
|
220
244
|
configuration variable to `false` instead of actual settings.
|
221
245
|
|
222
246
|
```ruby
|
@@ -22,12 +22,18 @@ module Slackistrano
|
|
22
22
|
@webhook = options.delete(:webhook)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def payload_for_starting
|
26
26
|
{
|
27
27
|
text: "#{deployer} has started deploying branch #{branch} of #{application} to #{stage}"
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
31
|
+
def payload_for_updating
|
32
|
+
{
|
33
|
+
text: "#{deployer} is deploying branch #{branch} of #{application} to #{stage}"
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
31
37
|
def payload_for_reverting
|
32
38
|
{
|
33
39
|
text: "#{deployer} has started rolling back branch #{branch} of #{application} to #{stage}"
|
@@ -1,6 +1,11 @@
|
|
1
1
|
namespace :slack do
|
2
2
|
namespace :deploy do
|
3
3
|
|
4
|
+
desc 'Notify about starting deploy'
|
5
|
+
task :starting do
|
6
|
+
Slackistrano::Capistrano.new(self).run(:starting)
|
7
|
+
end
|
8
|
+
|
4
9
|
desc 'Notify about updating deploy'
|
5
10
|
task :updating do
|
6
11
|
Slackistrano::Capistrano.new(self).run(:updating)
|
@@ -27,15 +32,18 @@ namespace :slack do
|
|
27
32
|
end
|
28
33
|
|
29
34
|
desc 'Test Slack integration'
|
30
|
-
task :test => %i[updating updated reverting reverted failed] do
|
35
|
+
task :test => %i[starting updating updated reverting reverted failed] do
|
31
36
|
# all tasks run as dependencies
|
32
37
|
end
|
33
38
|
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
|
-
|
38
|
-
before 'deploy:
|
39
|
-
|
40
|
-
|
41
|
-
after 'deploy:
|
42
|
+
unless fetch(:use_custom_slackistrano_hooks, false)
|
43
|
+
before 'deploy:starting', 'slack:deploy:starting'
|
44
|
+
before 'deploy:updating', 'slack:deploy:updating'
|
45
|
+
before 'deploy:reverting', 'slack:deploy:reverting'
|
46
|
+
after 'deploy:finishing', 'slack:deploy:updated'
|
47
|
+
after 'deploy:finishing_rollback', 'slack:deploy:reverted'
|
48
|
+
after 'deploy:failed', 'slack:deploy:failed'
|
49
|
+
end
|
data/lib/slackistrano/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe Slackistrano do
|
|
6
6
|
set :slackistrano, false
|
7
7
|
end
|
8
8
|
|
9
|
-
%w[updating reverting updated reverted failed].each do |stage|
|
9
|
+
%w[starting updating reverting updated reverted failed].each do |stage|
|
10
10
|
it "doesn't post on slack:deploy:#{stage}" do
|
11
11
|
expect_any_instance_of(Slackistrano::Capistrano).not_to receive(:post)
|
12
12
|
Rake::Task["slack:deploy:#{stage}"].execute
|
data/spec/dry_run_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Slackistrano do
|
|
11
11
|
set :slackistrano, { klass: DryRunMessaging }
|
12
12
|
end
|
13
13
|
|
14
|
-
%w[updating reverting updated reverted failed].each do |stage|
|
14
|
+
%w[starting updating reverting updated reverted failed].each do |stage|
|
15
15
|
it "does not post to slack on slack:deploy:#{stage}" do
|
16
16
|
allow_any_instance_of(Slackistrano::Capistrano).to receive(:dry_run?).and_return(true)
|
17
17
|
expect_any_instance_of(Slackistrano::Capistrano).to receive(:post_dry_run)
|
@@ -8,7 +8,7 @@ describe Slackistrano do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
context "when :slack_channel is an array" do
|
11
|
-
%w[updating reverting updated reverted failed].each do |stage|
|
11
|
+
%w[starting updating reverting updated reverted failed].each do |stage|
|
12
12
|
it "posts to slack on slack:deploy:#{stage} in every channel" do
|
13
13
|
expect_any_instance_of(Slackistrano::Capistrano).to receive(:post).twice
|
14
14
|
Rake::Task["slack:deploy:#{stage}"].execute
|
data/spec/task_hooks_spec.rb
CHANGED
@@ -4,6 +4,10 @@ describe Slackistrano do
|
|
4
4
|
|
5
5
|
describe "before/after hooks" do
|
6
6
|
|
7
|
+
it "invokes slack:deploy:starting before deploy:starting" do
|
8
|
+
expect(Rake::Task['deploy:starting'].prerequisites).to include 'slack:deploy:starting'
|
9
|
+
end
|
10
|
+
|
7
11
|
it "invokes slack:deploy:updating before deploy:updating" do
|
8
12
|
expect(Rake::Task['deploy:updating'].prerequisites).to include 'slack:deploy:updating'
|
9
13
|
end
|
@@ -28,7 +32,7 @@ describe Slackistrano do
|
|
28
32
|
end
|
29
33
|
|
30
34
|
it "invokes all slack:deploy tasks before slack:deploy:test" do
|
31
|
-
expect(Rake::Task['slack:deploy:test'].prerequisites).to match %w[updating updated reverting reverted failed]
|
35
|
+
expect(Rake::Task['slack:deploy:test'].prerequisites).to match %w[starting updating updated reverting reverted failed]
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slackistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Hallstrom
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -104,7 +104,7 @@ homepage: https://github.com/phallstrom/slackistrano
|
|
104
104
|
licenses:
|
105
105
|
- MIT
|
106
106
|
metadata: {}
|
107
|
-
post_install_message:
|
107
|
+
post_install_message:
|
108
108
|
rdoc_options: []
|
109
109
|
require_paths:
|
110
110
|
- lib
|
@@ -119,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
123
|
-
signing_key:
|
122
|
+
rubygems_version: 3.4.10
|
123
|
+
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Send notifications to Slack about Capistrano deployments.
|
126
126
|
test_files:
|