1
0
Fork 0

Allow the autoloader suffix to be configured from a project's composer.json

pull/2524/head
Stan Lemon 2013-12-22 22:01:42 -05:00
parent fb72d26def
commit d6c46f2091
3 changed files with 6 additions and 1 deletions

View File

@ -176,6 +176,10 @@
"type": ["string", "boolean"], "type": ["string", "boolean"],
"description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"." "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
}, },
"autoloader-suffix": {
"type": ["string", "boolean"],
"description": "Optional string to be used as a suffix to the autoloader generator. When null a random one will be generated."
},
"prepend-autoloader": { "prepend-autoloader": {
"type": "boolean", "type": "boolean",
"description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true." "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."

View File

@ -169,7 +169,7 @@ EOF;
$classmapFile .= ");\n"; $classmapFile .= ");\n";
if (!$suffix) { if (!$suffix) {
$suffix = md5(uniqid('', true)); $suffix = $config->get('autoloader-suffix') ? $config->get('autoloader-suffix') : md5(uniqid('', true));
} }
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);

View File

@ -35,6 +35,7 @@ class Config
'cache-files-ttl' => null, // fallback to cache-ttl 'cache-files-ttl' => null, // fallback to cache-ttl
'cache-files-maxsize' => '300MiB', 'cache-files-maxsize' => '300MiB',
'discard-changes' => false, 'discard-changes' => false,
'autoload-suffix' => false,
'prepend-autoloader' => true, 'prepend-autoloader' => true,
'github-domains' => array('github.com'), 'github-domains' => array('github.com'),
); );