Sha256: 243e46fcc222f2ac5f4a0f598f1b46c3983a6556eb3f9085452cc1deaa36214f

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

require 'rubygems'
require 'dm-core'
require 'yaml'
require 'logger'

module Capcode 
  Resource = DataMapper::Resource

  # use DataMapper
  # 
  # class Story < Capcode::Base
  #   include Capcode::Base
  #   property :id, Integer, :serial => true
  #   property :title, String
  #   property :body, String
  #   property :date, String
  # end  
  class Base
  end
  
  class << self
    def db_connect( dbfile, logfile ) #:nodoc:
      dbconfig = YAML::load(File.open(dbfile)).keys_to_sym
      DataMapper.setup(:default, dbconfig)
      DataMapper::Logger.new(logfile, :debug)
      DataMapper.auto_upgrade!
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
Capcode-0.8.7 lib/capcode/base/dm.rb
Capcode-0.8.6 lib/capcode/base/dm.rb
Capcode-0.8.5 lib/capcode/base/dm.rb
Capcode-0.8.4 lib/capcode/base/dm.rb