kernel pack

This commit is contained in:
Билай Станислав 2024-12-16 14:21:37 +03:00
parent cebae3491b
commit 045bd837b7
2 changed files with 15 additions and 4 deletions

View File

@ -27,7 +27,7 @@ class KernelController extends ConsoleController
if (file_exists(ROOT_DIR . $this->argv['path'])) { if (file_exists(ROOT_DIR . $this->argv['path'])) {
$tmpKernelDirFull = RESOURCES_DIR . '/tmp/ad/kernel/kernel'; $tmpKernelDirFull = RESOURCES_DIR . '/tmp/ad/kernel/kernel';
$this->files->copy_folder(KERNEL_DIR, $tmpKernelDirFull); $this->files->copy_folder(ROOT_DIR . $this->argv['path'], $tmpKernelDirFull);
$this->out->r("Ядро скопировано во временную папку", 'green'); $this->out->r("Ядро скопировано во временную папку", 'green');
} else { } else {
$this->out->r("Ядро не найдено", 'red'); $this->out->r("Ядро не найдено", 'red');
@ -65,11 +65,19 @@ class KernelController extends ConsoleController
$this->out->r("/composer.json не найден", 'red'); $this->out->r("/composer.json не найден", 'red');
} }
if (!is_dir(RESOURCES_DIR . '/tmp/app')) { if (!is_dir(RESOURCES_DIR . '/tmp/kernel')) {
mkdir(RESOURCES_DIR . '/tmp/app'); mkdir(RESOURCES_DIR . '/tmp/kernel');
}
if (file_exists(KERNEL_DIR . '/manifest.json')) {
$manifest = json_decode(file_get_contents(KERNEL_DIR . '/manifest.json'), true);
$version = $manifest['version'] ?? '';
$this->files->pack(RESOURCES_DIR . '/tmp/ad/kernel/', RESOURCES_DIR . '/tmp/kernel/kernel_v' . $version . '.igk');
}
else {
$this->files->pack(RESOURCES_DIR . '/tmp/ad/kernel/', RESOURCES_DIR . '/tmp/kernel/kernel.igk');
} }
$this->files->pack(RESOURCES_DIR . '/tmp/ad/kernel/', RESOURCES_DIR . '/tmp/kernel/kernel.igk');
$this->files->recursiveRemoveDir(RESOURCES_DIR . '/tmp/ad/kernel/'); $this->files->recursiveRemoveDir(RESOURCES_DIR . '/tmp/ad/kernel/');
} }

3
kernel/manifest.json Normal file
View File

@ -0,0 +1,3 @@
{
"version": "0.2"
}