Zu nützlich um zu vergammeln :-)

This commit is contained in:
Astro 2007-11-13 23:19:31 +00:00
parent c1dbba0891
commit fbe364d506
1 changed files with 21 additions and 0 deletions

21
Miniwebserver.mw Normal file
View File

@ -0,0 +1,21 @@
[[Category:Ruby]]
<source lang="ruby">
#!/usr/local/bin/ruby
require 'webrick'
include WEBrick
if ARGV.size != 2
puts "Usage: #{$0} <port> <dir>"
exit
end
s = HTTPServer.new(
:Port => ARGV[0].to_i,
:DocumentRoot => ARGV[1]
)
trap("INT"){ s.shutdown }
s.start
</source>