Skip to content

Commit c5b74ae

Browse files
committed
updates from main
1 parent 0b4f47e commit c5b74ae

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

dev/src/Command/AddVersionCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
117117
if ($returnCode !== Command::SUCCESS) {
118118
return $returnCode;
119119
}
120-
// Run "add-sample-to-readme" command to ensure our README contains the latest version's sample.
121-
$addSamplesArgs = ['--component' => [$componentName], '--update' => true];
122-
if (!$addSampleCommand = $this->getApplication()->find('add-sample-to-readme')) {
120+
// Run "update-readme-sample" command to ensure our README contains the latest version's sample.
121+
$updateReadmeSampleArgs = ['--component' => [$componentName], '--update' => true];
122+
if (!$updateReadmeSampleCommand = $this->getApplication()->find('update-readme-sample')) {
123123
throw new \RuntimeException('Application does not have an add-samples-to-readme command.');
124124
}
125-
return $addSampleCommand->run(new ArrayInput($addSamplesArgs), $output);
125+
return $updateReadmeSampleCommand->run(new ArrayInput($updateReadmeSampleArgs), $output);
126126
}
127127
}

dev/src/Component.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public function __construct(private string $name, ?string $path = null)
4747
$this->validateComponentFiles();
4848
}
4949

50-
private static function getComponentNames(string $rootDir): array
50+
private static function getComponentNames(?string $rootDir): array
5151
{
52-
$components = scandir($rootDir);
52+
$components = scandir($rootDir ?? self::ROOT_DIR);
5353
foreach ($components as $i => $name) {
5454
if (!is_dir(self::ROOT_DIR . $name) || !preg_match('/^[A-Z]/', $name)) {
5555
unset($components[$i]);
@@ -61,12 +61,9 @@ private static function getComponentNames(string $rootDir): array
6161

6262
public static function getComponents(array $componentNames = [], ?string $rootDir = null): array
6363
{
64-
if (is_null($rootDir)) {
65-
$rootDir = realpath(self::ROOT_DIR);
66-
}
6764
$components = [];
6865
foreach ($componentNames ?: self::getComponentNames($rootDir) as $name) {
69-
$components[] = new Component($name, $rootDir . '/' . $name);
66+
$components[] = new Component($name, $rootDir ? $rootDir . '/' . $name : null);
7067
}
7168

7269
return $components;

0 commit comments

Comments
 (0)