由于最近写的ruby脚本都是一些处理文档之类的,1.8用着有点不爽,就换上了1.9了...当然1.9现在最不爽的就是一些包跟不上.比如mongrel就一直有问题..
今天在网上乱窜的时候发现原来已经可以用mongrel了
http://railsfun.tw/viewthread.php?tid=139
sudo gem install mongrel
然后就提示出错
我用的是archlinux gem目录在 /usr/lib/ruby/gems/
cd /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11/ sudo vim http11.c
將所有的
RSTRING(”不定內容”)->ptr改成RSTRING_PTR(”不定內容”)
RSTRING(”不定內容”)->len改成RSTRING_LEN(”不定內容”)
ps:也可以用sed
sudo sed -i -e 's/RSTRING\(.*\)->ptr/RSTRING_PTR\1/' -e 's/RSTRING\(.*\)->len/RSTRING_LEN\1/' /usr/local/ruby/lib/ruby/gems/ruby1.9.1/gems/mongrel-1.1.5/ext/http11/http11.c
sudo ruby extconf.rb && sudo make && sudo make install sudo vim /usr/lib/ruby/gems/ruby1.9.1/gems/mongrel-1.1.5/lib/mongrel/handlers.rb
修改208到212行,將冒號 : 修改為 then
when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil then false
when modified_since && last_response_time > Time.now then fals
when modified_since && mtime > last_response_time then false
when none_match && none_match == '*' then false
when none_match && !none_match.strip.split(/\s*,\s*/).include?(etag) then false