spork可以使用rake任务吗?

问题描述:

Rake任务遭受与运行测试相同的问题:Rails启动过程需要很长时间才能运行任务。spork可以使用rake任务吗?

有没有办法将spork和rake结合在一起?

+0

我加了下面的宙斯(HTTPS我自己的答案:// github上。 COM /伯克/宙斯)。还有DHH正在开发的rails/command gem(https://github.com/rails/commands)。 – matthuhiggins

我今天发现了宙斯。这是有史以来最好的东西,所以我改变了我的答案宙斯:

https://github.com/burke/zeus

宙斯耙我:特殊:任务

+0

迷人的...... *打开tricorder * – thekingoftruth

+0

宙斯在Windows上不工作,所以它不适合我。 –

我知道没有标准的开箱即用解决方案。

Rake没有--drb选项,spork在这里没有帮助。 当然,自定义解决方案是可能的。这将需要扩展耙子。

我认为rake任务的运行并不像测试那么频繁,为什么问题还没有解决。

+0

谢谢。我基本上想要像spin这样的东西(https://github.com/jstorimer/spin),它分叉了一个加载的Rails进程和所有的gem。 – matthuhiggins

rake test:units 
testdrb -I test/ test/unit/ 

rake test:functionals 
testdrb -I test/ test/functional/ 

rake test:integration 
testdrb -I test/ test/integration/ 
+0

哦,上帝,我爱你的男人......这是我需要的命令:D – lfzawacki

您可以使用irake gem,它可以从控制台执行rake任务。

一下添加到Gemfile中:

gem 'irake' 

然后捆绑并启动控制台

$ bundle install 
$ rails console 

...并等待Rails环境载入(仅一次)。然后,你可以这样做:

rake "db:migrate" 

如果要列出的任务,您可以:

Rake::Task.tasks.each{|t| puts t.name }; nil