slackistrano 3.1.0 → 3.1.1
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 +5 -0
- data/README.md +11 -2
- data/lib/slackistrano/capistrano.rb +7 -3
- data/lib/slackistrano/messaging/base.rb +1 -0
- data/lib/slackistrano/messaging/null.rb +25 -0
- data/lib/slackistrano/tasks/slack.rake +6 -0
- data/lib/slackistrano/version.rb +1 -1
- data/spec/disabling_posting_to_slack_spec.rb +16 -0
- data/spec/messaging/null_spec.rb +11 -0
- metadata +8 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cbbeeb277ed313e84f791d5409e0b04a4248fb55
|
|
4
|
+
data.tar.gz: feca4860c223fc8bc4efcd769e12aa777574251a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f21d78cd5de97d8f59934f2ab96f4765a196ca2f9accee82b13d7277803a772e8c7268610e895ec148794d490316cd836ef53a4009da6a4116bf06a96f4cf3c3
|
|
7
|
+
data.tar.gz: 7df8a8d6f66711c65d00791706bbb09fe662b3c9011846c166797a663b4fb8f8a014e20afa6d16d542f151396eff7042d2dd901ae9b6fec905f05ed3f9fe1468
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -101,12 +101,12 @@ module Slackistrano
|
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
#
|
|
104
|
+
# Suppress updating message.
|
|
105
105
|
def payload_for_updating
|
|
106
106
|
nil
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
#
|
|
109
|
+
# Suppress reverting message.
|
|
110
110
|
def payload_for_reverting
|
|
111
111
|
nil
|
|
112
112
|
end
|
|
@@ -190,6 +190,15 @@ To set this up:
|
|
|
190
190
|
an issue along with a screenshot of the output from `cap production
|
|
191
191
|
slack:deploy:test` and I'll add it to the Wiki.
|
|
192
192
|
|
|
193
|
+
## Disabling posting to Slack
|
|
194
|
+
|
|
195
|
+
You can disable deployment notifications to a specific stage by setting the `:slackistrano`
|
|
196
|
+
configuration variable to `false` instead of actual settings.
|
|
197
|
+
|
|
198
|
+
```ruby
|
|
199
|
+
set :slackistrano, false
|
|
200
|
+
```
|
|
201
|
+
|
|
193
202
|
## TODO
|
|
194
203
|
|
|
195
204
|
- Notify about incorrect configuration settings.
|
|
@@ -16,8 +16,11 @@ module Slackistrano
|
|
|
16
16
|
|
|
17
17
|
def initialize(env)
|
|
18
18
|
@env = env
|
|
19
|
-
|
|
20
|
-
@messaging =
|
|
19
|
+
config = fetch(:slackistrano, {})
|
|
20
|
+
@messaging = case config
|
|
21
|
+
when false
|
|
22
|
+
Messaging::Null.new
|
|
23
|
+
when -> (o) { o.empty? }
|
|
21
24
|
klass = Messaging::Deprecated.new(
|
|
22
25
|
env: @env,
|
|
23
26
|
team: fetch(:slack_team),
|
|
@@ -26,8 +29,9 @@ module Slackistrano
|
|
|
26
29
|
webhook: fetch(:slack_webhook)
|
|
27
30
|
)
|
|
28
31
|
else
|
|
32
|
+
opts = config.dup.merge(env: @env)
|
|
29
33
|
klass = opts.delete(:klass) || Messaging::Default
|
|
30
|
-
klass.new(opts
|
|
34
|
+
klass.new(opts)
|
|
31
35
|
end
|
|
32
36
|
end
|
|
33
37
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Slackistrano
|
|
2
|
+
module Messaging
|
|
3
|
+
class Null < Base
|
|
4
|
+
def payload_for_updating
|
|
5
|
+
nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def payload_for_reverting
|
|
9
|
+
nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def payload_for_updated
|
|
13
|
+
nil
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def payload_for_reverted
|
|
17
|
+
nil
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def payload_for_failed
|
|
21
|
+
nil
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
namespace :slack do
|
|
2
2
|
namespace :deploy do
|
|
3
3
|
|
|
4
|
+
desc 'Notify about updating deploy'
|
|
4
5
|
task :updating do
|
|
5
6
|
Slackistrano::Capistrano.new(self).run(:updating)
|
|
6
7
|
end
|
|
7
8
|
|
|
9
|
+
desc 'Notify about reverting deploy'
|
|
8
10
|
task :reverting do
|
|
9
11
|
Slackistrano::Capistrano.new(self).run(:reverting)
|
|
10
12
|
end
|
|
11
13
|
|
|
14
|
+
desc 'Notify about updated deploy'
|
|
12
15
|
task :updated do
|
|
13
16
|
Slackistrano::Capistrano.new(self).run(:updated)
|
|
14
17
|
end
|
|
15
18
|
|
|
19
|
+
desc 'Notify about reverted deploy'
|
|
16
20
|
task :reverted do
|
|
17
21
|
Slackistrano::Capistrano.new(self).run(:reverted)
|
|
18
22
|
end
|
|
19
23
|
|
|
24
|
+
desc 'Notify about failed deploy'
|
|
20
25
|
task :failed do
|
|
21
26
|
Slackistrano::Capistrano.new(self).run(:failed)
|
|
22
27
|
end
|
|
23
28
|
|
|
29
|
+
desc 'Test Slack integration'
|
|
24
30
|
task :test => %i[updating updated reverting reverted failed] do
|
|
25
31
|
# all tasks run as dependencies
|
|
26
32
|
end
|
data/lib/slackistrano/version.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Slackistrano do
|
|
4
|
+
context "when :slackistrano is :disabled" do
|
|
5
|
+
before(:all) do
|
|
6
|
+
set :slackistrano, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
%w[updating reverting updated reverted failed].each do |stage|
|
|
10
|
+
it "doesn't post on slack:deploy:#{stage}" do
|
|
11
|
+
expect_any_instance_of(Slackistrano::Capistrano).not_to receive(:post)
|
|
12
|
+
Rake::Task["slack:deploy:#{stage}"].execute
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Slackistrano::Messaging::Null do
|
|
4
|
+
subject(:messaging) { Slackistrano::Messaging::Null.new }
|
|
5
|
+
|
|
6
|
+
%w[updating reverting updated reverted failed].each do |stage|
|
|
7
|
+
it "returns no payload for on #{stage}" do
|
|
8
|
+
expect(messaging.payload_for(stage)).to be_nil
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
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: 3.1.
|
|
4
|
+
version: 3.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philip Hallstrom
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-04-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: capistrano
|
|
@@ -88,13 +88,16 @@ files:
|
|
|
88
88
|
- lib/slackistrano/messaging/default.rb
|
|
89
89
|
- lib/slackistrano/messaging/deprecated.rb
|
|
90
90
|
- lib/slackistrano/messaging/helpers.rb
|
|
91
|
+
- lib/slackistrano/messaging/null.rb
|
|
91
92
|
- lib/slackistrano/tasks/slack.rake
|
|
92
93
|
- lib/slackistrano/version.rb
|
|
93
94
|
- slackistrano.gemspec
|
|
94
95
|
- spec/capistrano_deploy_stubs.rake
|
|
96
|
+
- spec/disabling_posting_to_slack_spec.rb
|
|
95
97
|
- spec/dry_run_spec.rb
|
|
96
98
|
- spec/messaging/deprecated_spec.rb
|
|
97
99
|
- spec/messaging/helpers_spec.rb
|
|
100
|
+
- spec/messaging/null_spec.rb
|
|
98
101
|
- spec/nil_payload_spec.rb
|
|
99
102
|
- spec/posting_to_multiple_channels_spec.rb
|
|
100
103
|
- spec/spec_helper.rb
|
|
@@ -123,15 +126,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
123
126
|
version: '0'
|
|
124
127
|
requirements: []
|
|
125
128
|
rubyforge_project:
|
|
126
|
-
rubygems_version: 2.5.
|
|
129
|
+
rubygems_version: 2.5.2
|
|
127
130
|
signing_key:
|
|
128
131
|
specification_version: 4
|
|
129
132
|
summary: Send notifications to Slack about Capistrano deployments.
|
|
130
133
|
test_files:
|
|
131
134
|
- spec/capistrano_deploy_stubs.rake
|
|
135
|
+
- spec/disabling_posting_to_slack_spec.rb
|
|
132
136
|
- spec/dry_run_spec.rb
|
|
133
137
|
- spec/messaging/deprecated_spec.rb
|
|
134
138
|
- spec/messaging/helpers_spec.rb
|
|
139
|
+
- spec/messaging/null_spec.rb
|
|
135
140
|
- spec/nil_payload_spec.rb
|
|
136
141
|
- spec/posting_to_multiple_channels_spec.rb
|
|
137
142
|
- spec/spec_helper.rb
|