Skip to content

Commit 7b7c6ea

Browse files
Decouple from flex.symfony.com
1 parent 2ce5b74 commit 7b7c6ea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/GenerateFlexEndpointCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected function configure(): void
2626
->addArgument('source_branch', InputArgument::REQUIRED, 'The source branch of recipes')
2727
->addArgument('flex_branch', InputArgument::REQUIRED, 'The branch of the target Flex endpoint')
2828
->addArgument('output_directory', InputArgument::REQUIRED, 'The directory where generated files should be stored')
29+
->addArgument('versions_json', InputArgument::OPTIONAL, 'The file where versions of Symfony are described')
2930
->addOption('contrib')
3031
;
3132
}
@@ -36,13 +37,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3637
$sourceBranch = $input->getArgument('source_branch');
3738
$flexBranch = $input->getArgument('flex_branch');
3839
$outputDir = $input->getArgument('output_directory');
40+
$versionsJson = $input->getArgument('versions_json');
3941
$contrib = $input->getOption('contrib');
4042

41-
$aliases = $recipes = [];
43+
$aliases = $recipes = $versions = [];
4244

43-
if (!$contrib) {
44-
$versions = HttpClient::create()->request('GET', 'https://flex.symfony.com/versions.json')->toArray();
45-
unset($versions['warning']);
45+
if ($versionsJson) {
46+
$versions = json_decode(file_get_contents($versionsJson), true);
4647

4748
foreach ($versions['splits'] as $package => $v) {
4849
if (0 === strpos($package, 'symfony/') && '-pack' !== substr($package, -5)) {
@@ -90,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9091
file_put_contents($outputDir.'/index.json', json_encode([
9192
'aliases' => $aliases,
9293
'recipes' => $recipes,
93-
'versions' => $contrib ? [] : $versions,
94+
'versions' => $versions,
9495
'branch' => $sourceBranch,
9596
'is_contrib' => $contrib,
9697
'_links' => [

0 commit comments

Comments
 (0)