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' => 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.. :)


Popular posts from this blog

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

Install Multimedia codec (offline) without internet connection in Ubuntu

rails 3.2 with jruby and mysql with rvm in ubuntu