2002-03-19 19:55:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'PEAR/Command/Common.php';
|
|
|
|
require_once 'PEAR/Packager.php';
|
|
|
|
|
|
|
|
class PEAR_Command_Package extends PEAR_Command_Common
|
|
|
|
{
|
|
|
|
// {{{ constructor
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PEAR_Command_Login constructor.
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
*/
|
2002-03-21 11:10:17 +00:00
|
|
|
function PEAR_Command_Package(&$ui, &$config)
|
2002-03-19 19:55:30 +00:00
|
|
|
{
|
2002-03-21 11:10:17 +00:00
|
|
|
parent::PEAR_Command_Common($ui, $config);
|
2002-03-19 19:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// }}}
|
|
|
|
|
|
|
|
// {{{ getCommands()
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a list of all the commands defined by this class.
|
|
|
|
* @return array list of commands
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
function getCommands()
|
|
|
|
{
|
|
|
|
return array('package');
|
|
|
|
}
|
|
|
|
|
|
|
|
// }}}
|
|
|
|
// {{{ run()
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the command.
|
|
|
|
*
|
|
|
|
* @param string command name
|
|
|
|
*
|
|
|
|
* @param array option_name => value
|
|
|
|
*
|
|
|
|
* @param array list of additional parameters
|
|
|
|
*
|
|
|
|
* @return bool TRUE on success, FALSE for unknown commands, or
|
|
|
|
* a PEAR error on failure
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
*/
|
2002-03-21 11:10:17 +00:00
|
|
|
function run($command, $params)
|
2002-03-19 19:55:30 +00:00
|
|
|
{
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
|
|
|
// }}}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|