1.1 安裝Ruby One-Click Installer, 下載頁面http://www.ruby-lang.org/en/downloads/
1.2 安裝Rails, Windows CMD(開始-->運行-->cmd) 中運行"gem install rails --include-dependencies" ,自動安裝。
eclipse 安裝ruby外掛程式
建議通過eclipse更新安裝來遠程安裝外掛程式。
從eclipse的菜單Help->Software Updates->Find and Install
選擇"Search for new features to install" 進行安裝。
需要安裝的有兩個外掛程式:
1,RDT
http://updatesite.rubypeople.org/release 2,RadRails
http://radrails.sourceforge.net/update 安裝完成後需要設定一下ruby解譯器的位置。
通過eclipse菜單 Windows > Preferences 開啟Preferences對話方塊,在Ruby 標題下面的 Installed Interpreters 項中設定的ruby的位置。
2.1 配置Ruby
2.1.1配置Interpreters
開啟"Windows-->Preferences", 選擇"Ruby-->Installed Interpreters" , 點擊"Add"出現的提示框中
代碼
- //any name you like
- Interpreters Name: Ruby
- Location: D:/ruby/bin/ruby.exe
<script>render_code();</script>
2.1.2配置Ri/rdoc
開啟"Windows-->Preferences", 選擇"Ruby-->Ri/rdoc"
代碼
- //bin目錄下面的rdoc檔案,沒有副檔名,不是rdoc.bat
- RDoc path: D:/ruby/bin/rdoc
- //bin目錄下面的ri檔案,沒有副檔名,不是ri.bat
- Ri path: D:/ruby/bin/ri
<script>render_code();</script>
2.2 配置Rails和Rake
開啟"Windows-->Preferences", 選擇"Rails-->Configuration"
代碼
- //bin目錄下面的rails檔案, 沒有副檔名, 不是rails.bat
- Rails Path: D:/ruby/bin/rails
- //bin目錄下面的rake檔案, 沒有副檔名, 不是rake.bat. 如果沒有rake檔案,運行gem update rake(安裝) 或者 gem install rake(升級)
- Rake Path: D:/ruby/bin/rake
- //bin目錄下面的mongrel_rails檔案, 沒有副檔名. 如果沒有,運行gem install mongrel 安裝
- Mongrel Path: D:/ruby/bin/mongrel_rails
<script>render_code();</script>
3. 總結
安轉RadRails很簡單,但是配置還是很容易出問題, 特別是幾個path, 除了ruby.exe有副檔名以外, 其他的都沒有副檔名. 初學者很容易出問題, 再次強調一遍
這樣,ruby環境這完成了。 在eclipse中建立一個ruby的工程,再建一個ruby檔案,寫上 puts "OK" 就可以看到eclipse的控制台輸出ok資訊了。