Quickly sharing the current working directory over HTTP

I was pretty dismayed to find there wasn’t a quick ruby equivalent of tip #2 in this post; webrick/server.rb has the SimpleServer class but as you can see on l20 it’s just got a singleton method which yields a block.

So I hacked out a gem giving a shell command which boots up WEBrick, mounts a FileHander servelet and then broadcasts its presence via bonjour.

To get started:

sudo gem install cmowforth-quickshare


Where -s is the mdns share name and -p is the port. Neither arguments are required; just running “share” is enough.

I need to write some tests, but these should be done by the time 0.0.1 goes up on rubyforge. I’m not going to bother suppressing log output. mDNS rules. 15-all, Python.

Check out the source here. Due to its use of the dns-sd utility, I’ve only tested it on BSD machines as I’m writing this.