cvs: php4 /pear Makefile.frag package-pear.xml /pear/PEAR Command.php /pear/PEAR/Command Auth.php Config.php Install.php Package.php Registry.php
Remote.php /pear/PEAR/Frontend Gtk.php /pear/scripts pear.in

From: Date: Thu, 09 May 2002 02:31:37 +0000
Subject: cvs: php4 /pear Makefile.frag package-pear.xml /pear/PEAR Command.php /pear/PEAR/Command Auth.php Config.php Install.php Package.php Registry.php
Remote.php /pear/PEAR/Frontend Gtk.php /pear/scripts pear.in
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3711@lists.php.net to get a copy of this message
ssb Wed May 8 22:31:37 2002 EDT Added files: /php4/pear/PEAR/Frontend Gtk.php Modified files: /php4/pear Makefile.frag package-pear.xml /php4/pear/PEAR Command.php /php4/pear/PEAR/Command Auth.php Config.php Install.php Package.php Registry.php Remote.php /php4/pear/scripts pear.in Log: * add -G option to "pear" for php-gtk frontend * added Gtk stub (only creates window right now) * added command descriptions

Index: php4/pear/Makefile.frag diff -u php4/pear/Makefile.frag:1.14 php4/pear/Makefile.frag:1.15 --- php4/pear/Makefile.frag:1.14 Tue Apr 9 12:06:07 2002 +++ php4/pear/Makefile.frag Wed May 8 22:31:36 2002 @@ -94,25 +94,29 @@ # Net/Socket.php \ # Schedule/At.php \ -PEAR_PACKAGES=\ - Net_Socket-1.0.tgz - +#PEARCMD=$(top_builddir)/sapi/cli/php $(builddir)/scripts/pear +# +#install-pear-installer: $(top_builddir)/sapi/cli/php +# version=`grep '<version>' $(srcdir)/package-pear.xml|head -1|cut -d\> -f2|cut -d\< -f1`; \ +# if $(PEARCMD) shell-test PEAR; then +# if ! $(PEARCMD) shell-test PEAR $$version; then \ +# $(PEARCMD) upgrade package-pear.xml; \ +# fi; \ +# else; \ +# $(PEARCMD) install package-pear.xml; \ +# fi install-pear: @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \ for i in $(PEAR_SUBDIRS); do \ $(mkinstalldirs) $(INSTALL_ROOT)$(peardir)/$$i; \ done; \ - for dir in PEAR/CommandUI; do \ - test -d $(INSTALL_ROOT)$(peardir)/$$dir && rm -rf $(INSTALL_ROOT)$(peardir)/$$dir; \ - done; \ for i in $(PEAR_FILES); do \ echo "Installing $$i"; \ dir=`echo $$i|sed 's%[^/][^/]*$$%%'`; \ $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(peardir)/$$dir; \ done; \ rm -f $(INSTALL_ROOT)$(peardir)/PEAR/Command/Login.php; \ - rm -f $(INSTALL_ROOT)$(peardir)/PEAR/CommandUI/CLI.php; \ rm -f $(INSTALL_ROOT)$(peardir)/PEAR/CommandResponse.php; \ rm -f $(INSTALL_ROOT)$(peardir)/PEAR/Uploader.php; \ else \ Index: php4/pear/package-pear.xml diff -u php4/pear/package-pear.xml:1.11 php4/pear/package-pear.xml:1.12 --- php4/pear/package-pear.xml:1.11 Fri May 3 01:42:55 2002 +++ php4/pear/package-pear.xml Wed May 8 22:31:36 2002 @@ -50,6 +50,7 @@ <file role="php" name="Dependency.php"/> <dir name="Frontend"> <file role="php" name="CLI.php"/> + <file role="php" name="Gtk.php"/> </dir> <file role="php" name="Installer.php"/> <file role="php" name="Packager.php"/> Index: php4/pear/PEAR/Command.php diff -u php4/pear/PEAR/Command.php:1.10 php4/pear/PEAR/Command.php:1.11 --- php4/pear/PEAR/Command.php:1.10 Thu Apr 18 14:04:06 2002 +++ php4/pear/PEAR/Command.php Wed May 8 22:31:36 2002 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Command.php,v 1.10 2002/04/18 18:04:06 mj Exp $ +// $Id: Command.php,v 1.11 2002/05/09 02:31:36 ssb Exp $ require_once "PEAR.php"; @@ -197,8 +197,9 @@ include_once $file; // List of commands $implements = call_user_func(array($class, "getCommands")); - foreach ($implements as $command) { + foreach ($implements as $command => $desc) { $GLOBALS['_PEAR_Command_commandlist'][$command] = $class; + $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc; } // List of options accepted $cmdopts = array_merge($cmdopts, call_user_func(array($class, "getOptions"))); @@ -237,6 +238,20 @@ PEAR_Command::registerCommands(); } return $GLOBALS['_PEAR_Command_commandopts']; + } + + /** + * Get description for a command. + * + * @param string $command Name of the command + * + * @return string command description + * + * @access public + */ + function getDescription($command) + { + return @$GLOBALS['_PEAR_Command_commanddesc'][$command]; } /** Index: php4/pear/PEAR/Command/Auth.php diff -u php4/pear/PEAR/Command/Auth.php:1.4 php4/pear/PEAR/Command/Auth.php:1.5 --- php4/pear/PEAR/Command/Auth.php:1.4 Mon Apr 1 10:23:46 2002 +++ php4/pear/PEAR/Command/Auth.php Wed May 8 22:31:36 2002 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.4 2002/04/01 15:23:46 cox Exp $ +// $Id: Auth.php,v 1.5 2002/05/09 02:31:36 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Remote.php"; @@ -51,7 +51,8 @@ */ function getCommands() { - return array('login', 'logout'); + return array('login' => 'Log In', + 'logout' => 'Log Out'); } // }}} Index: php4/pear/PEAR/Command/Config.php diff -u php4/pear/PEAR/Command/Config.php:1.8 php4/pear/PEAR/Command/Config.php:1.9 --- php4/pear/PEAR/Command/Config.php:1.8 Mon Apr 1 14:16:01 2002 +++ php4/pear/PEAR/Command/Config.php Wed May 8 22:31:36 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.8 2002/04/01 19:16:01 cox Exp $ +// $Id: Config.php,v 1.9 2002/05/09 02:31:36 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -55,7 +55,9 @@ */ function getCommands() { - return array('config-show', 'config-get', 'config-set'); + return array('config-show' => 'Show All Settings', + 'config-get' => 'Show One Setting', + 'config-set' => 'Change Setting'); } // }}} Index: php4/pear/PEAR/Command/Install.php diff -u php4/pear/PEAR/Command/Install.php:1.20 php4/pear/PEAR/Command/Install.php:1.21 --- php4/pear/PEAR/Command/Install.php:1.20 Mon Apr 29 02:24:37 2002 +++ php4/pear/PEAR/Command/Install.php Wed May 8 22:31:36 2002 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Install.php,v 1.20 2002/04/29 06:24:37 ssb Exp $ +// $Id: Install.php,v 1.21 2002/05/09 02:31:36 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Installer.php"; @@ -51,7 +51,9 @@ */ function getCommands() { - return array('install', 'uninstall', 'upgrade'); + return array('install' => 'Install Package', + 'uninstall' => 'Uninstall Package', + 'upgrade' => 'Upgrade Package'); } function getHelp($command) Index: php4/pear/PEAR/Command/Package.php diff -u php4/pear/PEAR/Command/Package.php:1.21 php4/pear/PEAR/Command/Package.php:1.22 --- php4/pear/PEAR/Command/Package.php:1.21 Mon Apr 15 20:22:55 2002 +++ php4/pear/PEAR/Command/Package.php Wed May 8 22:31:36 2002 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.21 2002/04/16 00:22:55 cox Exp $ +// $Id: Package.php,v 1.22 2002/05/09 02:31:36 ssb Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Packager.php'; @@ -67,11 +67,11 @@ */ function getCommands() { - return array('package', - 'package-info', - 'package-list', - 'package-validate', - 'cvstag'); + return array('package' => 'Build Package', + 'package-info' => 'Show Package Info', + 'package-list' => 'List Files in Package', + 'package-validate' => 'Validate Package', + 'cvstag' => 'Set CVS Release Tag'); } // }}} Index: php4/pear/PEAR/Command/Registry.php diff -u php4/pear/PEAR/Command/Registry.php:1.8 php4/pear/PEAR/Command/Registry.php:1.9 --- php4/pear/PEAR/Command/Registry.php:1.8 Mon Apr 15 20:31:16 2002 +++ php4/pear/PEAR/Command/Registry.php Wed May 8 22:31:36 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.8 2002/04/16 00:31:16 cox Exp $ +// $Id: Registry.php,v 1.9 2002/05/09 02:31:36 ssb Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Registry.php'; @@ -48,7 +48,8 @@ */ function getCommands() { - return array('list-installed', 'shell-test'); + return array('list-installed' => 'List Installed Packages', + 'shell-test' => 'Shell Script Test'); } function getHelp($command) Index: php4/pear/PEAR/Command/Remote.php diff -u php4/pear/PEAR/Command/Remote.php:1.7 php4/pear/PEAR/Command/Remote.php:1.8 --- php4/pear/PEAR/Command/Remote.php:1.7 Mon Apr 29 02:23:51 2002 +++ php4/pear/PEAR/Command/Remote.php Wed May 8 22:31:36 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.7 2002/04/29 06:23:51 ssb Exp $ +// $Id: Remote.php,v 1.8 2002/05/09 02:31:36 ssb Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Common.php'; @@ -48,10 +48,10 @@ */ function getCommands() { - return array('remote-package-info', - 'list-upgrades', - 'list-remote-packages', - 'download'); + return array('remote-package-info' => 'Information About Remote Package', + 'list-upgrades' => 'List Available Upgrades', + 'list-remote-packages' => 'List Remote Packages', + 'download' => 'Download Package'); } // }}} Index: php4/pear/scripts/pear.in diff -u php4/pear/scripts/pear.in:1.41 php4/pear/scripts/pear.in:1.42 --- php4/pear/scripts/pear.in:1.41 Thu May 2 01:36:21 2002 +++ php4/pear/scripts/pear.in Wed May 8 22:31:37 2002 @@ -33,19 +33,27 @@ PEAR_Command::setFrontendType('CLI'); $all_commands = PEAR_Command::getCommands(); $cmd_options = PEAR_Command::getOptions(); -$ui = &PEAR_Command::getFrontendObject(); $progname = basename(__FILE__); // XXX change Getopt to use raiseError() ? $argv = Console_Getopt::readPHPArgv(); -$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v" . $cmd_options); +$options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:v" . $cmd_options); if (PEAR::isError($options)) { usage($options); } -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); $opts = $options[0]; +$fetype = 'CLI'; +foreach ($opts as $opt) { + if ($opt[0] == 'G') { + $fetype = 'Gtk'; + } +} +PEAR_Command::setFrontendType($fetype); +$ui = &PEAR_Command::getFrontendObject(); +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); + $pear_user_config = ''; $pear_system_config = ''; $store_user_config = false; @@ -114,19 +122,23 @@ exit; } -if (empty($all_commands[$command]) || $command == 'help') { - usage(null, @$options[1][2]); -} - -$cmd = PEAR_Command::factory($command, $config); -if (PEAR::isError($cmd)) { - die($cmd->getMessage()); -} - -$cmdargs = array_slice($options[1], 2); -$ok = $cmd->run($command, $cmdopts, $cmdargs); -if ($ok === false) { - PEAR::raiseError("unknown command `$command'"); +if ($fetype == 'Gtk') { + Gtk::main(); +} else { + if (empty($all_commands[$command]) || $command == 'help') { + usage(null, @$options[1][2]); + } + + $cmd = PEAR_Command::factory($command, $config); + if (PEAR::isError($cmd)) { + die($cmd->getMessage()); + } + + $cmdargs = array_slice($options[1], 2); + $ok = $cmd->run($command, $cmdopts, $cmdargs); + if ($ok === false) { + PEAR::raiseError("unknown command `$command'"); + } } // {{{ usage() @@ -148,9 +160,14 @@ "Usage: $progname [options] command [command-options] <parameters>\n". "Type \"$progname help options\" to list all options.\n". "Type \"$progname help <command>\" to get the help for the specified command.\n". - "Commands:\n " . implode("\n ", array_keys($all_commands)); + "Commands:\n"; + $maxlen = max(array_map("strlen", $all_commands)); + $formatstr = "%-{$maxlen}s %s\n"; + foreach ($all_commands as $cmd => $class) { + $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd)); + } } - fputs($stderr, "$put\n\n"); + fputs($stderr, "$put\n"); fclose($stderr); exit; } @@ -167,6 +184,7 @@ " -C file find system configuration in `file'\n". " -d foo=bar set user config variable `foo' to `bar'\n". " -D foo=bar set system config variable `foo' to `bar'\n". + " -G start in graphical (Gtk) mode\n". " -s store user configuration\n". " -S store system configuration\n". " -u foo unset `foo' in the user configuration\n". Index: php4/pear/PEAR/Frontend/Gtk.php +++ php4/pear/PEAR/Frontend/Gtk.php <?php /* +----------------------------------------------------------------------+ | PHP Version 4 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2002 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Stig Sæther Bakken <ssb@fast.no> | +----------------------------------------------------------------------+ $Id: Gtk.php,v 1.1 2002/05/09 02:31:36 ssb Exp $ */ require_once "PEAR.php"; class PEAR_Frontend_Gtk extends PEAR { // {{{ properties /** * What type of user interface this frontend is for. * @var string * @access public */ var $type = 'Gtk'; var $omode = 'plain'; var $params = array(); var $window = null; // }}} // {{{ constructor function PEAR_Frontend_Gtk() { parent::PEAR(); if (!extension_loaded('php_gtk')) { dl('php_gtk.' . (OS_WINDOWS ? 'dll' : 'so')); } $this->window = &new GtkWindow(); $this->window->set_title('PEAR Installer'); $this->window->set_usize((gdk::screen_width()/3), (gdk::screen_height()/3)); $this->window->show_all(); } // }}} // {{{ displayLine(text) function displayLine($text) { } function display($text) { } // }}} // {{{ displayError(eobj) function displayError($eobj) { } // }}} // {{{ displayFatalError(eobj) function displayFatalError($eobj) { } // }}} // {{{ displayHeading(title) function displayHeading($title) { } // }}} // {{{ userDialog(prompt, [type], [default]) function userDialog($prompt, $type = 'text', $default = '') { } // }}} // {{{ userConfirm(prompt, [default]) function userConfirm($prompt, $default = 'yes') { } // }}} // {{{ startTable([params]) function startTable($params = array()) { } // }}} // {{{ tableRow(columns, [rowparams], [colparams]) function tableRow($columns, $rowparams = array(), $colparams = array()) { } // }}} // {{{ endTable() function endTable() { } // }}} // {{{ bold($text) function bold($text) { } // }}} } ?>
« previous php.pear.cvs (#3711) next »