Skip to content

Commit

Permalink
Merge pull request #8 from flowdock/better-capistrano-error-handling
Browse files Browse the repository at this point in the history
Better capistrano error handling
  • Loading branch information
Otto Hilska committed Feb 10, 2012
2 parents df62fd6 + 48b3275 commit df458ad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
26 changes: 20 additions & 6 deletions README.md
Expand Up @@ -26,20 +26,34 @@ If you're using JRuby, you'll also need to install jruby-openssl gem.
require 'flowdock' require 'flowdock'


# create a new Flow object with target flow's api token and sender information # create a new Flow object with target flow's api token and sender information
flow = Flowdock::Flow.new(:api_token => "56188e2003e370c6efa9711988f7bf02", flow = Flowdock::Flow.new(:api_token => "56188e2003e370c6efa9711988f7bf02",
:source => "myapp", :source => "myapp",
:from => {:name => "John Doe", :address => "john.doe@example.com"}) :from => {:name => "John Doe", :address => "john.doe@example.com"})


# send message to the flow # send message to the flow
flow.send_message(:subject => "Greetings from Flowdock API Gem!", flow.send_message(:subject => "Greetings from Flowdock API Gem!",
:content => "<h2>It works!</h2><p>Now you can start developing your awesome application for Flowdock.</p>", :content => "<h2>It works!</h2><p>Now you can start developing your awesome application for Flowdock.</p>",
:tags => ["cool", "stuff"], :link => "http://www.flowdock.com/") :tags => ["cool", "stuff"], :link => "http://www.flowdock.com/")

## API methods ## API methods


* Flow methods * Flow methods


*send_message(params)* - Send message to flow. See [API documentation](http://www.flowdock.com/help/api_documentation) for details. *send_message(params)* - Send message to flow. See [API documentation](http://www.flowdock.com/help/api_documentation) for details.


## Capistrano deployment task

The Flowdock API Ruby Gem includes a ready task for sending deployment notifications with Capistrano (you need to have Grit installed too). Just add the task into your deploy.rb file and configure the settings to match your project and flow:

```
require 'flowdock/capistrano'
# for Flowdock Gem notifications
set :flowdock_project_name, "My project"
set :flowdock_deploy_tags, ["frontend"]
set :flowdock_api_token, "_YOUR_API_TOKEN_HERE_"
```




## Copyright ## Copyright
Expand Down
4 changes: 3 additions & 1 deletion lib/flowdock/capistrano.rb
@@ -1,5 +1,4 @@
require 'flowdock' require 'flowdock'
require 'grit'
require 'digest/md5' require 'digest/md5'
require 'cgi' require 'cgi'


Expand All @@ -22,8 +21,11 @@
task :set_flowdock_api do task :set_flowdock_api do
set :rails_env, variables.include?(:stage) ? stage : ENV['RAILS_ENV'] set :rails_env, variables.include?(:stage) ? stage : ENV['RAILS_ENV']
begin begin
require 'grit'
set :repo, Grit::Repo.new(".") set :repo, Grit::Repo.new(".")
config = Grit::Config.new(repo) config = Grit::Config.new(repo)
rescue LoadError
puts "Flowdock: you need to have Grit gem installed: #{e.to_s}"
rescue => e rescue => e
puts "Flowdock: error in fetching your git repository information: #{e.to_s}" puts "Flowdock: error in fetching your git repository information: #{e.to_s}"
end end
Expand Down

0 comments on commit df458ad

Please sign in to comment.