slackistrano 4.0.0 → 4.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
  SHA256:
3
- metadata.gz: 8f28f0c81b8d8772f9b77f26c0f3f069ea770630f94c63d91affc4724e397415
4
- data.tar.gz: 49771347f5329cff33061b3fe4a83c2b785d7922dc57f420b766a0b9515798fc
3
+ metadata.gz: 6360f02d5cef2b9905f62b56bc447c20f19ead2c2eb395c5d75fab47acac5b40
4
+ data.tar.gz: 5fc2245b992c98e4e48cbe8ba648d7a6b990947c054614acb6b4946dba848817
5
5
  SHA512:
6
- metadata.gz: 578f583688d88ac3c0092d8f4da674bae4b562c58bb0c120d24cd4c77e38b744e8eb0310125a148d7bcf2c03beef70b8f2968051121a372db160b9c9c6ffb18c
7
- data.tar.gz: 83f90a56bd3e2a067fd9437417e2fef5ef0853bf59d56fc87160982f482acd31022cb7a82d91018552396cc963836ea8e5a0f991e7533ea8321a53b7ee1651e8
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 payload_for_updating
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}"
@@ -2,6 +2,10 @@ module Slackistrano
2
2
  module Messaging
3
3
  class Default < Base
4
4
 
5
+ def payload_for_starting
6
+ super
7
+ end
8
+
5
9
  def payload_for_updating
6
10
  super
7
11
  end
@@ -1,6 +1,10 @@
1
1
  module Slackistrano
2
2
  module Messaging
3
3
  class Null < Base
4
+ def payload_for_starting
5
+ nil
6
+ end
7
+
4
8
  def payload_for_updating
5
9
  nil
6
10
  end
@@ -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
- before 'deploy:updating', 'slack:deploy:updating'
38
- before 'deploy:reverting', 'slack:deploy:reverting'
39
- after 'deploy:finishing', 'slack:deploy:updated'
40
- after 'deploy:finishing_rollback', 'slack:deploy:reverted'
41
- after 'deploy:failed', 'slack:deploy:failed'
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
@@ -1,3 +1,3 @@
1
1
  module Slackistrano
2
- VERSION = '4.0.0'
2
+ VERSION = '4.0.2'
3
3
  end
@@ -1,4 +1,6 @@
1
1
  namespace :deploy do
2
+ task :starting do
3
+ end
2
4
  task :updating do
3
5
  end
4
6
  task :reverting do
@@ -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
@@ -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.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: 2019-07-18 00:00:00.000000000 Z
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.0.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: