Project

General

Profile

Feature #8586 ยป fs.patch

tenderlovemaking (Aaron Patterson), 07/01/2013 08:00 AM

View differences:

lib/webrick/simple.rb
require 'webrick'
###
# Simple WEBrick file server. Usage:
#
# Start the file server, serving the files in the current directory
#
# $ ruby -rwebrick/simple -e start
#
# Start the file server, serving the files in the current directory on
# port 5000.
#
# $ ruby -rwebrick/simple -e start 5000
#
# Start the file server, serving the files in /tmp on port 5000.
#
# $ ruby -rwebrick/simple -e start 5000 /tmp
def start
port = ARGV.fetch 0, 0
root = ARGV.fetch 1, '.'
s = WEBrick::HTTPServer.new(:DocumentRoot => root, :Port => port)
trap('INT') { s.shutdown }
s.start
end
    (1-1/1)