#!/usr/bin/env php
<?php
/*
 * Go! AOP framework
 *
 * @copyright Copyright 2013, Lisachenko Alexander <lisachenko.it@gmail.com>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE.
 */

use Go\Console\Command\DebugAdvisorCommand;
use Go\Console\Command\DebugAspectCommand;
use Go\Console\Command\CacheWarmupCommand;
use Go\Console\Command\DebugWeavingCommand;
use Go\Core\AspectKernel;
use Symfony\Component\Console\Application;


if (is_dir($vendor = __DIR__ . '/../vendor')) {
    require $vendor . '/autoload.php';
} elseif (is_dir($vendor = __DIR__ . '/../../..')) {
    require $vendor . '/autoload.php';
} else {
    die(
        'You must set up the project dependencies.' . PHP_EOL .
        'To do that, run the following commands:' . PHP_EOL . PHP_EOL .
        '$ curl -s http://getcomposer.org/installer | php' . PHP_EOL .
        '$ php composer.phar install' . PHP_EOL
    );
}

if (!class_exists('Symfony\Component\Console\Application')) {
    die(
        'You must install the symfony/console package in order ' .
        'to use the command-line tool.' . PHP_EOL
    );
}

$app = new Application('Go! AOP', AspectKernel::VERSION);
$app->add(new CacheWarmupCommand());
$app->add(new DebugAspectCommand());
$app->add(new DebugAdvisorCommand());
$app->add(new DebugWeavingCommand());
$app->run();
