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

main
Jordi Boggiano 9 years ago
parent 463236cb74
commit 6c16510743

@ -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;
}

@ -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');

Loading…
Cancel
Save