Split Composer Satis repositories into smaller packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# For each sub-package, run the Satis build command. | |
php bin/satis build repositories-mirrors.json ./web/mirrors | |
php bin/satis build repositories-pear.json ./web/pear | |
php bin/satis build repositoriesp-rojects.json ./web/projects | |
# Merge all the package files. | |
php web/packages.php > web/packages.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// File located in web/packages.php | |
require __DIR__.'/../vendor/autoload.php'; | |
$dirs = array( | |
'mirrors', | |
'pear', | |
'projects', | |
); | |
$packages = array( | |
'packages' => array(), | |
'includes' => array(), | |
); | |
foreach ($dirs as $dir) { | |
$file = __DIR__.'/'.$dir.'/packages.json'; | |
if (!file_exists($file)) { | |
fwrite(STDERR, "File $file does not exist.\n"); | |
$packages['includes'][$dir.'/packages.json'] = new stdClass; | |
continue; | |
} | |
$data = json_decode(file_get_contents($file), true); | |
foreach ($data['includes'] as $key => $value) { | |
$packages['includes'][$dir.'/'.$key] = $value; | |
} | |
} | |
header('Content-Type: text/plain'); | |
echo Composer\Json\JsonFormatter::format(json_encode($packages), false, true); | |
echo PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment