From bf02a16b050585b97af4e1ba9897d0d73fa2692d Mon Sep 17 00:00:00 2001 From: thomasd Date: Fri, 17 Dec 2010 16:35:43 +0100 Subject: [PATCH] Added the ability to read the description for a file from the source-entry in the manifest. --- packager.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packager.php b/packager.php index b5ecb32..5c2db90 100644 --- a/packager.php +++ b/packager.php @@ -61,6 +61,11 @@ private function parse_manifest($path){ foreach ($manifest['sources'] as $i => $path){ + // thomasd: if the source-node contains a description we cache it, but we wait if there's also a description-header in the file as this one takes precedence + if(is_array($path)){ + $source_desc = $path[1]; + $path = $path[0]; + } $path = $package_path . $path; // this is where we "hook" for possible other replacers. @@ -71,7 +76,13 @@ private function parse_manifest($path){ // get contents of first comment preg_match('/\/\*\s*^---(.*?)^\.\.\.\s*\*\//ms', $source, $matches); - if (!empty($matches)) $descriptor = YAML::decode($matches[0]); + if (!empty($matches)){ + $descriptor = YAML::decode($matches[0]); + } + // thomasd: if the file doesn't contain a proper description-header but the manifest does, we take that description + else if(isset($source_desc) && is_array($source_desc)){ + $descriptor = $source_desc; + } // populate / convert to array requires and provides $requires = (array)(!empty($descriptor['requires']) ? $descriptor['requires'] : array());