Skip to content

Commit c4a5d8c

Browse files
committed
tweak: composer update after install
1 parent db88dc4 commit c4a5d8c

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

src/Blueprint/Blueprint.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function getDescription():string {
2424
return $this->description;
2525
}
2626

27-
public function install(string $dir):Process {
27+
public function createProject(string $dir):Process {
2828
return new Process(
2929
"composer",
3030
"create-project",
@@ -33,4 +33,14 @@ public function install(string $dir):Process {
3333
$dir
3434
);
3535
}
36+
37+
public function updateDependencies(string $dir):Process {
38+
$process = new Process(
39+
"composer",
40+
"update",
41+
);
42+
$process->setExecCwd($dir);
43+
return $process;
44+
}
45+
3646
}

src/Command/CreateCommand.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,18 @@ public function run(?ArgumentValueList $arguments = null):void {
5151
$this->writeLine("Creating project '$name' in namespace '$namespace' with blueprint '$selectedBlueprintTitle'...");
5252
sleep(1);
5353

54-
$process = $selectedBlueprint->install($name);
54+
$process = $selectedBlueprint->createProject($name);
55+
$process->exec();
56+
57+
do {
58+
$this->write($process->getOutput());
59+
$this->write($process->getErrorOutput(), Stream::ERROR);
60+
usleep(100_000);
61+
}
62+
while($process->isRunning());
63+
64+
$process = $selectedBlueprint->updateDependencies($name);
5565
$process->exec();
56-
$process->setBlocking(false);
5766

5867
do {
5968
$this->write($process->getOutput());

0 commit comments

Comments
 (0)