Archive for the ‘webrick’ Category

Serve webrick

Thursday, June 22nd, 2006

I wasn’t sure this was going to work but fantastically it does. Maybe I am ignorant but I think this is pretty handy.

You are working on a local Ruby on Rails app and you have your local webrick server running. Now you want to show your team mate your local copy but on their machine and in their browser.

Normally you run Webrick with ruby script/server and that fires up a server on http://127.0.0.1:3000/.

But to share it with your mate that won’t work (127.0.0.1 is localhost and peculiar to your machine.) Instead you can simply run Webrick like so; ruby script/server -b machinename (where machinename is your computer’s network name.) That will then make your Rails app available to your team mate on http://machinename:3000/. You can put in an IP address instead of a name if you want.

Handy.