Sha256: c2d3430582cfaf5fda3f0ad4e5c2318de9ce4befd6f7b479b90eab77858ced0f

Contents?: true

Size: 1.11 KB

Versions: 21

Compression:

Stored size: 1.11 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]
        migrations_paths = config[:db][:migrations_path]
        db_config = config[:db][:main]

        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_tasks.database_configuration = db_config

        db_migrator.migrations_paths = migrations_paths
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
appfuel-0.4.4 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.4.3 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.4.2 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.4.1 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.4.0 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.3.4 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.3.3 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.3.2 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.3.1 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.3.0 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.11 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.10 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.9 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.8 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.7 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.6 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.5 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.4 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.3 lib/appfuel/storage/db/migration_initializer.rb
appfuel-0.2.2.pre.alpha.pre.140 lib/appfuel/storage/db/migration_initializer.rb