Sha256: 03d518d6eb953c9ac5a5c997b1d0cdbb512c33136f4b0d7fa0b50063e1d6fb2c
Contents?: true
Size: 808 Bytes
Versions: 2
Compression:
Stored size: 808 Bytes
Contents
#!/opt1/ruby-1.8.2/bin/ruby require 'optparse' require 'ostruct' require 'webrick' include WEBrick options = OpenStruct.new options.dir_album = "test_album" opts = OptionParser.new do |opts| opts.banner = "Usage: #{File.basename($0)}\n" + "Run an httpd server" opts.on("-a", "--album DIR", String, "album directory") { |str| options.dir_galleries = str } opts.on("--help", "-h", "help!") { puts opts exit 0 } end opts.parse!(ARGV) # run webserver httpd_options = { :Port => 8888, :DocumentRoot => File.expand_path(options.dir_album) } s = HTTPServer.new( httpd_options ) s.mount("/", HTTPServlet::FileHandler, File::join(options.dir_album), true ) trap("INT") { s.shutdown } trap("TERM") { s.shutdown } s.start
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gf-ralbum-0.0.2 | example/httpd.rb |
gf-ralbum-0.0.5 | example/httpd.rb |