Skip to content

Instantly share code, notes, and snippets.

@h4cc
Created April 23, 2014 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h4cc/11214984 to your computer and use it in GitHub Desktop.
Save h4cc/11214984 to your computer and use it in GitHub Desktop.
Redirecting packages.json for Composer/Satis.
<?php
/**
* This file generates a new package.json on STDOUT, that will
* include the other package.json files.
*
* @author Julius Beckmann <beckmann@silpion.de>
*
* Documentation on this:
* https://github.com/composer/composer/blob/c849f7d05d4eb5e585c34c83bd41341bc144f0d0/doc/05-repositories.md
*/
$webDir = 'web/';
$files = array(
// Public Mirror and index.
'public/packages.json',
// Private Silpion packages index.
'private/packages.json',
);
$includes = array();
foreach($files as $file) {
if(file_exists($webDir . $file)) {
$includes[$file] = array(
'sha1' => sha1_file($webDir . $file),
);
}
}
echo json_encode(
array(
'includes' => $includes,
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment