-
-
Save schmidt/16537 to your computer and use it in GitHub Desktop.
Instant webserver for current dir. Fetches free port automatically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'webrick' | |
port = 3000 | |
begin | |
s = WEBrick::HTTPServer.new( | |
:Port => port, | |
:DocumentRoot => Dir::pwd | |
) | |
port += 1 | |
end while s.listeners.size < 2 | |
trap("INT") { s.shutdown } | |
s.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment