forked from projectfedena/fedena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_worker_env.rb
28 lines (21 loc) · 941 Bytes
/
load_worker_env.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env ruby
RAILS_HOME = File.expand_path(File.join(File.dirname(__FILE__),".."))
BDRB_HOME = File.join(RAILS_HOME,"vendor","plugins","backgroundrb")
["server","server/lib","lib","lib/backgroundrb"].each { |x| $LOAD_PATH.unshift(BDRB_HOME + "/#{x}")}
$LOAD_PATH.unshift(File.join(RAILS_HOME,"lib","workers"))
require "yaml"
require "erb"
require "logger"
require "optparse"
require "bdrb_config"
require RAILS_HOME + "/config/boot"
require "active_support"
BDRB_CONFIG = BackgrounDRb::Config.read_config("#{RAILS_HOME}/config/backgroundrb.yml")
if !(::Packet::WorkerRunner::WORKER_OPTIONS[:worker_env] == false)
require RAILS_HOME + "/config/environment"
if (Object.const_defined?(:Rails) && (!Rails.respond_to?(:version) || Rails.version < "2.2.2")) ||
(Object.const_defined?(:RAILS_GEM_VERSION) && RAILS_GEM_VERSION < "2.2.2")
ActiveRecord::Base.allow_concurrency = true
end
end
require "backgroundrb_server"