Skip to content

Instantly share code, notes, and snippets.

@sms420
Created November 5, 2009 05:54
Show Gist options
  • Select an option

  • Save sms420/226806 to your computer and use it in GitHub Desktop.

Select an option

Save sms420/226806 to your computer and use it in GitHub Desktop.
server
#!/usr/local/bin/ruby1.9 -w
#
# server
# web
#
# Created by GlenC on 2009-10-31.
# Copyright 2009 glenc.com. All rights reserved.
# Modified by SMS420 on 2009-11-04 dude
require 'webrick'
include WEBrick
$port = ARGV[0].to_i
$directory = ARGV[1]
s = HTTPServer.new(
:Port => $port,
:DocumentRoot => File.join(Dir.pwd, $directory)
)
trap("INT") {s.shutdown}
s.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment