好多年前實習幹得不舒服的時候發現想玩點稍微正常點的東西隨便寫的,都被您拖出來……
可以參考清華大學 rubygems 源:http://mirrors.tuna.tsinghua.edu.cn/rubygems/
按照本帖流程:
[Login] ray at ftp4 in /home/ray/projects/rubygems-mirror % ls lib/ Rakefile test/ CHANGELOG.rdoc README.rdoc Manifest.txt
% bundle install Could not locate Gemfile
% rake gems:update
rake aborted!
Don't know how to build task 'gems:update'
(See full trace by running task with --trace)
http://ruby-china.org/topics/1092#reply1 的 3 楼回复指的是 client 会请求:/latest_specs.4.8.gz,/quick/Marshal.4.8/pry-0.1.0.gemspec.rz 而 gem mirror 收下来的文件中没有
收到的文件详细列表: % ls -R rubygems | head -10
rubygems: gems/ specs.4.8
rubygems/gems: -1.0.gem _-1.1.gem 1234567890-1.0.gem _-1.2.gem 12_hour_time-0.0.2.gem
~/rubygems/gems 里其他文件都是该形式
gem client 请求如下:
[2012-02-10 10:49:38] INFO WEBrick 1.3.1
[2012-02-10 10:49:38] INFO ruby 1.9.3 (2011-10-30) [x86_64-linux]
[2012-02-10 10:49:38] INFO WEBrick::HTTPServer#start: pid=12737 port=9292
127.0.0.1 - - [10/Feb/2012 10:49:49] "GET /latest_specs.4.8.gz HTTP/1.1" 200 776670 0.5377
127.0.0.1 - - [10/Feb/2012 10:49:51] "GET /quick/Marshal.4.8/pry-0.1.0.gemspec.rz HTTP/1.1" 404 - 0.0010
^C[2012-02-10 10:49:58] INFO going to shutdown ...
^C/home/ray/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/handler/webrick.rb:24:in shutdown': undefined method
shutdown' for nil:NilClass (NoMethodError)
而我 gem mirror 得到的文件中(正文 ls -R rubygems | head -10 部分)没有
至少运行了 10 个小时、虚拟内存占用至少 3G 的 gem generate_index (这回用的 ruby 1.8.7_p357) 这样退出了: ERROR: While executing gem ... (NoMethodError) private method `scan' called for 0.23:Float
实在不想再运行一遍了……