Skip to content

Commit 6c7f784

Browse files
committed
wip
1 parent 4c0ed45 commit 6c7f784

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

packages/core/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"require": {
77
"php": "^8.4",
88
"tempest/container": "dev-main",
9-
"tempest/process": "dev-main",
109
"tempest/discovery": "dev-main",
1110
"tempest/reflection": "dev-main",
1211
"tempest/support": "dev-main",

packages/core/src/Composer.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class Composer
2626

2727
public function __construct(
2828
private readonly string $root,
29-
private ProcessExecutor $executor,
29+
private ?ProcessExecutor $executor = null,
3030
) {}
3131

3232
public function load(): self
@@ -102,7 +102,11 @@ public function save(): self
102102

103103
public function executeUpdate(): self
104104
{
105-
$this->executor->run('composer up');
105+
if ($this->executor) {
106+
$this->executor->run('composer up');
107+
} else {
108+
exec('composer update');
109+
}
106110

107111
return $this;
108112
}

packages/core/src/FrameworkKernel.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Tempest\Core\Kernel\RegisterEmergencyExceptionHandler;
1818
use Tempest\EventBus\EventBus;
1919
use Tempest\Process\GenericProcessExecutor;
20+
use Tempest\Process\ProcessExecutor;
2021
use Tempest\Router\Exceptions\HttpExceptionHandler;
2122

2223
final class FrameworkKernel implements Kernel
@@ -100,9 +101,15 @@ public function createContainer(): Container
100101

101102
public function loadComposer(): self
102103
{
104+
if (class_exists(GenericProcessExecutor::class, false)) {
105+
$processExecutor = new GenericProcessExecutor();
106+
} else {
107+
$processExecutor = null;
108+
}
109+
103110
$composer = new Composer(
104111
root: $this->root,
105-
executor: new GenericProcessExecutor(),
112+
executor: $processExecutor,
106113
)->load();
107114

108115
$this->container->singleton(Composer::class, $composer);

0 commit comments

Comments
 (0)