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

$autoloadPaths = [
    __DIR__.'vendor/autoload.php',
    __DIR__.'/../autoload.php',
    __DIR__.'/../vendor/autoload.php',
    __DIR__.'/../../autoload.php'
];
foreach ($autoloadPaths as $autoloadPath) {
    if (file_exists($autoloadPath)) {
        define('COMPOSER_AUTOLOAD_PATH', $autoloadPath);
        break;
    }
}

if (!defined('COMPOSER_AUTOLOAD_PATH')) {
    fwrite(STDERR, 'Could not find composer autoloader!');
    exit(1);
}

require_once COMPOSER_AUTOLOAD_PATH;

use Gruberro\MongoDbMigrations\Console\Command;
use Symfony\Component\Console\Application;

$application = new Application();
$application->add(new Command\MigrationsCommand());
$application->add(new Command\ReleaseLockCommand());
$application->run();
