You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spip_loader/compile

48 lines
892 B
PHP

#!/usr/bin/env php
<?php
use League\CLImate\CLImate;
use Spip\Loader\Compiler\Build;
require_once 'vendor/autoload.php';
$config = [
'debug' => false,
'prod' => false,
];
unset($argv[0]);
foreach ($argv as $option) {
try {
match($option) {
'--prod' => $config['prod'] = true,
'--debug' => $config['debug'] = true,
default => throw new \RuntimeException(sprintf('Compile: unknown \'%s\'', $option))
};
} catch (\Exception $e) {
(new CLImate())->error($e->getMessage());
exit(1);
}
}
if ($config['debug']) {
error_reporting(E_ALL);
@ini_set('display_errors', 1);
}
$build = new Build(
sourceDirectory: __DIR__ . '/loader',
buildDirectory: __DIR__ . '/build',
pharFilename: 'spip_loader.php',
debug: $config['debug'],
);
$build->prepare();
$build->run();
$build->showResults();
if ($config['prod']) {
$build->showCopyTo(__DIR__ . '/public_html');
}
exit(0);