From 41f78977d63f04af244af949570a3bbccbcb9e75 Mon Sep 17 00:00:00 2001 From: Tim Harper Date: Wed, 4 Nov 2009 09:57:07 -0700 Subject: [PATCH] more descriptive LoadError for spork/ext/ruby-debug if ruby-debug not installed and the project loads spork/ext/ruby-debug, then it shows an error saying 'ruby-debug' not installed. This can confuse the user, as they required 'spork/ext/ruby-debug' in the project, not ruby-debug. Why didn't spork install ruby-debug for me? Well, the answer is because spork/ext/ruby-debug is optional. This new error should make that clear. --- lib/spork/ext/ruby-debug.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/spork/ext/ruby-debug.rb b/lib/spork/ext/ruby-debug.rb index dad8a78..55c928f 100644 --- a/lib/spork/ext/ruby-debug.rb +++ b/lib/spork/ext/ruby-debug.rb @@ -1,7 +1,9 @@ -require 'ruby-debug' require 'socket' require 'forwardable' +begin +require 'ruby-debug' + # Experimental! class SporkDebugger @@ -143,3 +145,6 @@ def wait_for_connection Spork.prefork { SporkDebugger.run } if Spork.using_spork? +rescue LoadError + raise Loaderorr, "Your project has loaded spork/ext/ruby-debug, which relies on the ruby-debug gem. It appears that ruby-debug is not installed. Please install it." +end