Friday, June 29, 2007

Deploying backgroundrb

Often times you don't get to control what's on the server. Slave or daemon gem required by backgroundrb might not be on your server. To get around that, I froze the gem in the vendors directory. (ie. unpack the gem)

Then in the backgroundrb script under your script directory, add the following right before require 'backgroundrb_server'
# Load gems
if BACKGROUNDRB_STANDALONE == false
rails_root = BACKGROUNDRB_ROOT
gem_path = "#{rails_root}/vendor/gems/slave-1.2.1"
lib_path = "#{gem_path}/lib"
init_path = File.join(gem_path, "init.rb")
$LOAD_PATH << lib_path

eval(IO.read(init_path), binding, init_path)
end


It'll shoot up some warning, but you can ignore those, or write your own silent_warnings() method.

No comments:

Post a Comment