Changeset 1791
- Timestamp:
- 08/23/06 23:17:06 (2 years ago)
- Files:
-
- tools/pake/trunk/bin/pake.php (modified) (1 diff)
- tools/pake/trunk/lib/pake/pakeApp.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeColor.class.php (added)
- tools/pake/trunk/lib/pake/pakeException.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeFileTask.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeFinder.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeFunction.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeGetopt.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeGlobToRegex.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeNumberCompare.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeTask.class.php (modified) (2 diffs)
- tools/pake/trunk/lib/pake/pakeYaml.class.php (modified) (1 diff)
- tools/pake/trunk/lib/pake/tasks/pakePearTask.class.php (modified) (1 diff)
- tools/pake/trunk/lib/pake/tasks/pakePhingTask.class.php (modified) (1 diff)
- tools/pake/trunk/lib/pake/tasks/pakeSimpletestTask.class.php (modified) (1 diff)
- tools/pake/trunk/pakefile.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/pake/trunk/bin/pake.php
r1765 r1791 13 13 include_once('pake/pakeFunction.php'); 14 14 15 // register our default exception handler 16 function pake_exception_default_handler($exception) 17 { 18 $e = new pakeException(); 19 $e->render($exception); 20 } 21 set_exception_handler('pake_exception_default_handler'); 22 15 23 if (basename(__FILE__) == basename($_SERVER['SCRIPT_NAME'])) 16 24 { 17 25 $pake = pakeApp::get_instance(); 18 try 19 { 20 $pake->run(); 21 } 22 catch (pakeException $e) 23 { 24 echo "ERROR: pake - ".$e->getMessage()."\n"; 25 } 26 $pake->run(); 26 27 } tools/pake/trunk/lib/pake/pakeApp.class.php
r1765 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com>6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 7 * @license see the LICENSE file included in the distribution 8 8 * @version SVN: $Id$ … … 16 16 * 17 17 * @package pake 18 * @author Fabien Potencier <fabien.potencier@ gmail.com>19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 20 20 * @license see the LICENSE file included in the distribution 21 21 * @version SVN: $Id$ tools/pake/trunk/lib/pake/pakeException.class.php
r1765 r1791 3 3 /* 4 4 * This file is part of the pake package. 5 * (c) 2004, 2005 Fabien Potencier <fabien.potencier@ gmail.com>5 * (c) 2004, 2005 Fabien Potencier <fabien.potencier@symfony-project.com> 6 6 * 7 7 * For the full copyright and license information, please view the LICENSE … … 15 15 * 16 16 * @package pake 17 * @author Fabien Potencier <fabien.potencier@ gmail.com>17 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 18 18 * @version SVN: $Id$ 19 19 */ 20 20 class pakeException extends Exception 21 21 { 22 /** 23 * Class constructor. 24 * 25 * @param string The error message. 26 * @param int The error code. 27 */ 28 public function __construct ($message = null, $code = 0) 22 function render($e) 29 23 { 30 parent::__construct($message, $code); 24 echo pakeColor::colorize(' ['.get_class($e).'] '.$e->getMessage()." \n", 'ERROR'); 25 26 $pake = pakeApp::get_instance(); 27 28 if ($pake->get_trace()) 29 { 30 echo "\ntrace:\n"; 31 32 $trace = $this->trace($e); 33 for ($i = 0, $count = count($trace); $i < $count; $i++) 34 { 35 $class = (isset($trace[$i]['class']) ? $trace[$i]['class'] : ''); 36 $type = (isset($trace[$i]['type']) ? $trace[$i]['type'] : ''); 37 $function = $trace[$i]['function']; 38 $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a'; 39 $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; 40 41 echo sprintf(" %s%s%s at %s:%s.\n", $class, $type, $function, pakeColor::colorize($file, 'INFO'), pakeColor::colorize($line, 'INFO')); 42 } 43 } 44 45 echo "\n"; 46 } 47 48 function trace($exception) 49 { 50 // exception related properties 51 $trace = $exception->getTrace(); 52 array_unshift($trace, array( 53 'function' => '', 54 'file' => ($exception->getFile() != null) ? $exception->getFile() : 'n/a', 55 'line' => ($exception->getLine() != null) ? $exception->getLine() : 'n/a', 56 'args' => array(), 57 )); 58 59 return $trace; 31 60 } 32 61 } tools/pake/trunk/lib/pake/pakeFileTask.class.php
r1765 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com>6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 7 * @license see the LICENSE file included in the distribution 8 8 * @version SVN: $Id$ … … 16 16 * 17 17 * @package pake 18 * @author Fabien Potencier <fabien.potencier@ gmail.com>19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 20 20 * @license see the LICENSE file included in the distribution 21 21 * @version SVN: $Id$ tools/pake/trunk/lib/pake/pakeFinder.class.php
r1783 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com>6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 7 * @license see the LICENSE file included in the distribution 8 8 * @version SVN: $Id$ … … 32 32 * 33 33 * @package pake 34 * @author Fabien Potencier <fabien.potencier@ gmail.com>35 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>34 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 35 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 36 36 * @license see the LICENSE file included in the distribution 37 37 * @version SVN: $Id$ tools/pake/trunk/lib/pake/pakeFunction.php
r1784 r1791 1 1 <?php 2 3 /** 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 * @license see the LICENSE file included in the distribution 8 * @version SVN: $Id$ 9 */ 2 10 3 11 require_once 'pake/pakeException.class.php'; … … 7 15 require_once 'pake/pakeTask.class.php'; 8 16 require_once 'pake/pakeFileTask.class.php'; 17 require_once 'pake/pakeColor.class.php'; 9 18 require_once 'pake/pakeApp.class.php'; 10 19 tools/pake/trunk/lib/pake/pakeGetopt.class.php
r1765 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com>6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 7 * @license see the LICENSE file included in the distribution 8 8 * @version SVN: $Id$ … … 19 19 * 20 20 * @package pake 21 * @author Fabien Potencier <fabien.potencier@ gmail.com>22 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>21 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 22 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 23 23 * @license see the LICENSE file included in the distribution 24 24 * @version SVN: $Id$ tools/pake/trunk/lib/pake/pakeGlobToRegex.class.php
r1765 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com> php port5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> php port 6 6 * @author Richard Clamp <richardc@unixbeard.net> perl version 7 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>7 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 8 8 * @copyright 2002 Richard Clamp <richardc@unixbeard.net> 9 9 * @license see the LICENSE file included in the distribution … … 35 35 * 36 36 * @package pake 37 * @author Fabien Potencier <fabien.potencier@ gmail.com> php port37 * @author Fabien Potencier <fabien.potencier@symfony-project.com> php port 38 38 * @author Richard Clamp <richardc@unixbeard.net> perl version 39 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>39 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 40 40 * @copyright 2002 Richard Clamp <richardc@unixbeard.net> 41 41 * @license see the LICENSE file included in the distribution tools/pake/trunk/lib/pake/pakeNumberCompare.class.php
r1765 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com> php port5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> php port 6 6 * @author Richard Clamp <richardc@unixbeard.net> perl version 7 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>7 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 8 8 * @copyright 2002 Richard Clamp <richardc@unixbeard.net> 9 9 * @license see the LICENSE file included in the distribution … … 34 34 * 35 35 * @package pake 36 * @author Fabien Potencier <fabien.potencier@ gmail.com> php port36 * @author Fabien Potencier <fabien.potencier@symfony-project.com> php port 37 37 * @author Richard Clamp <richardc@unixbeard.net> perl version 38 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>38 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 39 39 * @copyright 2002 Richard Clamp <richardc@unixbeard.net> 40 40 * @see http://physics.nist.gov/cuu/Units/binary.html tools/pake/trunk/lib/pake/pakeTask.class.php
r1765 r1791 3 3 /** 4 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@ gmail.com>6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 7 * @license see the LICENSE file included in the distribution 8 8 * @version SVN: $Id$ … … 16 16 * 17 17 * @package pake 18 * @author Fabien Potencier <fabien.potencier@ gmail.com>19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@ gmail.com>18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 20 20 * @license see the LICENSE file included in the distribution 21 21 * @version SVN: $Id$ tools/pake/trunk/lib/pake/pakeYaml.class.php
r1765 r1791 1 1 <?php 2 3 /** 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 * @license see the LICENSE file included in the distribution 8 * @version SVN: $Id$ 9 */ 10 2 11 class pakeYaml 3 12 { tools/pake/trunk/lib/pake/tasks/pakePearTask.class.php
r1765 r1791 1 1 <?php 2 3 /** 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 * @license see the LICENSE file included in the distribution 8 * @version SVN: $Id$ 9 */ 2 10 3 11 class pakePearTask tools/pake/trunk/lib/pake/tasks/pakePhingTask.class.php
r1773 r1791 1 1 <?php 2 3 /** 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 * @license see the LICENSE file included in the distribution 8 * @version SVN: $Id$ 9 */ 2 10 3 11 include_once 'phing/Phing.php'; tools/pake/trunk/lib/pake/tasks/pakeSimpletestTask.class.php
r1766 r1791 1 1 <?php 2 3 /** 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 * @license see the LICENSE file included in the distribution 8 * @version SVN: $Id$ 9 */ 2 10 3 11 class pakeSimpletestTask tools/pake/trunk/pakefile.php
r1765 r1791 10 10 pake_desc('release a new pake version'); 11 11 pake_task('release'); 12 13 pake_task('foo'); 14 15 function run_foo($task, $args) 16 { 17 throw new Exception('test'); 18 } 12 19 13 20 /* tasks */