Last Updated: February 25, 2016
·
4.123K
· jurgelenas

Ruby web server one-liner

It is possible to launch a web server from command line in current directory not only with python one-liner, but with ruby too:

ruby -rwebrick -e's=WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start'

4 Responses
Add your response

You can also do 'ruby -run -e httpd . -p 5000'

over 1 year ago ·

Also, no need to assign the server instance (you can forego the s=... bit.

over 1 year ago ·

Nice. Also you can make it a little more concise using 1.9+ hash notation, as in Port: 3000 instead of :Port => 3000.

over 1 year ago ·