mirror of
https://github.com/getgrav/grav.git
synced 2026-01-31 20:00:21 +01:00
38 lines
1.1 KiB
PHP
Executable File
38 lines
1.1 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
define('GRAV_CLI', true);
|
|
|
|
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));
|
|
}
|
|
|
|
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";
|
|
}
|
|
|
|
use Symfony\Component\Console\Application;
|
|
|
|
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!');
|
|
}
|
|
|
|
$app = new Application('Grav CLI Application', '0.1.0');
|
|
$app->addCommands(array(
|
|
new Grav\Console\Cli\InstallCommand(),
|
|
new Grav\Console\Cli\SandboxCommand(),
|
|
new Grav\Console\Cli\CleanCommand(),
|
|
new Grav\Console\Cli\ClearCacheCommand(),
|
|
new Grav\Console\Cli\BackupCommand(),
|
|
new Grav\Console\Cli\NewProjectCommand(),
|
|
));
|
|
$app->run();
|