Skip to content

Instantly share code, notes, and snippets.

@jesperronn
Created December 1, 2009 19:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesperronn/246571 to your computer and use it in GitHub Desktop.
Save jesperronn/246571 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Modified from http://yehudakatz.com/2007/08/06/webrick-anywhere/
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => ARGV[0] || 2000,
:DocumentRoot => Dir::pwd
)
## mount subdirectories
s.mount("",
HTTPServlet::FileHandler, ".",
true) #<= allow to show directory index.
trap("INT"){ s.shutdown }
s.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment