[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] LiveConsole 0.1.0 -- eval code against a running program with IRB

Pete Elmore

10/20/2007 8:29:00 PM

I quit my job, and that can only mean one thing: time to release a new gem.

About:

LiveConsole is a library for providing IRB over a TCP connection . If
you add it to your application, you can run arbitrary code against
your application. For example, you can:
* Inspect the state of a running application
* Change the state of the application
* Patch code on the fly, without a restart.
* Let anyone on the net 0wn you if you bind to anything other than
localhost. :)
It's useful as a diagnostic tool, a debugging tool, and a way to
impress your friends or get those Lisp guys off your back. You know
the ones I mean.

Installation:

gem install live_console

There's also rubyforge.org/projects/live-console , which has tar'd source.

Usage:

lc = LiveConsole.new 1337 # Creates a LiveConsole on port 1337
Not yet accepting connections.
lc.run # Starts the LiveConsole thread
At this point, users can connect and get an IRB prompt. It happens in
a different thread, so you get control back.
lc.stop # Kills the LiveConsole thread
Now, no one can connect.

Status:

It's alpha software for now. There are some things missing, like an
authentication mechanism, some of the niceness of IRB on a real
console (readline, being able to hit ^D, etc.), the ability to use a
named pipe instead of TCP. There shouldn't be any weird failures, but
I'm not ruling them out.

2 Answers

Jay Levitt

10/20/2007 8:37:00 PM

0

On Sun, 21 Oct 2007 05:28:42 +0900, Pete Elmore wrote:

> LiveConsole is a library for providing IRB over a TCP connection . If
> you add it to your application, you can run arbitrary code against
> your application. For example, you can:
> * Inspect the state of a running application
> * Change the state of the application
> * Patch code on the fly, without a restart.

That's beautiful! Does it work with Rails and/or ruby-debug? All three
together would be the holy grail for debuggability.

--
Jay Levitt |
Boston, MA | My character doesn't like it when they
Faster: jay at jay dot fm | cry or shout or hit.
http://... | - Kristoffer

Pete Elmore

10/21/2007 12:12:00 AM

0

I haven't tested it very thoroughly on Rails, but it seems to work.
It has the added (possible) benefit of not stopping the application
when you use it, unlike Rails' breakpoint code. As long as you don't
interfere with running Controllers, it should be fine. YMMV

On 20/10/2007, Jay Levitt <jay+news@jay.fm> wrote:
> On Sun, 21 Oct 2007 05:28:42 +0900, Pete Elmore wrote:
>
> > LiveConsole is a library for providing IRB over a TCP connection . If
> > you add it to your application, you can run arbitrary code against
> > your application. For example, you can:
> > * Inspect the state of a running application
> > * Change the state of the application
> > * Patch code on the fly, without a restart.
>
> That's beautiful! Does it work with Rails and/or ruby-debug? All three
> together would be the holy grail for debuggability.
>
> --
> Jay Levitt |
> Boston, MA | My character doesn't like it when they
> Faster: jay at jay dot fm | cry or shout or hit.
> http://... | - Kristoffer
>
>