home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / test.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.4 KB  |  58 lines

  1. #!/usr/bin/php -q
  2. <?php
  3. /* vim: set noai expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
  4. /**
  5.  * Script to test package. Uses phpcs and phpt
  6.  *  
  7.  * PHP version 5
  8.  * 
  9.  * @category  System
  10.  * @package   System_Daemon
  11.  * @author    Kevin van Zonneveld <kevin@vanzonneveld.net>
  12.  * @copyright 2008 Kevin van Zonneveld (http://kevin.vanzonneveld.net)
  13.  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD Licence
  14.  * @version   SVN: Release: $Id$
  15.  * @link      http://trac.plutonia.nl/projects/system_daemon
  16.  */
  17.  
  18. /**
  19.  * Executes a command
  20.  * 
  21.  * @param string $cmd Command to execute
  22.  * @param array  &$o  Where output is stored 
  23.  * 
  24.  * @return boolean
  25.  */
  26. function exe($cmd, &$o) 
  27. {
  28.     $x = @exec($cmd, $o, $r);
  29.     if ($r) {
  30.         return false;
  31.     }    
  32.     return true;
  33. }
  34.  
  35. $workspace_dir     = realpath(dirname(__FILE__)."");
  36. $cmd_reqs          = array();
  37. $cmd_reqs["phpcs"] = "PHP_CodeSniffer";
  38. $cmd_reqs["phpt"]  = "PHPT, http://phpt.info/wiki";
  39.  
  40. // check if commands are available
  41. foreach ($cmd_reqs as $cmd=>$package) {
  42.     if (@exe("which ".$cmd, $lines) === false) {
  43.         echo $cmd." is not available. ";
  44.         echo "Please first install the ".$package;            
  45.         die("\n");
  46.     }
  47. }
  48.  
  49. $cmd = "phpcs --standard=PEAR ".$workspace_dir."/System";
  50. @exe($cmd, $lines);
  51. echo implode("\n", $lines); 
  52.  
  53. $cmd = "phpt -r ".$workspace_dir."";
  54. @exe($cmd, $lines);
  55. echo implode("\n", $lines); 
  56.  
  57.  
  58. ?>