Sha256: 1aa423fcb8e1d7210a1817283aa630ee3e80e4706fe9b7fbeedc2e7dbb3c128e

Contents?: true

Size: 800 Bytes

Versions: 9

Compression:

Stored size: 800 Bytes

Contents

module Databasion
  
  class Datacize
    
    @@config = nil
    
    def self.config=(config)
      @@config = config
    end
    
    def self.datacize
      require 'migration_helpers/init'

      files = Dir["%s/*.yml" % @@config['output']['yaml_path']]
      Databasion::Migitize.migrabate(files, @@config)

      Databasion.set_ar_logger
      Databasion::LOGGER.info "Migrating..."

      YAML.load_file('config/database.yml').each do |config|
        ActiveRecord::Base.establish_connection(config[1])
        path = @@config['output']['migrations']['path'] + "/" + config[0]
        ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
        ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
      end
    end
    
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
databasion-0.1.0 lib/databasion/datacize.rb
databasion-0.0.9 lib/databasion/datacize.rb
databasion-0.0.8 lib/databasion/datacize.rb
databasion-0.0.7 lib/databasion/datacize.rb
databasion-0.0.6 lib/databasion/datacize.rb
databasion-0.0.5 lib/databasion/datacize.rb
databasion-0.0.4 lib/databasion/datacize.rb
databasion-0.0.3 lib/databasion/datacize.rb
databasion-0.0.2 lib/databasion/datacize.rb