Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow multiple flowdock_api_tokens for deploy notification

  • Loading branch information...
commit 49af4e273c9a5cb60a6e3638b14a8d9bd7f4575c 1 parent 856458c
@martinsvalin martinsvalin authored
Showing with 11 additions and 6 deletions.
  1. +1 −1  README.md
  2. +10 −5 lib/flowdock/capistrano.rb
View
2  README.md
@@ -66,7 +66,7 @@ The Flowdock API Ruby Gem includes a ready task for sending deployment notificat
# for Flowdock Gem notifications
set :flowdock_project_name, "My project"
set :flowdock_deploy_tags, ["frontend"]
- set :flowdock_api_token, "_YOUR_API_TOKEN_HERE_"
+ set :flowdock_api_token, ["_YOUR_API_TOKEN_HERE_"]
```
View
15 lib/flowdock/capistrano.rb
@@ -31,9 +31,12 @@
end
begin
- set :flowdock_api, Flowdock::Flow.new(:api_token => flowdock_api_token,
+ flows = Array(flowdock_api_token).map do |api_token|
+ Flowdock::Flow.new(:api_token => api_token,
:source => "Capistrano deployment", :project => flowdock_project_name,
:from => {:name => config["user.name"], :address => config["user.email"]})
+ end
+ set :flowdock_api, flows
rescue => e
puts "Flowdock: error in configuring Flowdock API: #{e.to_s}"
end
@@ -42,10 +45,12 @@
task :notify_deploy_finished do
# send message to the flow
begin
- flowdock_api.push_to_team_inbox(:format => "html",
- :subject => "#{flowdock_project_name} deployed with branch #{branch} on ##{rails_env}",
- :content => notification_message,
- :tags => ["deploy", "#{rails_env}"] | flowdock_deploy_tags)
+ flowdock_api.each do |flow|
+ flow.push_to_team_inbox(:format => "html",
+ :subject => "#{flowdock_project_name} deployed with branch #{branch} on ##{rails_env}",
+ :content => notification_message,
+ :tags => ["deploy", "#{rails_env}"] | flowdock_deploy_tags)
+ end
rescue => e
puts "Flowdock: error in sending notification to your flow: #{e.to_s}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.