Sha256: ebd3cf0e872b14cc777efe973054c44a1d99cbb838012a00c40f3cfb8d3389b5

Contents?: true

Size: 1.17 KB

Versions: 34

Compression:

Stored size: 1.17 KB

Contents

require 'rake'

module Appfuel
  module Db
    module MigrationsInitializer

      def self.call(settings = {})
        root_name = settings[:root_name] || Appfuel.default_app_name
        container = Appfuel.app_container(root_name)

        config    = container[:config]
        root_path = container[:root_path]
        env       = container[:env]
        db_path   = config[:db][:path]
        db_config = config[:db][:main]

        migrations_paths = config[:db][:migrations_path]

        db_tasks = settings.fetch(:db_tasks) {
          ActiveRecord::Tasks::DatabaseTasks
        }

        db_migrator = settings.fetch(:db_migrator) {
          ActiveRecord::Migrator
        }

        active_record_base = settings.fetch(:active_record_base) {
          ActiveRecord::Base
        }

        active_record_base.configurations = {env => db_config}
        db_tasks.root   = root_path
        db_tasks.env    = env
        db_tasks.db_dir = db_path
        db_tasks.migrations_paths = migrations_paths
        db_migrator.migrations_paths = migrations_paths
        db_tasks.database_configuration = {env => db_config}
        db_tasks.current_config = db_config
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
appfuel-0.7.0 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.16 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.15 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.14 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.13 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.12 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.11 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.10 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.9 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.8 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.7 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.6 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.5 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.4 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.3 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.6.1 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.5.16 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.5.15 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.5.14 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.5.13 lib/appfuel/storage/db/migration_initializer.rb