Skip to content

Commit

Permalink
Add script responsible for the check of ordering of repositories by a…
Browse files Browse the repository at this point in the history
…liases
  • Loading branch information
Aeliot-Tm authored and theseer committed Sep 9, 2024
1 parent ba14531 commit 395e3a3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/order-repos/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

$path = __DIR__ . '/../../data/repositories.xml';
$xml = simplexml_load_string(file_get_contents($path));

/** @var SimpleXMLElement[] $phars */
$aliases = [];
foreach ($xml->children() as $phar) {
$aliases[] = (string) $phar->attributes()['alias'];
}

$currentAliases = $aliases;
sort($aliases);

if ($currentAliases === $aliases) {
fwrite(STDOUT, 'Repositories is ordered properly' . PHP_EOL);
exit(0);
}

fwrite(STDERR, 'Repositories is NOT ordered by aliases' . PHP_EOL);
exit(1);

0 comments on commit 395e3a3

Please sign in to comment.