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 阅读(412) 评论(0)  编辑  收藏 所属分类: RoR

只有注册用户登录后才能发表评论。


网站导航:
 
<2011年7月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(21)

随笔分类

随笔档案

BlogJava热点博客

好友博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜