capistrano-slackbot 0.0.3 → 0.1.0
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/.travis.yml +4 -2
- data/CHANGELOG.md +6 -0
- data/README.md +3 -4
- data/capistrano-slackbot.gemspec +1 -1
- data/lib/capistrano/slackbot/slack_notifier.rb +6 -6
- data/lib/capistrano/slackbot/version.rb +1 -1
- data/lib/capistrano/tasks/slack.rake +1 -2
- data/spec/slack_notifier_spec.rb +11 -11
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48a13788c76db0aa856377fffc7eaacd683589ad
|
4
|
+
data.tar.gz: aef72e8a9319332ea969d300db75d75e08c83b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe37a2e7fea60a399db1f7578bd617c05070475c9244bfabb52fe45c4febb1fb449d3cf121dce7da3f6bd36b9cb7c45efe8fc5907a101f7e873326ab3a463e68
|
7
|
+
data.tar.gz: 2bf3165e4fcf5c3ff505005c38dca37acb2a2d0cfb734c2f8a4e93560b9d7c714fba807d4f75037b0475ea8ac78d88578b56e69ad0a5529b78c57af4632e8fc0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Slack intergation for Capistrano 3.
|
4
4
|
|
5
|
+

|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -27,15 +29,12 @@ Then add some configuation options to your deploy.rb:
|
|
27
29
|
```ruby
|
28
30
|
# deploy.rb
|
29
31
|
|
30
|
-
set :
|
31
|
-
set :slack_token, ENV["SLACK_TOKEN"] # from your "Incoming Webhook" integration
|
32
|
+
set :slack_webhook_url, ENV["SLACK_WEBHOOK"] # from your "Incoming Webhook" integration
|
32
33
|
set :slack_options, { channel: "#general", icon_emoji: ":shipit:" } # arbitrary additional options passed to slack
|
33
34
|
```
|
34
35
|
|
35
36
|
And deploy away!
|
36
37
|
|
37
|
-

|
38
|
-
|
39
38
|
## Contributing
|
40
39
|
|
41
40
|
1. Fork it ( https://github.com/[my-github-username]/capistrano-slackbot/fork )
|
data/capistrano-slackbot.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "> 1.0"
|
25
25
|
spec.add_development_dependency "rake"
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.1.0"
|
27
27
|
spec.add_development_dependency "webmock", "~> 1.17.4"
|
28
28
|
end
|
@@ -2,22 +2,22 @@ require "json"
|
|
2
2
|
require "faraday"
|
3
3
|
|
4
4
|
class SlackNotifier
|
5
|
+
attr_reader :webhook_url
|
6
|
+
|
5
7
|
def initialize(args = {})
|
6
|
-
@
|
7
|
-
|
8
|
+
@webhook_url = args.fetch(:webhook_url) {
|
9
|
+
raise ArgumentError, "[capistrano-slackbot] webhook_url not set!"
|
10
|
+
}
|
8
11
|
@options = args.fetch(:options) { {} }
|
9
12
|
end
|
10
13
|
|
11
14
|
def notify(text)
|
12
15
|
payload = { text: text }.merge(@options)
|
13
16
|
|
14
|
-
connection.post
|
17
|
+
connection.post webhook_url, payload.to_json
|
15
18
|
end
|
16
19
|
|
17
20
|
private
|
18
|
-
def url
|
19
|
-
"https://#{ @team }.slack.com/services/hooks/incoming-webhook?token=#{ @token }"
|
20
|
-
end
|
21
21
|
|
22
22
|
def connection
|
23
23
|
Faraday.new do |faraday|
|
data/spec/slack_notifier_spec.rb
CHANGED
@@ -3,24 +3,24 @@ require "capistrano/slackbot/slack_notifier"
|
|
3
3
|
|
4
4
|
describe SlackNotifier do
|
5
5
|
before(:each) do
|
6
|
-
stub_request(:post, /
|
6
|
+
stub_request(:post, /webhook.example.com/)
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#notify" do
|
10
|
-
|
10
|
+
it "posts to slack's webhook with right params" do
|
11
11
|
SlackNotifier.new(
|
12
|
-
|
13
|
-
token: "secret_token",
|
12
|
+
webhook_url: "https://webhook.example.com/",
|
14
13
|
options: { custom_option: "hello there" }
|
15
|
-
)
|
16
|
-
}
|
14
|
+
).notify("Oh Hai!")
|
17
15
|
|
18
|
-
|
19
|
-
|
16
|
+
expect(WebMock).to have_requested(:post, "https://webhook.example.com/")
|
17
|
+
.with( body: { text: "Oh Hai!", custom_option: "hello there" }.to_json )
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
it "raises ArgumentError if webhook_url is not set" do
|
21
|
+
expect {
|
22
|
+
SlackNotifier.new
|
23
|
+
}.to raise_error(ArgumentError)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-slackbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Topolskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.
|
75
|
+
version: 3.1.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.
|
82
|
+
version: 3.1.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,6 +103,7 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
105
|
- ".travis.yml"
|
106
|
+
- CHANGELOG.md
|
106
107
|
- Gemfile
|
107
108
|
- LICENSE.txt
|
108
109
|
- README.md
|
@@ -135,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
136
|
version: '0'
|
136
137
|
requirements: []
|
137
138
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.2.
|
139
|
+
rubygems_version: 2.2.2
|
139
140
|
signing_key:
|
140
141
|
specification_version: 4
|
141
142
|
summary: Slack integration for Capistrano 3
|