InstantRails-2.0中的rails升級

一、InstantRails-2.0安裝後,在配置環境變量path中配置ruby/bin目錄(若是系統中有多個RUBY,執行命令行的時候系統認的就是path中的)php

二、進入DOS命令行,執行gem update --system,結果html

Updating RubyGems...
ERROR:  While executing gem ... (Gem::RemoteSourceException)
HTTP Response 302 fetching http://rubygems.org/yamlweb

     這是由於gem的配置太低,沒法進行遠程更新,執行gem -v 發現是1.0.1ruby

三、從下面這個地址下載 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,出現信息fetch

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 READMEgoogle

四、執行update_rubygems,再執行gem -v,發現更新成功;spa

五、執行gem install rack -v=1.0.0.net

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,發現已更新成功

注:執行第6步時,有時會不成功,能夠到http://www.garbagecollect.jp/ruby/mswin32/ja/download/release.html處下載ruby-1.8.7-p249-i386-mswin32.zip,而後解到InstantRails-2.0-win\ruby下,執行 gem install -v=2.3.2 rails就能夠更新成功了(此法由houjzhong 提供,在此致謝!)


總結:

rails更新有兩種方式:一、聯機更新;2本地更新

聯機更新過程當中若是出現HTTP Response 302 fetching http://rubygems.org/yaml沒法更新,有兩種狀況

一是gem的版本太低,二是與服務器的鏈接不通

此時能夠試着加入其餘服務器地址

 gem source -l  查看列表

 gem source -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/中的地址。

相關文章
相關標籤/搜索