A one-line web server in Ruby
Prodded by a tweet, here's how to serve a directory in one line of Ruby:
ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start'
Handy for sharing files at a conference, for example.
Leave feedback...
Commenting is closed for this article.

This works nicely, and the generated directory index is more complete than Python’s too.
But how does one terminate the server neatly? I ended up having to send a SIGKILL.
Stéphan: if you use this slightly less pretty command you can use the normal ^C to terminate the process: