Sha256: ad48bbcfe5dbacb609a5ff394ef2f1dea24bb53e3636ee2563da515f197d3cc0

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

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

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
sweetsie-0.1.0 templates/project/config/initialize.rb
sweetsie-0.1.0 templates/project/initialize.rb