From de381091ba9c78938e4ff710e5ebf4099259b523 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Tue, 19 Mar 2002 19:55:30 +0000 Subject: [PATCH] * re-add "package" command --- pear/PEAR/Command/Package.php | 91 +++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 pear/PEAR/Command/Package.php diff --git a/pear/PEAR/Command/Package.php b/pear/PEAR/Command/Package.php new file mode 100644 index 00000000000..f7a400f2bc4 --- /dev/null +++ b/pear/PEAR/Command/Package.php @@ -0,0 +1,91 @@ + value + * + * @param array list of additional parameters + * + * @return bool TRUE on success, FALSE for unknown commands, or + * a PEAR error on failure + * + * @access public + */ + function run($command, $options, $params) + { + $failmsg = ''; + switch ($command) { + case 'package': { + $pkginfofile = isset($params[0]) ? $params[0] : null; + ob_start(); + $packager =& new PEAR_Packager($this->config->get('php_dir'), + $this->config->get('ext_dir'), + $this->config->get('doc_dir')); + $packager->debug = $this->config->get('verbose'); + $result = $packager->Package($pkginfofile); + $output = ob_get_contents(); + ob_end_clean(); + $lines = explode("\n", $output); + foreach ($lines as $line) { + $this->ui->displayLine($line); + } + if (PEAR::isError($result)) { + $this->ui->displayLine("Package failed!"); + } else { + $this->ui->displayLine("Package ok."); + } + break; + } + default: { + return false; + } + } + if ($failmsg) { + return $this->raiseError($failmsg); + } + return true; + } + + // }}} + + +} + +?> \ No newline at end of file