Skip to content

Commit

Permalink
Allow multiple flowdock_api_tokens for deploy notification
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsvalin committed Nov 8, 2012
1 parent 856458c commit 49af4e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_"]
```


Expand Down
15 changes: 10 additions & 5 deletions lib/flowdock/capistrano.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 49af4e2

Please sign in to comment.