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

          常用鏈接

          留言簿(21)

          隨筆分類

          隨筆檔案

          BlogJava熱點博客

          好友博客

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 梨树县| 琼结县| 漳浦县| 登封市| 辽源市| 乳山市| 淳化县| 泽州县| 镇沅| 三河市| 伊春市| 桦川县| 朝阳县| 阿拉尔市| 霍州市| 瓦房店市| 寻乌县| 徐汇区| 楚雄市| 新乡市| 昌吉市| 甘洛县| 吴江市| 娄底市| 沧源| 饶平县| 内丘县| 彭山县| 城步| 怀宁县| 古蔺县| 广河县| 阳春市| 新竹市| 乾安县| 岳西县| 濮阳县| 诸城市| 胶南市| 明溪县| 通化市|