Skip to content

Commit

Permalink
ENH Update reference to supported modules data
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed May 8, 2024
1 parent 6facb4e commit ed9d9d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
}
],
"require": {
"php": "^7.4 || ^8.1",
"php": "^8.1",
"silverstripe/supported-modules": "dev-main",
"symfony/console": "^4 || ^5 || ^6",
"symfony/process": "^4 || ^5 || ^6",
"symfony/yaml": "^4 || ^5 || ^6",
Expand Down
14 changes: 8 additions & 6 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use RuntimeException;
use LogicException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use SilverStripe\SupportedModules\MetaData;

class Translator
{
Expand Down Expand Up @@ -150,15 +151,16 @@ private function getFrameworkMajor(): string

private function setModulePaths(): void
{
$client = new Client();
$cmsMajor = $this->getFrameworkMajor();
$url = "https://raw.githubusercontent.com/silverstripe/supported-modules/$cmsMajor/modules.json";
$body = (string) $client->request('GET', $url)->getBody();
$modules = MetaData::removeReposNotInCmsMajor(
MetaData::getAllRepositoryMetaData()[MetaData::CATEGORY_SUPPORTED],
$cmsMajor
);
$supportedVendors = [];
$supportedModules = [];
foreach ($this->jsonDecode($body) as $data) {
$supportedModules[] = $data['composer'];
$supportedVendors[] = explode('/', $data['composer'])[0];
foreach ($modules as $module) {
$supportedModules[] = $module['packagist'];
$supportedVendors[] = explode('/', $module['packagist'])[0];
}
$vendorDir = dirname(dirname(dirname(__DIR__)));
foreach ($this->scandir($vendorDir) as $vendor) {
Expand Down

0 comments on commit ed9d9d2

Please sign in to comment.