|
ROR本地安裝
一、安裝Ruby 1、下載Ruby(http://www.)安裝包 雙擊安裝,安裝過程中注意選中"Enable RubyGems" 2、打開"命令提示符cmd",輸入"ruby -v"查看版本號(hào),則表示ruby安裝成功 二、安裝Rails 1、下載JDK(http://java./),安裝,否則下面的"gem install"會(huì)提示錯(cuò)誤 2、下載Rails(http://www.) 這里的版本為:rails-2.0.2.gem 3、下載Rails安裝需要的庫(http:///),注意有版本依賴問題。 這里的版本為: activesupport-2.0.2.gem activerecord-2.0.2.gem actionpack-2.0.2.gem actionmailer-2.0.2.gem activeresource-2.0.2.gem 打開"命令提示符cmd"執(zhí)行以下命令: gem install activesupport-2.0.2.gem gem install activerecord-2.0.2.gem gem install actionpack-2.0.2.gem gem install actionmailer-2.0.2.gem gem install activeresource-2.0.2.gem gem install rails-2.0.2.gem 安裝成功即可 或者將上面所有的.gem放在一個(gè)目錄中,然后直接在cmd中輸入下面的任何一個(gè)命令即可。 gem install rails -l gem install rails -l --include-dependencies gem install -l rails-2.0.2.gem 4、在cmd中運(yùn)行"rails -v",顯示版本號(hào),表示安裝成功 在cmd中運(yùn)行"rails <path>/new application"創(chuàng)建一個(gè)新項(xiàng)目 如"rails d:/new application"則可在D:\下看到新建的項(xiàng)目new 以上沒有出錯(cuò)則rails安裝成功 5、使用: 運(yùn)行 rails path/to/your/new/application 創(chuàng)建一個(gè)新的項(xiàng)目。 運(yùn)行 ruby path/to/your/new/application/script/server 啟動(dòng)服務(wù)。 ================================================================= 了解RubyGems 1、什么是Gem? gem是Ruby程序或庫的打包方式,比如gem install rails就是安裝rails程序的gem 我們可以拿gem和war、jar類比 但是gem還擔(dān)當(dāng)了Java里maven的角色,就是一個(gè)庫管理工具,可以遠(yuǎn)程下載和安裝Ruby庫 2、常用gem命令: gem build -- Build a gem file from a specification gem cert -- Support signing and managing signed gems gem check -- Check installed gems for problems gem cleanup -- Cleanup old versions in the repository gem contents -- Display the files contained in an installed gem gem dependency -- List the dependencies of a gem gem environment -- Display information about the gem environment gem help -- Provide help about gem commands gem install -- Installing a gem gem list -- List gems starting with a string gem query -- Query for a list of gems gem rdoc -- Generate the RDoc files for an installed gem gem search -- List gems containing a string gem specification -- Extract the Gem::Specification from a gem file gem uninstall -- Uninstalling a gem gem unpack -- Unpack an installed gem to the current directory gem update -- Update your installed gems 3、升級(jí)已經(jīng)安裝的gem: 因?yàn)閞uby1.86默認(rèn)安裝的gem是0.94版的,現(xiàn)在最新的1.01已經(jīng)出來了,將rubygems-update*.gem下載在某個(gè)目錄,在cmd下到此目錄,按如下指令即可升級(jí): gem install rubygems-update -l update_rubygems Lighttpd+Fastcgi無法配置的原因
要讓Lighttpd支持Fcgi,只要將配置中的mod_fcgi打開即可,但是要讓rails環(huán)境支持fcgi還必須安裝ruby_fcgi.gem這個(gè)插件,但是安裝這個(gè)文件時(shí),必須要用到Fastcgi的庫文件,而在windows中暫時(shí)還沒有找到安裝fastcgi庫文件的方法,所以導(dǎo)致安裝gem時(shí)總是提示無法找到fastcgi.h這個(gè)庫文件,所以無法配置ruby來支持fastcgi。 |
|
|