Changeset 12306

Show
Ignore:
Timestamp:
05/25/08 02:36:22 (6 years ago)
Author:
mrkn
Message:

websites/emacs-users.jp/scripts/commit-ping-receiver: use mount_proc method.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • websites/emacs-users.jp/scripts/commit-ping-receiver

    r12305 r12306  
    77$basedir = ARGV.shift 
    88 
    9 def request_handler(req, res) 
     9server = WEBrick::HTTPServer.new({ 
     10  :BindAddress => '127.0.0.1', 
     11  :Port => 10080, 
     12}) 
     13 
     14server.mount_proc('/') do |req, res| 
    1015  STDERR.puts "request: #{req.request_uri}" 
    11   return unless req.query.has_key?('yaml') 
    12  
    13   data = YAML.load(req.query['yaml']) 
    14   updates = data['files'].select {|file| 
    15     file['path'] =~ %r[^websites/emacs-users.jp] } 
    16   unless updates.empty? 
    17     Dir.chdir($basedir) do 
    18       system 'scripts/update' 
     16  if req.query.has_key?('yaml') 
     17    data = YAML.load(req.query['yaml']) 
     18    updates = data['files'].select {|file| 
     19      file['path'] =~ %r[^websites/emacs-users.jp] } 
     20    unless updates.empty? 
     21      Dir.chdir($basedir) do 
     22        system 'scripts/update' 
     23      end 
    1924    end 
    2025  end 
    2126end 
    2227 
    23 server = WEBrick::HTTPServer.new({ 
    24   :BindAddress => '127.0.0.1', 
    25   :Port => 10080, 
    26   :RequestCallback => lambda {|req, res| 
    27                         request_handler(req, res) } 
    28 }) 
    29  
    3028trap('INT') { server.shutdown } 
    3129