天天看點

Ruby中的一些名詞解釋

抄自http://henter.me/post/ruby-rvm-gem-rake-bundle-rails.html

最近在看一個Rails項目,漸漸的接觸到Ruby語言,其中有些概念之前比較混亂,模棱兩可,相信也有人跟我一樣,剛開始學ruby時對這些概念不太清晰,現在整理一下。

Ruby

這個就不用多說了

RVM

用于幫你安裝Ruby環境,幫你管理多個Ruby環境,幫你管理你開發的每個Ruby應用使用機器上哪個Ruby環境。Ruby環境不僅僅是Ruby本身,還包括依賴的第三方Ruby插件。都由RVM管理。

Rails

這個也不用多說,著名開發架構。詳細看 http://zh.wikipedia.org/wiki/Ruby_on_Rails

RubyGems

RubyGems是一個友善而強大的Ruby程式包管理器( package manager),類似RedHat的RPM.它将一個Ruby應用程式打包到一個gem裡,作為一個安裝單元。無需安裝,最新的Ruby版本已經包含RubyGems了。

Gem

Gem是封裝起來的Ruby應用程式或代碼庫。

注:在終端使用的gem指令,是指通過RubyGems管理Gem包。

Gemfile

定義你的應用依賴哪些第三方包,bundle根據該配置去尋找這些包。

Rake

Rake是一門建構語言,和make類似。Rake是用Ruby寫的,它支援自己的DSL用來處理和維護Ruby程式。 Rails用rake擴充來完成多種不容任務,如資料庫初始化、更新等。

Rake is a build language, similar in purpose to make and ant. Like make and ant it's a Domain Specific Language, unlike those two it's an internal DSL programmed in the Ruby language.

PS:個人感覺有點類似Symfony2中的app/console

詳細 http://rake.rubyforge.org/

Rakefile

Rakefile是由Ruby編寫,Rake的指令執行就是由Rakefile檔案定義。

In a gem’s context, the Rakefile is extremely useful. It can hold various tasks to help building, testing and debugging your gem, among all other things that you might find useful.

詳細:http://rake.rubyforge.org/files/doc/rakefile_rdoc.html

Bundle

相當于多個RubyGems批處理運作。在配置檔案gemfilel裡說明你的應用依賴哪些第三方包,他自動幫你下載下傳安裝多個包,并且會下載下傳這些包依賴的包。

Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.