cvs: pear /CodeGen/CodeGen Extension.php ExtensionParser.php

From: Date: Tue, 07 Mar 2006 22:54:31 +0000
Subject: cvs: pear /CodeGen/CodeGen Extension.php ExtensionParser.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38966@lists.php.net to get a copy of this message
hholzgra Tue Mar 7 22:54:31 2006 UTC Modified files: /pear/CodeGen/CodeGen Extension.php ExtensionParser.php Log: support additional target dir for extra package files http://cvs.php.net/viewcvs.cgi/pear/CodeGen/CodeGen/Extension.php?r1=1.17&r2=1.18&diff_format=u Index: pear/CodeGen/CodeGen/Extension.php diff -u pear/CodeGen/CodeGen/Extension.php:1.17 pear/CodeGen/CodeGen/Extension.php:1.18 --- pear/CodeGen/CodeGen/Extension.php:1.17 Tue Mar 7 08:45:12 2006 +++ pear/CodeGen/CodeGen/Extension.php Tue Mar 7 22:54:31 2006 @@ -15,7 +15,7 @@ * @author Hartmut Holzgraefe <hartmut@php.net> * @copyright 2005 Hartmut Holzgraefe * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Extension.php,v 1.17 2006/03/07 08:45:12 hholzgra Exp $ + * @version CVS: $Id: Extension.php,v 1.18 2006/03/07 22:54:31 hholzgra Exp $ * @link http://pear.php.net/package/CodeGen */ @@ -548,17 +548,24 @@ * @access public * @param string type * @param string path + * @param string optional target dir * @returns bool success state */ - function addPackageFile($type, $path) + function addPackageFile($type, $path, $dir = "") { - $basename = basename($path); + $targetpath = basename($path); + if ($dir) { + if ($dir{0} == "/") { + return PEAR::raiseError("only relative pathes are allowed as target dir"); + } + $targetpath = $dir."/".$targetpath; + } - if (isset($this->packageFiles[$type][$basename])) { - return PEAR::raiseError("duplicate distribution file name '$basename'"); + if (isset($this->packageFiles[$type][$targetpath])) { + return PEAR::raiseError("duplicate distribution file name '$targetpath'"); } - $this->packageFiles[$type][$basename] = $path; + $this->packageFiles[$type][$targetpath] = $path; return true; } @@ -567,8 +574,9 @@ * * @access public * @param string path + * @param string optional target dir */ - function addSourceFile($name) + function addSourceFile($name, $dir="") { // TODO catch errors returned from addPackageFile @@ -611,7 +619,7 @@ break; } - return $this->addPackageFile('copy', $filename); + return $this->addPackageFile('copy', $filename, $dir); } /** http://cvs.php.net/viewcvs.cgi/pear/CodeGen/CodeGen/ExtensionParser.php?r1=1.12&r2=1.13&diff_format=u Index: pear/CodeGen/CodeGen/ExtensionParser.php diff -u pear/CodeGen/CodeGen/ExtensionParser.php:1.12 pear/CodeGen/CodeGen/ExtensionParser.php:1.13 --- pear/CodeGen/CodeGen/ExtensionParser.php:1.12 Wed Feb 22 01:47:16 2006 +++ pear/CodeGen/CodeGen/ExtensionParser.php Tue Mar 7 22:54:31 2006 @@ -15,7 +15,7 @@ * @author Hartmut Holzgraefe <hartmut@php.net> * @copyright 2005 Hartmut Holzgraefe * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: ExtensionParser.php,v 1.12 2006/02/22 01:47:16 hholzgra Exp $ + * @version CVS: $Id: ExtensionParser.php,v 1.13 2006/03/07 22:54:31 hholzgra Exp $ * @link http://pear.php.net/package/CodeGen */ @@ -345,7 +345,7 @@ function tagstart_deps_file($attr) { - $err = $this->checkAttributes($attr, array("name")); + $err = $this->checkAttributes($attr, array("name", "dir")); if (PEAR::isError($err)) { return $err; } @@ -354,7 +354,11 @@ return PEAR::raiseError("name attribut for file missing"); } - return $this->extension->addSourceFile($attr['name']); + if (isset($attr["dir"])) { + return $this->extension->addSourceFile($attr['name'], $attr['dir']); + } else { + return $this->extension->addSourceFile($attr['name']); + } } function tagstart_deps_lib($attr)

« previous php.pear.cvs (#38966) next »