Sha256: ee95c3f192f65894ba08c1d62cfbec55971e46e7a5a3415f05e3c6be6b93761b

Contents?: true

Size: 881 Bytes

Versions: 1

Compression:

Stored size: 881 Bytes

Contents

require File.dirname(__FILE__) + '/active_wrapper/gems'

case ActiveWrapper::Gems.gemset
when :default
  ActiveWrapper::Gems.activate %w(activerecord mysql2)
when :activerecord_2
  ActiveWrapper::Gems.activate %w(activerecord mysql)
end

require 'active_record'
require 'fileutils'
require 'logger'
require 'yaml'

$:.unshift File.dirname(__FILE__) + '/active_wrapper'

require 'db'
require 'log'

module ActiveWrapper
  class <<self
    
    def setup(options={})
      
      env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || ENV['MERB_ENV'] || 'development'
      options = {
        :base => File.dirname($0),
        :env => options[:env] || env,
        :log => options[:env] || env
      }.merge(options.reject { |k, v| v.nil? })
      
      db = Db.new(options)
      log = Log.new(options)
      
      [ db, log ]
    end
  end
end

ActiveRecord::Base.default_timezone = :utc

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_wrapper-0.4.0 lib/active_wrapper.rb