環境:ruby 1.8.7 rails 2.3.5 php
1. 安裝msysgit並將D:\dev\msysgit\msysgit\bin給環境變量,不然如下的git插件不能安裝mysql
2. 安裝haml:git
1) gem install hamlgithub
2) config.gem "haml" ->config/environment.rbsql
3. 安裝rspec編程
1) gem install rspecruby
2) gem install gitsvn
3) ruby script/plugin install git://github.com/dchelimsky/rspec.git測試
注:有的時候插件安裝不成功,注意看提示,若是沒有,就說明沒有成功spa
4. 安裝rspec-rails
1) gem install rspec-rails
2) ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git
注:有的時候插件安裝不成功,注意看提示,若是沒有,就說明沒有成功
3) ruby script/generate rspec
4) spec_server 1.2.9開始就沒有,要本身下載https://github.com/dchelimsky/spec_server
5. 安裝rspec-on-rails-matchers(若是想要)
1)ruby script/plugin install git://github.com/joshknowles/rspec-on-rails-matchers.git
6. mysql的問題
1) mysql gem的安裝,要先下載兩個
http://files.rubyforge.vm.bytemark.co.uk/mysql-win/mysql-2.8.1-x86-mswin32.gem
http://rubyforge.org/frs/download.php/72167/rdoc-2.5.11.gem
手動安裝
gem install rdoc-2.5.11.gem
gem install mysql-2.8.1-x86-mswin32.gem
要求先裝rdoc,否則mysql不能正確安裝
2) mysql的libmysql.dll,因爲5.0以上的版本mysql的libmysql.dll文件並不能很好的支持rails,因此必須
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
下載後,放入ruby\bin\目錄下。
BDD方法:
1.ruby script\generate rspec
2.ruby script\generate rspec_model user
3.修改spec/models/user_spec.rb
4.rake db:create:all
5.rake db:migrate
6.rake db:test:prepare
7.修改config/environments/test.rb爲config.cache_classes = false(原來是true)
8.打開spec服務ruby script/spec_server
9.gem install win32console(後面提示要裝的,但發現裝了沒有什麼用)
10.rspec --drb spec\models\user_spec.rb (這樣測試就速度多了)
已經安裝好後:
1)rails -d mysql project
2) ruby script/plugin install git://github.com/dchelimsky/rspec.git
ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git
3)ruby script\generate rspec
4)修改config/environments/test.rb爲config.cache_classes = false(原來是true)
5)copy spec_server ./script/
6)打開spec服務ruby script/spec_server
好,能夠寫程序和使用rspec來進行BDD式編程了