fff9yw
Last Updated: February 25, 2016
·
2.32K
· 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

11313

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

over 1 year ago ·
17964

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

over 1 year ago ·
17965

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 ·
20827