Sha256: 95785feefc53a2aa82f5d150b5399b1b200a9ce60933466bc7abcd18fbd0cbf3

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

require 'yaml'
require 'erb'
require 'uri'

require "monorm/version"

require 'monorm/base'


MonoRM::PROJECT_ROOT_DIR = PROJECT_ROOT_DIR

module MonoRM

  def self.root

    PROJECT_ROOT_DIR

  end

  def self.config
    File.join root, 'config'
  end

  def self.db_config
    File.join config, 'database.yml'
  end

  def self.lib
    File.join root, 'lib'
  end
  #
  def self.monorm
    File.join lib, 'monorm'
  end

  class MonoRM::DBInitializer
    def self.load_db_adapter

      adapter = URI.parse(ENV['DATABASE_URL']).scheme

      case adapter
      when 'postgres'
        adapter_path = File.join('monorm', 'adapters', 'pg_connection')
        require adapter_path
      when 'sqlite'
        adapter_path = File.join('monorm', 'adapters', 'sqlite_connection')
        require adapter_path
      else
        raise 'Database type not found!'
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monorm-1.0.0 lib/monorm.rb