Can spork work with rake tasks?

℡╲_俬逩灬. 提交于 2019-12-06 20:46:05

问题


Rake tasks suffer from the same problem as running tests: the Rails bootup process takes a long time before the task is even running.

Is there a way to integrate spork and rake together?


回答1:


You can use the irake gem which makes it possible to execute rake tasks from the console.

Add this to Gemfile:

gem 'irake'

Then bundle and start console

$ bundle install
$ rails console

...and wait for the Rails environment to load (only once). Then you can do:

rake "db:migrate"

If you want to list tasks, you can:

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



回答2:


I discovered zeus today. It's the best thing ever, so I'm changing my answer to zeus:

https://github.com/burke/zeus

zeus rake my:special:task




回答3:


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

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

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



回答4:


There is no standard out of the box solution as i know.

Rake does not have --drb option and spork can't help here. Sure, custom solution is possible. This will require extension of rake runner.

I think rake tasks run not so often as tests, that why question is not addressed yet.



来源:https://stackoverflow.com/questions/7614621/can-spork-work-with-rake-tasks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!