Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #8 from flowdock/better-capistrano-error-handling

Better capistrano error handling
  • Loading branch information...
commit df458ad21f55d860415ce9824fb8e635e63a752e 2 parents df62fd6 + 48b3275
@mutru mutru authored
Showing with 23 additions and 7 deletions.
  1. +20 −6 README.md
  2. +3 −1 lib/flowdock/capistrano.rb
View
26 README.md
@@ -26,20 +26,34 @@ If you're using JRuby, you'll also need to install jruby-openssl gem.
require 'flowdock'
# create a new Flow object with target flow's api token and sender information
- flow = Flowdock::Flow.new(:api_token => "56188e2003e370c6efa9711988f7bf02",
- :source => "myapp",
+ flow = Flowdock::Flow.new(:api_token => "56188e2003e370c6efa9711988f7bf02",
+ :source => "myapp",
:from => {:name => "John Doe", :address => "john.doe@example.com"})
# send message to the flow
- 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>",
+ 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>",
:tags => ["cool", "stuff"], :link => "http://www.flowdock.com/")
-
+
## API 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
View
4 lib/flowdock/capistrano.rb
@@ -1,5 +1,4 @@
require 'flowdock'
-require 'grit'
require 'digest/md5'
require 'cgi'
@@ -22,8 +21,11 @@
task :set_flowdock_api do
set :rails_env, variables.include?(:stage) ? stage : ENV['RAILS_ENV']
begin
+ require 'grit'
set :repo, Grit::Repo.new(".")
config = Grit::Config.new(repo)
+ rescue LoadError
+ puts "Flowdock: you need to have Grit gem installed: #{e.to_s}"
rescue => e
puts "Flowdock: error in fetching your git repository information: #{e.to_s}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.