具體過程以下:
一、InstantRails-2.0安裝後,在配置環境變量path中配置ruby/bin目錄(若是系統中有多個RUBY,執行命令行的時候系統認的就是path中的)
二、進入DOS命令行,執行gem update --system,結果
Updating RubyGems...
ERROR: While executing gem ... (Gem::RemoteSourceException)
HTTP Response 302 fetching http://rubygems.org/yaml
這是由於gem的配置太低,沒法進行遠程更新,執行gem -v 發現是1.0.1
三、從下面這個地址下載 rubygems-update-1.3.7.gem,http://rubyforge.org/frs/download.php/70695/rubygems-update-1.3.7.gem
而後DOS命令進行該文件所在的目錄,執行gem install --local rubygems-update-1.3.7.gem,出現信息
Successfully installed rubygems-update-1.3.7
1 gem installed
Installing ri documentation for rubygems-update-1.3.7...
Installing RDoc documentation for rubygems-update-1.3.7...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
執行gem -v查看,發現並無更新成功,Could not find main page README是什麼意思我沒弄明白,可是我從http://production.s3.rubygems.org/yaml上發現這麼一句
If you have an older version of RubyGems installed, then you can still
do it in two steps:
$ gem install rubygems-update # again, might need to be admin/root
$ update_rubygems # ... here too
我照着再執行 update_rubygems,接着出現的信息不少,就不帖出來,再執行gem -v,發現更新成功,已是1.3.7了
這一步是一切成功的源泉!!!!!!
四、接着再執行gem update --system,提示
Updating RubyGems
Nothing to update
這是爲何我不明白,請高手指點一下
五、再執行gem update rails --include-dependencies,提示信息
Updating installed gems
Updating rails
ERROR: Error installing rails:
actionpack requires rack (~> 1.0.0, runtime)
Gems updated: activesupport, activerecord
Installing ri documentation for activesupport-2.3.3...
Installing ri documentation for activerecord-2.3.3...
Installing RDoc documentation for activesupport-2.3.3...
Installing RDoc documentation for activerecord-2.3.3...
執行rails -v,發現仍是2.0.2沒有更新成功,根據actionpack requires rack (~> 1.0.0, runtime),應該是actionpack 須要1.0.0版本的rack
六、執行gem install rack -v=1.0.0
Successfully installed rack-1.0.0
1 gem installed
Installing ri documentation for rack-1.0.0...
Installing RDoc documentation for rack-1.0.0...
更新成功
七、再次執行 gem update rails --include-dependencies
出現信息
Updating installed gems
Updating rails
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.8
Successfully installed activerecord-2.3.8
Successfully installed rack-1.1.0
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
Gems updated: rake, activesupport, activerecord, rack, actionpack, actionmailer, activeresource, rails
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.8...
Installing ri documentation for activerecord-2.3.8...
Installing ri documentation for rack-1.1.0...
Installing ri documentation for actionpack-2.3.8...
Installing ri documentation for actionmailer-2.3.8...
Installing ri documentation for activeresource-2.3.8...
Installing ri documentation for rails-2.3.8...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.8...
Installing RDoc documentation for activerecord-2.3.8...
Installing RDoc documentation for rack-1.1.0...
Installing RDoc documentation for actionpack-2.3.8...
Installing RDoc documentation for actionmailer-2.3.8...
Installing RDoc documentation for activeresource-2.3.8...
Installing RDoc documentation for rails-2.3.8...
執行rails -v,發現已更新成功
總結:rails更新有兩種方式:一、聯機更新;2本地更新
聯機更新過程當中若是出現HTTP Response 302 fetching http://rubygems.org/yaml沒法更新,有兩種狀況
一是gem的版本太低,二是與服務器的鏈接不通
此時能夠試着加入其餘服務器地址
gem source -l 查看列表
gem source -a http://rubygems.org 加入新的服務器地址
或者直接gem install rubygems-update --source http://rubygems.org
本地更新須要下載相應的gem包,版本需與要更新的rails版本對應,同時安裝順序有要求,所以gem包之間有依賴關係
順序從上面的顯示信息中能夠看出來
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.8
Successfully installed activerecord-2.3.8
Successfully installed rack-1.1.0
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
至於gem包的下載地址都在http://rubyforge.org/,可是有些項目的並很差找到,能夠在google中直接搜索,就能找到在http://rubyforge.org/中的地址。 php