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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 384addccafa0a1cb47ff41e7cbff3d6604479415
4
- data.tar.gz: 8db3c255f7a235fdd1b427ffec76c288e9924ec1
3
+ metadata.gz: 48a13788c76db0aa856377fffc7eaacd683589ad
4
+ data.tar.gz: aef72e8a9319332ea969d300db75d75e08c83b46
5
5
  SHA512:
6
- metadata.gz: 05b5e4be63672b2d3bec4e2396a7b3bb2171371569a7e4e7431a3d741c0ca842afc8c783c02d3c5ec2a009e92fc617ef579e249b2a0a00e3150e9f6925a2da1a
7
- data.tar.gz: d68acea98795895ebb5fbaa32da160937f2a9d02296febd0078f4466e25a84fb8d8fe2717569e86d4e32dc7f92248d41643d2863f522bd4bd8b72e887f5c07a6
6
+ metadata.gz: fe37a2e7fea60a399db1f7578bd617c05070475c9244bfabb52fe45c4febb1fb449d3cf121dce7da3f6bd36b9cb7c45efe8fc5907a101f7e873326ab3a463e68
7
+ data.tar.gz: 2bf3165e4fcf5c3ff505005c38dca37acb2a2d0cfb734c2f8a4e93560b9d7c714fba807d4f75037b0475ea8ac78d88578b56e69ad0a5529b78c57af4632e8fc0
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
4
- - 2.1.0
3
+ - 2.1.5
4
+ - 2.0.0
5
5
  - 1.9.3
6
+
7
+ sudo: false
@@ -0,0 +1,6 @@
1
+ # capistrano-slackbot Changelog
2
+
3
+ ### 0.1.0
4
+
5
+ * __[BREAKING]__ Add `slack_webhook_url` option to replace `slack_team` and `slack_token`. [#2
6
+ ](https://github.com/whatthewhat/capistrano-slackbot/pull/2)
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Slack intergation for Capistrano 3.
4
4
 
5
+ ![capistrano-slackbot](https://googledrive.com/host/0B03_MIH-1qgoX3A4OWh5djFWUmc/capistrano-slackbot.png)
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 :slack_team, "your-team"
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
- ![capistrano-slackbot](https://googledrive.com/host/0B03_MIH-1qgoX3A4OWh5djFWUmc/capistrano-slackbot.png)
38
-
39
38
  ## Contributing
40
39
 
41
40
  1. Fork it ( https://github.com/[my-github-username]/capistrano-slackbot/fork )
@@ -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.0.0.beta2"
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
- @team = args.fetch(:team) { raise ArgumentError, "slack team not set!" }
7
- @token = args.fetch(:token) { raise ArgumentError, "slack token not set!" }
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 url, payload.to_json
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|
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Slackbot
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -3,8 +3,7 @@ namespace :slack do
3
3
  task :finished do
4
4
  run_locally do
5
5
  SlackNotifier.new(
6
- team: fetch(:slack_team),
7
- token: fetch(:slack_token),
6
+ webhook_url: fetch(:slack_webhook_url),
8
7
  options: fetch(:slack_options, {})
9
8
  ).notify(revision_log_message)
10
9
  end
@@ -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, /slack.com/)
6
+ stub_request(:post, /webhook.example.com/)
7
7
  end
8
8
 
9
9
  describe "#notify" do
10
- subject {
10
+ it "posts to slack's webhook with right params" do
11
11
  SlackNotifier.new(
12
- team: "some-team",
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
- it "posts to slack's webhook with right params" do
19
- subject.notify("Oh Hai!")
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
- expect(WebMock).to have_requested(:post,
22
- "https://some-team.slack.com/services/hooks/incoming-webhook?token=secret_token"
23
- ).with( body: { text: "Oh Hai!", custom_option: "hello there" }.to_json )
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.3
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-22 00:00:00.000000000 Z
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.0.0.beta2
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.0.0.beta2
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.1
139
+ rubygems_version: 2.2.2
139
140
  signing_key:
140
141
  specification_version: 4
141
142
  summary: Slack integration for Capistrano 3