1
0
Fork 0

Add support for wildcards in exclude-from-classmap, refs #1607

pull/4568/head
Jordi Boggiano 2015-10-30 19:12:30 +00:00
parent 463236cb74
commit 6c16510743
2 changed files with 13 additions and 1 deletions

View File

@ -690,6 +690,10 @@ FOOTER;
// first escape user input
$path = preg_quote(trim(strtr($path, '\\', '/'), '/'));
// add support for wildcards * and **
$path = str_replace('\\*\\*', '.*?', $path);
$path = str_replace('\\*', '[^/]*?', $path);
$autoloads[] = empty($installPath) ? preg_quote(strtr(getcwd(), '\\', '/')) . '/' . $path : preg_quote($installPath) . '/' . $path;
continue;
}

View File

@ -1274,7 +1274,12 @@ EOF;
'Acme\Cake\\' => array('src-cake/', 'lib-cake/'),
),
'classmap' => array('composersrc/'),
'exclude-from-classmap' => array('/composersrc/excludedTests/', '/composersrc/ClassToExclude.php'),
'exclude-from-classmap' => array(
'/composersrc/excludedTests/',
'/composersrc/ClassToExclude.php',
'/composersrc/*/excluded/excsubpath',
'**/excsubpath',
),
));
$this->repository->expects($this->once())
@ -1300,6 +1305,9 @@ EOF;
$this->fs->ensureDirectoryExists($this->workingDir.'/composersrc/excludedTests');
file_put_contents($this->workingDir.'/composersrc/excludedTests/bar.php', '<?php class ClassExcludeMapFoo {}');
file_put_contents($this->workingDir.'/composersrc/ClassToExclude.php', '<?php class ClassClassToExclude {}');
$this->fs->ensureDirectoryExists($this->workingDir.'/composersrc/long/excluded/excsubpath');
file_put_contents($this->workingDir.'/composersrc/long/excluded/excsubpath/foo.php', '<?php class ClassExcludeMapFoo2 {}');
file_put_contents($this->workingDir.'/composersrc/long/excluded/excsubpath/bar.php', '<?php class ClassExcludeMapBar {}');
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');