Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 23 lines (16 sloc) 0.39 kb
#!/usr/bin/env ruby
# thanks to jim weirich
# run ./servefiles from the root directory
require 'webrick'
include WEBrick
dir = Dir::pwd
port = (ARGV.first || (12000 + (dir.hash % 1000))).to_i
url = "http://#{Socket.gethostname}:#{port}"
puts "Opening #{url}"
`open #{url}`
s = HTTPServer.new(
:Port => port,
:DocumentRoot => dir
)
trap("INT"){ s.shutdown }
s.start
Jump to Line
Something went wrong with that request. Please try again.