Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can spork work with rake tasks?

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?

like image 778
matthuhiggins Avatar asked Sep 30 '11 18:09

matthuhiggins


4 Answers

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
like image 77
Bernát Avatar answered Oct 26 '22 17:10

Bernát


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

like image 30
matthuhiggins Avatar answered Oct 26 '22 18:10

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/
like image 31
Ery Avatar answered Oct 26 '22 19:10

Ery


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.

like image 44
Grimmo Avatar answered Oct 26 '22 19:10

Grimmo