Sha256: dd19bfc900af3ee356429942a56bcd579fcfa97703c27e1eea9802b3d0ad4934

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

class AllSeeingEye  
  def self.configuration(location = nil)
    location ||= 'config'
    @@configuration ||= if defined?(Rails)
      YAML::load_file("#{Rails.root}/#{location}/all_seeing_eye.yml")
    else
      YAML::load_file("./#{location}/all_seeing_eye.yml")
    end
    @@configuration
  end
  
  def self.redis(options = {})
    @host, @port = options[:host], options[:port]
    
    unless @host && @port
      begin
        resque_config = if defined?(Rails)
          YAML::load_file("#{Rails.root}/#{location}/resque.yml")
        else
          YAML::load_file("./#{location}/resque.yml")
        end
        @host = resque_config[ENV['RAILS_ENV']].split(':').first
        @port = resque_config[ENV['RAILS_ENV']].split(':').first
      rescue
      end
    
      begin
        redis_config = if defined?(Rails)
          YAML::load_file("#{Rails.root}/#{location}/resque.yml")
        else
          YAML::load_file("./#{location}/resque.yml")
        end
        @host = resque_config[ENV['RAILS_ENV']].split(':').first
        @port = resque_config[ENV['RAILS_ENV']].split(':').first
      rescue
      end
    end
    
    @host, @port = 'localhost', 6379 unless @host && @port
    @@redis ||= Redis.new(:host => @host, :port => @port)
  end
end

require 'redis'
require 'yaml'
require 'chronic'
require 'rbtree'
require 'all_seeing_eye/model'
require 'all_seeing_eye/models/request'
require 'all_seeing_eye/integrations/rails2' if defined?(Rails)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
all_seeing_eye-0.0.6 lib/all_seeing_eye.rb