Sha256: 9d2b5bbd3ea65424c6ac1a8abecf169513023522bac4a07ba0cee00a7924341d

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

# This line just let's us require anything in the +lib+ sub-folder
# without specifying a full path.
$LOAD_PATH.unshift(File.dirname(__FILE__))

# Require the basics...
require 'data_mapper/support/symbol'
require 'data_mapper/support/string'
require 'data_mapper/support/proc'
require 'data_mapper/support/inflector'
require 'data_mapper/database'
require 'data_mapper/base'

# This block of code is for compatibility with Ruby On Rails' database.yml
# file, allowing you to simply require the data_mapper.rb in your
# Rails application's environment.rb to configure the DataMapper.
if defined? RAILS_ENV
  require 'yaml'
  
  rails_config = YAML::load_file(RAILS_ROOT + '/config/database.yml')
  current_config = rails_config[RAILS_ENV.to_s]

  DataMapper::Database.setup do
    adapter   current_config['adapter']
    host      current_config['host']
    database  current_config['database']
    username  current_config['username']
    password  current_config['password']
    cache WeakHash::Factory
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.1.0 lib/data_mapper.rb