posts - 262,  comments - 221,  trackbacks - 0

          when using Spork: if your tests are failing when you think they should be passing, the problem might be the Spork prefork loading, which can sometimes prevent necessary files from being re-loaded.When in doubt, quit the Spork server with Control-C and restart it


          針對這種情況,我們可以使用一個名為Guard的gem,來自動監控spork中預加載的文件發生變化后,自動重啟spork

          1).在Gemfile中增加gem 'guard-spork'
          2).在shell中gem install libnotify / gem install inotify
          3).bundle install
          4).guard init spork
          5).guard start

          其中第4步會在Rails項目下生成一個Guardfile文件,文件的內容如下:

          guard 'spork' do 
            watch('^config/application.rb$')  
            watch('^config/environment.rb$')  
            watch('^config/environments/.*.rb$')  
            watch('^config/initializers/.*.rb$')  
            watch('^spec/spec_helper.rb')
          end

          這表明使用Guard來監控配置文件的改變,最后一步是使用Guard來啟動Spork



          -------------------------------------------------------------
          生活就像打牌,不是要抓一手好牌,而是要盡力打好一手爛牌。
          posted on 2011-07-15 18:12 Paul Lin 閱讀(431) 評論(0)  編輯  收藏 所屬分類: RoR
          <2011年7月>
          262728293012
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          常用鏈接

          留言簿(21)

          隨筆分類

          隨筆檔案

          BlogJava熱點博客

          好友博客

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 高唐县| 贵州省| 芒康县| 崇阳县| 桂林市| 兰西县| 宜章县| 云龙县| 漳平市| 彭泽县| 隆林| 城步| 寻甸| 西安市| 五家渠市| 安义县| 青冈县| 武川县| 伊金霍洛旗| 烟台市| 罗田县| 义乌市| 永嘉县| 武乡县| 体育| 邵阳县| 上高县| 阿拉尔市| 济宁市| 汨罗市| 巴马| 濮阳县| 弥渡县| 江门市| 涞水县| 永安市| 四会市| 年辖:市辖区| 五原县| 郓城县| 南城县|