Sha256: 57031474dc5421b59eae4996cc08c339a20dee7b369440d1af7a407335823d97

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

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

# use DataMapper
# 
# class Story < Capcode::Base
#   include Capcode::Base
#   property :id, Integer, :serial => true
#   property :title, String
#   property :body, String
#   property :date, String
# end
module Capcode
  Resource = DataMapper::Resource
  
  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.7.1 lib/capcode/base/dm.rb
Capcode-0.8.0 lib/capcode/base/dm.rb
Capcode-0.8.1 lib/capcode/base/dm.rb
Capcode-0.8.2 lib/capcode/base/dm.rb