added support for nested location of composer.json files within artifacts
parent
83bb38de56
commit
f25bfe09c5
|
@ -69,12 +69,23 @@ class ArtifactRepository extends ArrayRepository
|
||||||
|
|
||||||
private function getComposerInformation(\SplFileInfo $file)
|
private function getComposerInformation(\SplFileInfo $file)
|
||||||
{
|
{
|
||||||
$composerFile = "zip://{$file->getPathname()}#composer.json";
|
$zip = new \ZipArchive();
|
||||||
$json = @file_get_contents($composerFile);
|
$zip->open($file->getPathname());
|
||||||
if (!$json) {
|
|
||||||
|
if (0 == $zip->numFiles) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$foundFileIndex = $zip->locateName('composer.json', \ZipArchive::FL_NODIR);
|
||||||
|
if (false === $foundFileIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$configurationFileName = $zip->getNameIndex($foundFileIndex);
|
||||||
|
|
||||||
|
$composerFile = "zip://{$file->getPathname()}#$configurationFileName";
|
||||||
|
$json = file_get_contents($composerFile);
|
||||||
|
|
||||||
$package = JsonFile::parseJson($json, $composerFile);
|
$package = JsonFile::parseJson($json, $composerFile);
|
||||||
$package['dist'] = array(
|
$package['dist'] = array(
|
||||||
'type' => 'zip',
|
'type' => 'zip',
|
||||||
|
|
|
@ -22,6 +22,7 @@ class ArtifactRepositoryTest extends TestCase
|
||||||
public function testExtractsConfigsFromZipArchives()
|
public function testExtractsConfigsFromZipArchives()
|
||||||
{
|
{
|
||||||
$expectedPackages = array(
|
$expectedPackages = array(
|
||||||
|
'composer/composer-1.0.0-alpha6',
|
||||||
'vendor0/package0-0.0.1',
|
'vendor0/package0-0.0.1',
|
||||||
'vendor1/package2-4.3.2',
|
'vendor1/package2-4.3.2',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue