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 閱讀(433) 評論(0)  編輯  收藏 所屬分類: RoR
          <2011年7月>
          262728293012
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          常用鏈接

          留言簿(21)

          隨筆分類

          隨筆檔案

          BlogJava熱點博客

          好友博客

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 夏津县| 秭归县| 广平县| 南雄市| 景德镇市| 肃北| 桂阳县| 华坪县| 辽宁省| 荣成市| 黄陵县| 博乐市| 康保县| 台中县| 吉林市| 黑山县| 科尔| 冀州市| 承德县| 黄龙县| 东方市| 涪陵区| 来安县| 临海市| 乳源| 定安县| 清苑县| 德格县| 新余市| 天祝| 永州市| 武安市| 靖安县| 皋兰县| 建昌县| 漳州市| 浠水县| 德令哈市| 准格尔旗| 嘉善县| 安仁县|