Skip to content

Instantly share code, notes, and snippets.

@aussielunix
Created February 6, 2012 10:13
Show Gist options
  • Save aussielunix/1751273 to your computer and use it in GitHub Desktop.
Save aussielunix/1751273 to your computer and use it in GitHub Desktop.
easily serve current dir via ruby/webrick
# If you add the following to your ~/.bashrc you can the serve the contents of any directory with ruby/webrick on port 3000.
alias rs="ruby -rwebrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start\""

Usage

To use the above gist you just change into a directory and enter rs

[/tmp]
lunix@glenmorangie] -> rs
[2012-02-06 21:18:25] INFO  WEBrick 1.3.1
[2012-02-06 21:18:25] INFO  ruby 1.8.7 (2010-12-23) [x86_64-linux]
[2012-02-06 21:18:25] INFO  WEBrick::HTTPServer#start: pid=3700 port=3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment