Sha256: 1624ca8a2d880c2289eb30b02625d4a85c5e5b7f56488e49649e4107d12e1262

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

# Backgroundrb
# FIXME: check if data that we are writing to the socket should end with newline
require "pathname"
require "packet"
require "ostruct"
require "base64"

require "rails"
require "backgroundrb"

require "backgroundrb/bdrb_config"
require "backgroundrb/bdrb_client_helper"
require "backgroundrb/bdrb_job_queue"
require "backgroundrb/bdrb_conn_error"
require "backgroundrb/rails_worker_proxy"
require "backgroundrb/bdrb_connection"
require "backgroundrb/bdrb_cluster_connection"
require "backgroundrb/bdrb_start_stop"
require "backgroundrb/bdrb_result"


module BackgrounDRb
  class Railtie < Rails::Railtie
    config.bdrb = ActiveSupport::OrderedOptions.new

    unless config.bdrb.has_key? :root
      config.bdrb.root = File.expand_path(File.join(__FILE__, '..', '..', '..'))
    end
    BackgrounDRb::BACKGROUNDRB_ROOT = config.bdrb.root
    config.before_configuration do
      # required when "rails s" server started because RAILS_HOME not found
      RAILS_HOME = Rails.root unless const_defined?(:RAILS_HOME)

      config_file = "#{RAILS_HOME}/config/backgroundrb.yml"

      if File.exists?(config_file) && !config.bdrb.has_key?(:config)
        config.bdrb.config = BackgrounDRb::Config.read_config(config_file)
      end
      BackgrounDRb::BDRB_CONFIG = config.bdrb.config

      ::MiddleMan = BackgrounDRb::ClusterConnection.new if File.exists?(config_file)
    end

    rake_tasks do
      load "tasks/backgroundrb_tasks.rake"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
backgroundrb-rails3-1.1.6 lib/backgroundrb/railtie.rb
backgroundrb-rails3-1.1.5 lib/backgroundrb/railtie.rb