require 'rubygems' require 'active_record' module Sweeetsie class << self def boot(enviornment) ActiveRecord::Base.establish_connection(db[environment]) ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), 'log', "#{environment}.log")) Dir[File.join(%W|#{File.dirname(__FILE__)} models ** *.rb |)].each {|r| load r} end def migrations File.join(File.dirname(__FILE__), 'db', 'migrate') end def db YAML::load(File.read(File.join(File.dirname(__FILE__), 'database.yml'))) end def up!(version=nil) ActiveRecord::Migration.migrate migrations, version end def down! up! end end end