From 86ef77b1b7c9b03a2cb48f403ccf90376afc7b1c Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Fri, 22 Oct 2010 11:18:49 +0100 Subject: [PATCH] hoptoad --- config/deploy.rb | 7 +++++++ lib/tasks/hoptoad_notifier_tasks.rake | 28 +++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 037edf1a..b9fd618c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -53,3 +53,10 @@ end end end + + +Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier| + $: << File.join(vendored_notifier, 'lib') +end + +require 'hoptoad_notifier/capistrano' diff --git a/lib/tasks/hoptoad_notifier_tasks.rake b/lib/tasks/hoptoad_notifier_tasks.rake index da2f45f4..c87a55d7 100644 --- a/lib/tasks/hoptoad_notifier_tasks.rake +++ b/lib/tasks/hoptoad_notifier_tasks.rake @@ -1,5 +1,25 @@ -Dir[File.join(RAILS_ROOT, 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier| - $: << File.join(vendored_notifier, 'lib') -end +# Don't load anything when running the gems:* tasks. +# Otherwise, hoptoad_notifier will be considered a framework gem. +# https://thoughtbot.lighthouseapp.com/projects/14221/tickets/629 +unless ARGV.any? {|a| a =~ /^gems/} + + Dir[File.join(RAILS_ROOT, 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier| + $: << File.join(vendored_notifier, 'lib') + end -require 'hoptoad_notifier/tasks' + begin + require 'hoptoad_notifier/tasks' + rescue LoadError => exception + namespace :hoptoad do + %w(deploy test log_stdout).each do |task_name| + desc "Missing dependency for hoptoad:#{task_name}" + task task_name do + $stderr.puts "Failed to run hoptoad:#{task_name} because of missing dependency." + $stderr.puts "You probably need to run `rake gems:install` to install the hoptoad_notifier gem" + abort exception.inspect + end + end + end + end + +end