lib/spork/ext/ruby-debug.rb in spork-0.7.3 vs lib/spork/ext/ruby-debug.rb in spork-0.7.4

- old
+ new

@@ -1,11 +1,13 @@ -require 'ruby-debug' require 'socket' require 'forwardable' -# Experimental! No automated tests are checking this, use at your own risk! +begin +require 'ruby-debug' +# Experimental! + class SporkDebugger DEFAULT_PORT = 10_123 HOST = '127.0.0.1' extend Forwardable @@ -13,11 +15,11 @@ attr_reader :state class << self attr_reader :instance def run - @instance = new + @instance ||= new end end def initialize @state = SporkDebugger::PreloadState.new @@ -42,11 +44,11 @@ end class PreloadState include NetworkHelpers def initialize - install_hook + Spork.each_run { install_hook } listen_for_connection_signals end def finish @tcp_service.close; @tcp_service = nil; @@ -141,5 +143,8 @@ end end Spork.prefork { SporkDebugger.run } if Spork.using_spork? +rescue LoadError + raise LoadError, "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