Can the delayed_job gem be used outside of Rails?
Is it possible to use th开发者_JS百科e delayed_job gem outside of Rails? Or put another way, can it be used in a pure Ruby project?
If so, how?
I don't know why this person never posted this.
It's easy. Two steps:
http://brkrd.com/post/45269754283/delayed-job-without-rails
UPDATE Looks like the link is broken.
You will need Active Record, but not Rails. You will have to mock a Rails object, and load your database information, environment, and root into the Rails object so that DelayedJob thinks it's in the Rails environment.
Delayed Job looks heavily rails dependent. https://github.com/defunkt/resque resque is a very good gem that is not rails dependent that accomplishes the same goal. You do however have to have redis on your machine which is very lightweight. Resque also has a cool Sinatra web console to see what is going on.
精彩评论