Sha256: 1ea0737ee9e97c105ab2dff3330419a49a21369b3d6bbdbd715bc2ef047a0c87

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 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
    @host, @port = nil
    
    begin
      resque_config = if defined?(Rails)
        YAML::load_file("#{Rails.root}/#{location}/resque.yml")
      else
        YAML::load_file("./#{location}/resque.yml")
      end
    rescue
      @host = resque_config[ENV['RAILS_ENV']].split(':').first
      @port = resque_config[ENV['RAILS_ENV']].split(':').first
    end
    
    begin
      redis_config = if defined?(Rails)
        YAML::load_file("#{Rails.root}/#{location}/resque.yml")
      else
        YAML::load_file("./#{location}/resque.yml")
      end
    rescue
      @host = resque_config[ENV['RAILS_ENV']].split(':').first
      @port = resque_config[ENV['RAILS_ENV']].split(':').first
    end
    
    @host, @port = 'localhost', 6379 unless @host && @port
    @@redis ||= Redis.new(:host => options[:host], :port => options[: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.4 lib/all_seeing_eye.rb