slackistrano 4.0.0 → 4.0.1

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: '0686016bcf4e850937467636868dd9118d2fdbcefc69ce77eedaefa8b8aed649'
4
+ data.tar.gz: cfd0a46134a29d3dd2bf09751b96177d2bdd16322351f48b45f84c70ffc48786
5
5
  SHA512:
6
- metadata.gz: 578f583688d88ac3c0092d8f4da674bae4b562c58bb0c120d24cd4c77e38b744e8eb0310125a148d7bcf2c03beef70b8f2968051121a372db160b9c9c6ffb18c
7
- data.tar.gz: 83f90a56bd3e2a067fd9437417e2fef5ef0853bf59d56fc87160982f482acd31022cb7a82d91018552396cc963836ea8e5a0f991e7533ea8321a53b7ee1651e8
6
+ metadata.gz: b04cf3360fcdfb7b1d02948bce6852a6fb18cf1816b91d1fc85082164958dfb6e7a477ebed6df123d1db03fc68d4871db273547295195806020a767743005942
7
+ data.tar.gz: 8f4e1f0faa9a6b303f1bcb0a256bc5fdeb26a4a6c5094c1a075b0d1ce10e779762348a15f9051b9eaa57a51f5ae24d420f19309130006feeb4524d7ee4a9a36e
@@ -1,5 +1,10 @@
1
1
  # Slackistrano Change Log
2
2
 
3
+ 4.0.1
4
+ -----
5
+
6
+ - Send message on deploy:starting in addition to deploy:updating [#93]
7
+
3
8
  4.0.0
4
9
  -----
5
10
 
data/README.md CHANGED
@@ -120,6 +120,11 @@ if defined?(Slackistrano::Messaging)
120
120
  end
121
121
  end
122
122
 
123
+ # Suppress starting message.
124
+ def payload_for_starting
125
+ nil
126
+ end
127
+
123
128
  # Suppress updating message.
124
129
  def payload_for_updating
125
130
  nil
@@ -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,13 +32,14 @@ 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
 
42
+ before 'deploy:starting', 'slack:deploy:starting'
37
43
  before 'deploy:updating', 'slack:deploy:updating'
38
44
  before 'deploy:reverting', 'slack:deploy:reverting'
39
45
  after 'deploy:finishing', 'slack:deploy:updated'
@@ -1,3 +1,3 @@
1
1
  module Slackistrano
2
- VERSION = '4.0.0'
2
+ VERSION = '4.0.1'
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
@@ -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,7 +1,7 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hallstrom