1
0
Fork 0

Merge pull request #2004 from jaypea/recursive_artifactrepository

ArtifactRepository needs recursive iteration
pull/2007/head
Jordi Boggiano 2013-06-13 08:45:05 -07:00
commit d498e73363
4 changed files with 6 additions and 1 deletions

View File

@ -47,7 +47,11 @@ class ArtifactRepository extends ArrayRepository
private function scanDirectory($path) private function scanDirectory($path)
{ {
$io = $this->io; $io = $this->io;
foreach (new \RecursiveDirectoryIterator($path) as $file) {
$directory = new \RecursiveDirectoryIterator($path);
$iterator = new \RecursiveIteratorIterator($directory);
$regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
foreach ($regex as $file) {
/* @var $file \SplFileInfo */ /* @var $file \SplFileInfo */
if (!$file->isFile()) { if (!$file->isFile()) {
continue; continue;

View File

@ -25,6 +25,7 @@ class ArtifactRepositoryTest extends TestCase
'vendor0/package0-0.0.1', 'vendor0/package0-0.0.1',
'composer/composer-1.0.0-alpha6', 'composer/composer-1.0.0-alpha6',
'vendor1/package2-4.3.2', 'vendor1/package2-4.3.2',
'vendor3/package1-5.4.3',
); );
$coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts'); $coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts');