2014-08-31 22:56:25 -07:00
|
|
|
#!/usr/bin/env php
|
|
|
|
|
<?php
|
2014-09-11 13:08:22 -07:00
|
|
|
define('GRAV_CLI', true);
|
2014-08-31 22:56:25 -07:00
|
|
|
|
|
|
|
|
if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
|
|
|
|
|
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-04 16:29:48 -07:00
|
|
|
if (!file_exists(__DIR__ . '/../vendor')){
|
|
|
|
|
// Before we can even start, we need to run composer first
|
|
|
|
|
echo "Preparing to install vendor dependencies...\n\n";
|
|
|
|
|
echo system('php bin/composer.phar --working-dir="'.__DIR__.'/../" --no-interaction install');
|
|
|
|
|
echo "\n\n";
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-31 22:56:25 -07:00
|
|
|
use Symfony\Component\Console\Application;
|
|
|
|
|
use Grav\Common\Grav;
|
|
|
|
|
|
|
|
|
|
$autoload = require_once(__DIR__ . '/../vendor/autoload.php');
|
|
|
|
|
|
|
|
|
|
if (!ini_get('date.timezone')) {
|
|
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!file_exists(ROOT_DIR . 'index.php')) {
|
|
|
|
|
exit('FATAL: Must be run from ROOT directory of Grav!');
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-11 12:40:53 -07:00
|
|
|
$grav = Grav::instance(array('loader' => $autoload));
|
2014-10-02 00:30:26 +03:00
|
|
|
$grav['config']->init();
|
2014-10-28 22:29:43 -07:00
|
|
|
$grav['streams'];
|
2014-10-01 14:12:09 -07:00
|
|
|
$grav['plugins']->init();
|
|
|
|
|
$grav['themes']->init();
|
2014-08-31 22:56:25 -07:00
|
|
|
|
2014-10-01 12:43:12 -07:00
|
|
|
$app = new Application('Grav Package Manager', GRAV_VERSION);
|
2014-08-31 22:57:18 -07:00
|
|
|
$app->addCommands(array(
|
2014-09-04 20:34:36 -07:00
|
|
|
new \Grav\Console\Gpm\IndexCommand(),
|
2014-10-14 12:45:10 -07:00
|
|
|
new \Grav\Console\Gpm\VersionCommand(),
|
2014-09-04 20:34:36 -07:00
|
|
|
new \Grav\Console\Gpm\InfoCommand(),
|
|
|
|
|
new \Grav\Console\Gpm\InstallCommand(),
|
2015-01-01 15:00:26 -08:00
|
|
|
new \Grav\Console\Gpm\UninstallCommand(),
|
2014-09-04 20:34:36 -07:00
|
|
|
new \Grav\Console\Gpm\UpdateCommand(),
|
2014-09-25 18:35:09 -07:00
|
|
|
new \Grav\Console\Gpm\SelfupgradeCommand(),
|
2014-08-31 22:57:18 -07:00
|
|
|
));
|
2014-08-31 22:56:25 -07:00
|
|
|
$app->run();
|