From: Gunnar Wrobel Date: Tue, 2 Nov 2010 20:53:17 +0000 (+0100) Subject: Start specialized dir_role mapping for special packages ("horde" for a start). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=825aace69df6e5c9b98e2e7dfec80df7fdf44504;p=horde.git Start specialized dir_role mapping for special packages ("horde" for a start). --- diff --git a/components/lib/Components/Pear/Package/Contents/Factory.php b/components/lib/Components/Pear/Package/Contents/Factory.php index 655b8fcc2..caea08ca9 100644 --- a/components/lib/Components/Pear/Package/Contents/Factory.php +++ b/components/lib/Components/Pear/Package/Contents/Factory.php @@ -41,18 +41,7 @@ class Components_Pear_Package_Contents_Factory $root = new Components_Helper_Root( $package->_options['packagedirectory'] ); - $package->_options['dir_roles'] = array( - 'bin' => 'script', - 'script' => 'script', - 'doc' => 'doc', - 'example' => 'doc', - 'js' => 'horde', - 'horde' => 'horde', - 'lib' => 'php', - 'migration' => 'data', - 'scripts' => 'data', - 'test' => 'test', - ); + $package->_options['dir_roles'] = $this->_getMapping($root->getBase()); return new Components_Pear_Package_Contents_List( $package->_options['packagedirectory'], new Components_Pear_Package_Contents_Ignore( @@ -61,4 +50,48 @@ class Components_Pear_Package_Contents_Factory ) ); } + + /** + * Return the directory <-> role mapping for the specific package. + * + * @param string $path The package path. + * + * @return array The mapping. + */ + private function _getMapping($path) + { + switch ($path) { + case 'horde/': + return array( + 'admin' => 'horde', + 'bin' => 'script', + 'config' => 'horde', + 'script' => 'script', + 'docs' => 'doc', + 'js' => 'horde', + 'lib' => 'horde', + 'scripts' => 'data', + 'services' => 'horde', + 'test' => 'test', + 'templates' => 'horde', + 'themes' => 'horde', + 'util' => 'horde', + ); + break; + default: + return array( + 'bin' => 'script', + 'script' => 'script', + 'doc' => 'doc', + 'example' => 'doc', + 'js' => 'horde', + 'horde' => 'horde', + 'lib' => 'php', + 'migration' => 'data', + 'scripts' => 'data', + 'test' => 'test', + ); + break; + } + } } \ No newline at end of file