Run web server in from any directory as root on the fly using ruby

Many times while testing open source project demos and examples we need to run the html pages on a web-server.
Opening the files directly in browser has it own limitations like while ajax call some browser imposed limitations blah blah...

Instead if putting it in web root directory every time we can use the inbuilt web-server which ruby provides


just go to the directory and run

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


-r requires class ( webrick requred here)
-e executes code (webserver run on port 5000, with document root as current dir)

enjoy.. :)



Comments

Popular posts from this blog

Modulo operation in Ruby

Difference between rake db:migrate db:reset and db:schema:load

Add Pidgin to Ubuntu 12:10 notification menu