#!/usr/bin/env php
<?php

// find and load autoloader
$autoloadPathList = array(
    // phar, global install, dev
    __DIR__ . '/../vendor/autoload.php',
    // install to vendor/bin
    __DIR__ . '/../../../autoload.php'
);

foreach ($autoloadPathList as $autoloadPath) {
    if (file_exists($autoloadPath)) {
        require_once $autoloadPath;
        break;
    }
}

// check if legacy MongoDb object model available
if (!class_exists('\MongoCollection')) {
    echo "Legacy mongo driver or compatible adapter from new to legacy driver is not available. \n";
    echo "Please, check requirements at https://github.com/sokil/php-mongo-migrator#requirements. \n";
    exit(1);
}

// start application
$application = new \Sokil\Mongo\Migrator\Console\Application;
$application->run();

