From 48b327580bae9e8347b06cf85021ab9ef61bfd01 Mon Sep 17 00:00:00 2001 From: Antti Pitkanen Date: Fri, 10 Feb 2012 10:47:35 +0200 Subject: [PATCH] Require grit inside begin-rescue and fail gracefully with error message --- lib/flowdock/capistrano.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/flowdock/capistrano.rb b/lib/flowdock/capistrano.rb index 9c90db2..fc5736f 100644 --- a/lib/flowdock/capistrano.rb +++ b/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