could someone give me a hint, howto serve the current directory from command line with ruby? it would be great, if i can have some system wide configuration (e.g. mime-types
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 9090, :DocumentRoot => Dir::pwd)
trap("INT"){ s.shutdown }
s.start
As Aaron Patterson tweeted it out today you can do:
ruby -run -e httpd . -p 5000
And you can set the bind address as well by adding -b 127.0.0.1
Works with Ruby 1.9.2 and greater.