Changeset 2069
- Timestamp:
- 11/27/07 21:49:28 (11 months ago)
- Files:
-
- 1 modified
-
lang/ruby/ssb/ssb-webrick.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/ssb/ssb-webrick.rb
r1978 r2069 1 1 require 'webrick' 2 require 'optparse' 2 3 3 basedir = Dir.pwd 4 Dir.chdir "#{basedir}/public_html" 4 port = 10080 5 bind_address = '127.0.0.1' 6 7 opt = OptionParser.new 8 opt.on('-p port', '--port port') {|v| port = v.to_i } 9 opt.on('--bind ip') {|v| bind_address = v } 10 opt.parse!(ARGV) 11 12 bindir = File.dirname(__FILE__) 13 docroot = File.expand_path(File.join(bindir, 'public_html')) 14 Dir.chdir(docroot) 5 15 6 16 srv = WEBrick::HTTPServer.new({ 7 :DocumentRoot => "#{ Dir.pwd }",8 :BindAddress => '127.0.0.1',9 :Port => 10080,17 :DocumentRoot => docroot, 18 :BindAddress => bind_address, 19 :Port => port, 10 20 }) 11 21 trap("INT"){ srv.shutdown } 12 srv.mount('/', WEBrick::HTTPServlet::CGIHandler, "#{ Dir.pwd }/index.rbx") 22 p File.join(docroot, 'index.rbx') 23 srv.mount('/', WEBrick::HTTPServlet::CGIHandler, File.join(docroot, 'index.rbx')) 13 24 %w(javascripts stylesheets emoji images).each {|x| 14 srv.mount("/#{x}/", WEBrick::HTTPServlet::FileHandler, "#{ Dir.pwd }/#{x}/")25 srv.mount("/#{x}/", WEBrick::HTTPServlet::FileHandler, File.join(docroot, x)) 15 26 } 16 27 srv.start
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)