#!/usr/bin/env php
<?php
/**
 * @author    jan huang <bboyjanhuang@gmail.com>
 * @copyright 2016
 *
 * @link      https://www.github.com/janhuang
 * @link      http://www.fast-d.cn/
 */

use FastD\Application;
use FastD\Console;

set_time_limit(0);
date_default_timezone_set('PRC');

// autoload composer
foreach ([
             __DIR__ . '/../../autoload.php',
             __DIR__.'/../vendor/autoload.php',
             __DIR__.'/vendor/autoload.php'
         ] as $value) {
    if (file_exists($value)) {
        define('COMPOSER_INSTALL', $value);
        break;
    }
}

if (!defined('COMPOSER_INSTALL')) {
    fwrite(STDERR,
        'You need to set up the project dependencies using the following commands:' . PHP_EOL .
        'wget http://getcomposer.org/composer.phar' . PHP_EOL .
        'php composer.phar install' . PHP_EOL
    );
}

$app = include __DIR__.'/app.php';

$console = new Console($app);

$console->add(new Run());

$console->run();
