Permalink
Browse files

adding global enlighten method which loads ruby-debug, setups up remo…

…te, and calls debugger
  • Loading branch information...
1 parent 5776df7 commit c69f1ebd9324a5ad75ce18e1ee8cc03997100000 @ryanb committed Jun 18, 2011
View
@@ -1 +1,12 @@
-# TODO here we should help frameworks (Rails) start and open enlighten app
+module Enlighten
+ module Global
+ def enlighten
+ require "ruby-debug"
+ Debugger.wait_connection = true
+ Debugger.start_remote
+ debugger
+ end
+ end
+end
+
+Object.send :include, Enlighten::Global
@@ -41,14 +41,12 @@ def step
end
def local_variables
- puts run_command("info locals").inspect
run_command("info locals").split("\n").map do |variable|
variable.split(" = ")
end
end
def instance_variables
- puts run_command("info instance_variables").inspect
run_command("info instance_variables").split("\n").map do |variable|
variable.split(" = ")
end
@@ -60,7 +58,6 @@ def run_command(command)
end
def socket_response
- return if @socket.closed?
continue = true
response = []
while continue && line = @socket.gets
View
@@ -0,0 +1,4 @@
+module Enlighten
+ class Railtie < Rails::Railtie
+ end
+end
@@ -8,7 +8,7 @@
it "should say not yet enlightened when socket connection fails" do
TCPSocket.stub(:new).with("localhost", 8989) { raise Errno::ECONNREFUSED }
- @request.get("/").body.should include("Not yet enlightened")
+ @request.get("/").body.should include("Not enlightened")
end
it "/ should be an html document" do
@@ -1,16 +1,15 @@
# Simple script to start a debugger for testing
-require "rubygems"
-require "ruby-debug"
-Debugger.wait_connection = true
-Debugger.start_remote
+require 'rubygems'
+require 'bundler/setup'
+Bundler.require(:default)
before = true
puts "before"
def foo
- foo = "bar"
+ foo = "foo"
@test = 1
- debugger
- nil
+ enlighten
+ foo = "bar"
end
foo
after = true

0 comments on commit c69f1eb

Please sign in to comment.