Permalink
Browse files

Update README, add a restart method.

  • Loading branch information...
1 parent 5dc55f4 commit f8e3e68450db0e8ece12c2640325a0b6c7839df7 tailor committed Oct 16, 2008
Showing with 17 additions and 4 deletions.
  1. +10 −4 doc/README
  2. +7 −0 lib/live_console.rb
View
@@ -39,9 +39,9 @@ LiveConsole is very easy to use in your own app:
# Create a LiveConsole using TCP on port 1337
lc = LiveConsole.new :socket, :port => 1337
# We're not yet accepting connections. We need to start it up:
- lc.start # Starts the LiveConsole thread
+ lc.start # Starts the LiveConsole thread
# At this point, users can connect and get an IRB prompt.
- lc.stop # Kills the LiveConsole thread
+ lc.stop # Kills the LiveConsole thread
# Now, no one can connect.
# Create a LiveConsole using a Unix socket in /tmp/live-console.sock
@@ -51,8 +51,13 @@ LiveConsole is very easy to use in your own app:
lc.stop
# Have a LiveConsole run code in a binding other than the top-level:
- lc.bind = binding
+ lc = LiveConsole.new :unix_socket, :path => '/tmp/live-console.sock'
+ :bind => binding
lc.start
+ # That will start IRB in the current binding. There is also an accessor:
+ lc.bind = binding
+ # Of course, you must restart before IRB will see the new binding:
+ lc.restart
Have a look at doc/lc_example.rb or doc/lc_unix_example.rb for brief examples
of how to use LiveConsole.
@@ -83,7 +88,8 @@ Then, locally, you can do
netcat localhost 4000
-and get the remote LiveConsole. man ssh for more details.
+and get the remote LiveConsole. man ssh for more details. Of course, this
+only works for the TCP socket mode.
== Bugs
View
@@ -80,6 +80,13 @@ def stop
end
end
+ # Restarts. Useful for binding changes. Return value is the same as for
+ # LiveConsole#start.
+ def restart
+ stop
+ start
+ end
+
private
def init_irb

0 comments on commit f8e3e68

Please sign in to comment.