Sha256: cf53a750bc295cdbe8e5afb91d07cfc9936880ed21e2bdbd11486fc7d436a255

Contents?: true

Size: 713 Bytes

Versions: 7

Compression:

Stored size: 713 Bytes

Contents

# setup ORM:

[:activerecord, :data_mapper].each do |orm|
  eval("def using_#{orm}?; false; end")
end

unless app_config.mack.orm.nil?
  dbs = YAML::load(ERB.new(IO.read(File.join(MACK_CONFIG, "database.yml"))).result)
  case app_config.mack.orm
  when 'activerecord'
    require 'activerecord'
    ActiveRecord::Base.establish_connection(dbs[MACK_ENV])
    eval("def using_activerecord?; true; end")
  when 'data_mapper'
    require 'data_mapper'
    DataMapper::Database.setup(dbs[MACK_ENV])
    eval("def using_data_mapper?; true; end")
  else
    MACK_DEFAULT_LOGGER.warn("Attempted to configure an unknown ORM: #{app_config.mack.orm}")
  end
else
  MACK_DEFAULT_LOGGER.warn("No ORM has been configured!")
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mack-0.0.3 initialize/configure_orm_support.rb
mack-0.0.4 initialize/configure_orm_support.rb
mack-0.0.6.1 initialization/initializers/orm_support.rb
mack-0.0.6.2 initialization/initializers/orm_support.rb
mack-0.0.5 initialization/initializers/orm_support.rb
mack-0.0.7.0 lib/initialization/initializers/orm_support.rb
mack-0.0.6 initialization/initializers/orm_support.rb