Sha256: 489a38e6c39ef38b4deb504f7761c5fcb392c661522de37347e143a9bc7c27e9

Contents?: true

Size: 698 Bytes

Versions: 9

Compression:

Stored size: 698 Bytes

Contents

# setup ORM:

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

unless app_config.orm.nil?
  dbs = YAML::load(ERB.new(IO.read(File.join(MACK_CONFIG, "database.yml"))).result)
  case app_config.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.orm}")
  end
else
  MACK_DEFAULT_LOGGER.warn("No ORM has been configured!")
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mack-0.2.0 lib/initialization/initializers/orm_support.rb
mack-0.2.0.1 lib/initialization/initializers/orm_support.rb
mack-0.1.0 lib/initialization/initializers/orm_support.rb
mack-0.4.0.1 lib/initialization/initializers/orm_support.rb
mack-0.4.1 lib/initialization/initializers/orm_support.rb
mack-0.4.2.1 lib/initialization/initializers/orm_support.rb
mack-0.3.0 lib/initialization/initializers/orm_support.rb
mack-0.4.0 lib/initialization/initializers/orm_support.rb
mack-0.4.2 lib/initialization/initializers/orm_support.rb