Revision: 1221
Author: christian.wuerker
Date: Sat May 23 07:04:12 2015 UTC
Log: Updated Go.
https://code.google.com/p/cmclasses/source/detail?r=1221
Added:
/trunk/Go/Animal.php
/trunk/Go/Application.php
/trunk/Go/Benchmark.php
/trunk/Go/Changes.php
/trunk/Go/ClassSyntaxTester.php
/trunk/Go/Configurator.php
/trunk/Go/DocCreator.php
/trunk/Go/Installer.php
/trunk/Go/Library.php
/trunk/Go/PhpDocumentor.php
/trunk/Go/SelfTester.php
/trunk/Go/UnitTestCreator.php
/trunk/Go/UnitTester.php
/trunk/Go/Updater.php
Deleted:
/trunk/Go/Animal.php5
/trunk/Go/Application.php5
/trunk/Go/Benchmark.php5
/trunk/Go/Changes.php5
/trunk/Go/ClassSyntaxTester.php5
/trunk/Go/Configurator.php5
/trunk/Go/DocCreator.php5
/trunk/Go/Installer.php5
/trunk/Go/Library.php5
/trunk/Go/PhpDocumentor.php5
/trunk/Go/SelfTester.php5
/trunk/Go/UnitTestCreator.php5
/trunk/Go/UnitTester.php5
/trunk/Go/Updater.php5
=======================================
--- /dev/null
+++ /trunk/Go/Animal.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,26 @@
+<?php
+class Go_Animal
+{
+ public function __construct( $sound )
+ {
+ switch( $sound )
+ {
+ case 'moo':
+ print self::getCow();
+ break;
+ default:
+ break;
+ }
+ }
+
+ public static function getCow()
+ {
+ return '
+ (__)
+ ~(..)~
+ ,----\(oo)
+ /|____|,\'
+ * /"\ /\
+';
+ }
+}
=======================================
--- /dev/null
+++ /trunk/Go/Application.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,157 @@
+<?php
+class Go_Application
+{
+ private $basePath;
+ private $messages = array(
+ 'title' => " > > GO > > - get & organize cmClasses\n",
+ 'config_missing' => "No Config File '%s' found.\ncmClasses must be
installed and configured.\nGO must be within installation path.",
+ 'command_invalid' => "No valid command set.\nPlease append 'help' for
further information!\n",
+ 'subject_create_invalid' => "No valid creator subject set (doc,test).",
+ 'subject_test_invalid' => "No valid test subject set
(benchmark,syntax,self,units).",
+ 'tool_create_doc' => "No documentation tool set (creator,phpdoc).",
+ );
+ private $configFile = 'cmClasses.ini';
+
+ public function autoload( $className )
+ {
+ if( preg_match( '/^Go_/', $className ) ) // is it a GO
class ?
+ require_once $this->basePath . preg_replace( '/^Go_/', '', $className
).'.php'; // then require it
+ }
+
+ public function __construct( $clearScreen = FALSE )
+ {
+ spl_autoload_register( array( $this, 'autoload' ) );
+ if( !empty( $_SERVER['SERVER_ADDR'] ) )
+ die( "This tool is for console use only." );
+ if( $clearScreen )
+ isset( $_SERVER['SHELL'] ) ? passthru( "clear" ) : exec( "command /C
cls" ); // try to clear screen (not working on Windows!?)
+ print( "\n".$this->messages['title'] ); // print tool title
+
+# Go_Library::$configFile = $this->configFile;
+ $this->basePath = dirname( __FILE__ ).'/';
+ $this->configFile = Go_Library::getConfigFile(); // point to
Configuration File
+
+ $arguments = array_slice( $_SERVER['argv'], 1 ); // get given
arguments
+
+ try
+ {
+ if( !$arguments ) // no arguments given
+ throw new InvalidArgumentException( $this->messages['command_invalid']
);
+ $command = strtolower( $arguments[0] ); // extract command
+ if( file_exists( $this->configFile ) ) // cmClasses
installed and configured
+ {
+ require_once( 'autoload.php' ); // enable cmClasses
+ import( 'de.ceus-media.ui.DevOutput' ); // load output
methods
+ }
+ else if( !( $command == "install" || $command == "configure" ) )
// anything else but installation is impossible
+ {
+ $message = sprintf( $this->messages['config_missing'],
$this->configFile );
+ throw new RuntimeException( $message );
+ }
+ $this->handle( $this->configFile, $command, $arguments ); //
run tool component switch
+ }
+# catch( InvalidArgumentException $e ) // catch argument
exception
+# {
+# $this->showUsage( $e->getMessage() ); // show usage and
message
+# }
+ catch( Exception $e ) // catch any other exception
+ {
+ print( "\nERROR: ".$e->getMessage()."\n" ); // show message
only
+ }
+ }
+
+ private function handle( $configFile, $command, $arguments )
+ {
+ switch( $command )
+ {
+ case '-h':
+ case '--help':
+ case '/?':
+ case '-?':
+ case 'help':
+ $this->showUsage();
+ break;
+ case 'create':
+ if( count( $arguments ) < 2 )
+ throw new InvalidArgumentException(
$this->messages['subject_create_invalid'] );
+ $subject = strtolower( $arguments[1] );
+ switch( $subject )
+ {
+ case 'doc':
+ if( count( $arguments ) < 3 )
+ throw new InvalidArgumentException(
$this->messages['tool_create_doc'] );
+ $tool = strtolower( $arguments[2] );
+ switch( $tool )
+ {
+ case 'creator':
+ new Go_DocCreator( array_slice( $arguments, 3 ) );
+ break;
+ case 'phpdoc':
+ new Go_PhpDocumentor( array_slice( $arguments, 3 ) );
+ break;
+ default:
+ throw new InvalidArgumentException(
$this->messages['tool_create_doc'] );
+ }
+ break;
+ case 'test':
+ new Go_UnitTestCreator( array_slice( $arguments, 2 ) );
+ break;
+ case 'changelog':
+ new Go_Changelog();
+ break;
+ default:
+ throw new InvalidArgumentException(
$this->messages['subject_create_invalid'] );
+ }
+ break;
+ case 'test':
+ if( count( $arguments ) < 2 )
+ throw new InvalidArgumentException(
$this->messages['subject_test_invalid'] );
+ $subject = strtolower( $arguments[1] );
+ switch( $subject )
+ {
+ case 'benchmark':
+ new Go_Benchmark();
+ break;
+ case 'syntax':
+ new Go_ClassSyntaxTester( $arguments );
+ break;
+ case 'self':
+ new Go_SelfTester( $arguments );
+ break;
+ case 'units':
+ $className = empty( $arguments[2] ) ? NULL : $arguments[2];
+ new Go_UnitTester( $className );
+ break;
+ default:
+ throw new InvalidArgumentException(
$this->messages['subject_test_invalid'] );
+ }
+ break;
+ case 'install':
+ new Go_Installer( array_slice( $arguments, 1 ) );
+ break;
+ case 'configure':
+ new Go_Configurator( array_slice( $arguments, 1 ) );
+ break;
+ case 'update':
+ new Go_Updater( array_slice( $arguments, 1 ) );
+ break;
+ case 'moo':
+ print Go_Animal::getCow();
+ break;
+ case 'changelog':
+ new Go_Changes();
+ break;
+ default:
+ throw new InvalidArgumentException( $this->messages['command_invalid']
);
+ }
+ }
+
+ public function showUsage( $message = NULL )
+ {
+ if( $message )
+ $message = "\nERROR: ".$message."\n";
+ $text = file_get_contents( $this->basePath.'usage.txt' );
+ print( "\n".$text."\n".$message );
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/Benchmark.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,44 @@
+<?php
+require_once dirname( __FILE__ ).'/Library.php5';
+class Go_Benchmark
+{
+ public function __construct()
+ {
+ define( 'LB', "\n" );
+ $path = Go_Library::getLibraryPath();
+ require_once( $path.'autoload.php5' );
+ $path = Go_Library::getSourcePath();
+
+ echo LB.'Memory Usage on start:';
+ echo LB.'----------------------';
+ $this->showMemoryUsage();
+ echo LB;
+
+ echo LB.'Loading... ';
+ $start = microtime( TRUE );
+ $data = Go_Library::listClasses( $path );
+
+ $number = 0;
+ foreach( $data['files'] as $file )
+ {
+ $number++;
+ require_once( $file );
+ }
+ echo $number.' classes in '.round( ( microtime( TRUE ) - $start ) * 1000
).' ms'.LB;
+ echo LB.'Memory Usage after loading:';
+ echo LB.'---------------------------';
+ $this->showMemoryUsage();
+ echo LB;
+ }
+
+ function showMemoryUsage()
+ {
+ $usage = memory_get_usage();
+ $limit = (int) ini_get( 'memory_limit' ) * 1024 * 1024;
+ $ratio = round( $usage / $limit * 100, 3 )."%";
+ echo LB.'Limit: '.Alg_UnitFormater::formatBytes( $limit );
+ echo LB.'Usage: '.Alg_UnitFormater::formatBytes( $usage );
+ echo LB.'Ratio: '.$ratio;
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/Changes.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,29 @@
+<?php
+class Go_Changes
+{
+ public function __construct()
+ {
+ $path = dirname( dirname( __FILE__ ) )."/";
+ $revisions = 1000;
+ $prefix = "";
+ $fileTmp = "log.tmp";
+ $fileTarget = $path."docs/changes.md";
+
+ if( !file_exists( $fileTmp ) )
+ exec( "svn log -l".$revisions." ".$path." --verbose > ".$fileTmp );
+ $c = file_get_contents( $fileTmp );
+ $c =
preg_replace( "/------------------------------------------------------------------------/", "----",
$c );
+ $c = preg_replace( "/(\n+)----/s", "\n----", $c );
+ $c = preg_replace( "/\n\n/", "µµ", $c );
+ $c = preg_replace( "/----(.*)µµ(.*)\n/Us", "\n###\\2\n\\1\n", $c );
+ $c = preg_replace( "/µµ/", "\n\n", $c );
+ $c = preg_replace( "/ (A|D|M|R) /", "- \\1 ", $c );
+ $c = preg_replace( "/(Geänderte Pfade|Changed paths):/", "", $c );
+ $c = preg_replace( "/ \| [0-9] (Zeilen|Zeile|lines|line)/", "", $c );
+ if( $prefix )
+ $c = str_replace( "###".$prefix, "###", $c );
+
+ file_put_contents( $fileTarget, $c );
+ unlink( $fileTmp );
+ }
+}
=======================================
--- /dev/null
+++ /trunk/Go/ClassSyntaxTester.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,16 @@
+<?php
+require_once dirname( __FILE__ ).'/Library.php5';
+class Go_ClassSyntaxTester
+{
+ public function __construct( $arguments )
+ {
+ remark( "GO Class File Syntax Test\n" );
+
+ $path = dirname( dirname( __FILE__ ) )."/src";
+ $data = Go_Library::listClasses( $path );
+
+ remark( "found ".$data['count']." class files\n" );
+ Go_Library::testSyntax( $data['files'] );
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/Configurator.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,53 @@
+<?php
+class Go_Configurator
+{
+ public function __construct( $arguments )
+ {
+ $force = in_array( "-f", $arguments ) || in_array( "--force", $arguments
);
+ $pwd = str_replace( "\\", "/", dirname( dirname( realpath( __FILE__ ) )
) )."/";
+
+ if( !defined( 'CM_CLASS_PATH' ) )
+ define( 'CM_CLASS_PATH', $pwd );
+ ini_set( 'include_path',
CM_CLASS_PATH.PATH_SEPARATOR.ini_get( "include_path" ) );
+# if( !@include_once( "autoload.php5" ) )
+# die( 'Installation of "cmClasses" seems to be
corrupt: '.$pwd.'import.php5 is missing.' );
+ require_once( dirname( dirname( __FILE__ ) ).'/src/UI/DevOutput.php5' );
+
+ $files = array(
+ "cmClasses.ini.dist" => "cmClasses.ini",
+ "doc.xml.dist" => "doc.xml",
+ ".htaccess.dist" => ".htaccess",
+ );
+
+ foreach( $files as $sourceFile => $targetFile )
+ {
+ if( !file_exists( $pwd.$sourceFile ) )
+ throw new RuntimeException( 'Source file "'.$sourceFile.'" is not
existing.' );
+
+ remark( 'Setting up "'.$targetFile.'"... ' );
+ $content = file_get_contents( $pwd.$sourceFile );
+ $content = str_replace( "/path/to/cmClasses/version/", $pwd, $content );
+ if( file_exists( $pwd."cmClasses.ini" ) ){
+ $config = parse_ini_file( $pwd."cmClasses.ini", TRUE );
+ $version = $config['project']['version'];
+ $content = str_replace( 'title version=""', 'title
version="'.$version.'"', $content );
+ }
+ if( !$force && file_exists( $pwd.$targetFile ) )
+ $status = "already existing, use --force to overwrite";
+ else
+ {
+ file_put_contents( $pwd.$targetFile, $content );
+ $status = "done.";
+ }
+ print( $status );
+ }
+ if( in_array( "--clean-up", $arguments ) )
+ {
+ remark( "Removing installer and distribution files..." );
+ foreach( $files as $sourceFile => $targetFile )
+ unlink( $pwd.$sourceFile );
+ }
+ remark( "\ncmClasses is now configured and usable.\n" );
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/DocCreator.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,21 @@
+<?php
+class Go_DocCreator
+{
+ public function __construct( $arguments )
+ {
+ $config = Go_Library::getConfigData();
+ require_once dirname( dirname( __FILE__ ) ).'/autoload.php5';
+ $path = $config['docCreator']['pathTool'];
+ if( !file_exists( $path ) )
+ throw new Exception( 'Tool "DocCreator" is not installed' );
+ CMC_Loader::registerNew( 'php5', 'DocCreator_', $path."classes/" );
+
CMC_Loader::registerNew( 'php', 'Michelf\\', '/var/www/lib/php-markdown/Michelf/'
);
+
+ $file = dirname( dirname( __FILE__ ) )."/doc.xml";
+ $runner = new DocCreator_Core_Runner( $file );
+ $runner->main();
+
+# $creator = new DocCreator_Core_ConsoleRunner( $file ); // open
new starter
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/Installer.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,22 @@
+<?php
+require_once dirname( __FILE__ ).'/Library.php5';
+require_once dirname( __FILE__ ).'/Configurator.php5';
+class Go_Installer
+{
+ public function __construct( $arguments )
+ {
+ Go_Library::ensureSvnSupport();
+
+ $repos = "
http://cmclasses.googlecode.com/svn/";
+ if( count( $arguments ) < 2 )
+ throw new InvalidArgumentException( 'No install path set.' );
+ if( count( $arguments ) < 1 )
+ throw new InvalidArgumentException( 'No version to install set.' );
+
+ $command = "co ".$repos.$arguments[0]." ".$arguments[1];
+ Go_Library::runSvn( $command );
+ chDir( $arguments[1] );
+ new Go_Configurator();
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/Library.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,189 @@
+<?php
+class Go_Library
+{
+ public static $configFile = 'cmClasses.ini';
+
+ public function getConfigData()
+ {
+ return parse_ini_file( self::getConfigFile(), TRUE );
+ }
+
+ public static function getConfigFile()
+ {
+ return dirname( dirname( __FILE__ ) ).'/'.self::$configFile;
+ }
+
+ public static function listClasses( $path )
+ {
+ $count = 0;
+ $size = 0;
+ $list = array();
+ self::listClassesRecursive( $path, $list, $count, $size );
+ return array(
+ 'path' => $path,
+ 'count' => $count,
+ 'size' => $size,
+ 'files' => $list
+ );
+ }
+
+ public static function ensureSvnSupport()
+ {
+ echo "checking svn... ";
+ $command = 'svn --version --quiet';
+ $method = 'system';
+ switch( $method )
+ {
+ case 'system':
+ @system( $command, $return );
+ $support = $return === 0;
+ break;
+ case 'exec':
+ $results = array();
+ @exec( $command, $results, $return );
+ print_m( $return );
+ $support = $return === 0;
+ break;
+ case 'passthru':
+ $return = 0;
+ @passthru( $command, $return );
+ $support = $return === 0;
+ break;
+ default:
+ throw new InvalidArgumentException( 'Method "'.$method.'" not
implemented' );
+ }
+ if( !$support )
+ throw new RuntimeException( "Subversion Client (svn) seems to be
missing." );
+ }
+
+ public static function getGoPath()
+ {
+ return dirname( __FILE__ ).'/';
+ }
+
+ public static function getLibraryPath()
+ {
+ return dirname( dirname( __FILE__ ) ).'/';
+ }
+
+ public static function getSourcePath()
+ {
+ return self::getLibraryPath().'/src/';
+ }
+
+ protected static function listClassesRecursive( $path, &$list, &$count ,
&$size )
+ {
+ $index = new DirectoryIterator( $path );
+ foreach( $index as $entry )
+ {
+ $pathName = $entry->getPathname();
+ if( $entry->isDot() )
+ continue;
+ if( $entry->getFilename() == ".svn" )
+ continue;
+ if( $entry->isDir() )
+ {
+ # echo "Path: ".$entry->getPath()."\n";
+ self::listClassesRecursive( $pathName, $list, $count, $size );
+ }
+ else if( $entry->isFile() )
+ {
+ $info = pathinfo( $pathName );
+ if( $info['extension'] !== "php5" )
+ continue;
+ if( !preg_match( '/^[A-Z]/', $info['basename'] ) )
+ continue;
+ $list[] = $pathName;
+ $size += filesize( $pathName );
+ $count++;
+ }
+ }
+ }
+
+ public static function runSvn( $command )
+ {
+ passthru( "svn ".$command, $return );
+ }
+
+ public static function showMemoryUsage()
+ {
+ $number = ceil( memory_get_usage() / 1024 );
+ print( "\nmemory: ".$number."KB" );
+ }
+
+ /**
+ * @deprecated since CMC_Loader
+ */
+ public static function testImports( $files )
+ {
+ remark( "Checking nested imports\n" );
+ $count = 0;
+ $path = dirname( __FILE__ )."/";
+ $line = str_repeat( "-", 79 );
+ $list = array();
+ foreach( $files as $file )
+ {
+ $relative = str_replace( $path, "", $file );
+ if( $count && !( $count % 60 ) )
+ echo " ".$count."/".count( $files )."\n";
+ try
+ {
+ @require_once( $relative );
+ echo ".";
+ }
+ catch( Exception $e )
+ {
+ $list[$file] = $e;
+ echo "E";
+ }
+ $count++;
+ }
+ echo " ".$count."/".count( $files )."\n";
+ if( $list )
+ {
+ remark( "\n! Invalid files:" );
+ foreach( $list as $file => $exception )
+ {
+ $relative = str_replace( $path, "", $file );
+ remark( "File: ".$relative );
+ remark( $exception->getMessage() );
+ remark( $line );
+ }
+ }
+ }
+
+ public static function testSyntax( $files )
+ {
+ remark( "Checking class file syntax\n" );
+ $count = 0;
+ $path = dirname( __FILE__ )."/";
+ $line = str_repeat( "-", 79 );
+ $list = array();
+ foreach( $files as $file )
+ {
+ if( $count && !( $count % 60 ) )
+ echo " ".$count."/".count( $files )."\n";
+ $output = shell_exec('php -l "'.$file.'"');
+ if( !preg_match( '/^No syntax errors detected/', $output ) )
+ {
+ $list[$file] = $output;
+ echo "E";
+ }
+ else
+ echo ".";
+
+ $count++;
+ }
+ echo " ".$count."/".count( $files )."\n";
+ if( $list )
+ {
+ remark( "\n! Invalid files:" );
+ foreach( $list as $file => $message )
+ {
+ $relative = str_replace( $path, "", $file );
+ remark( "File: ".$relative.$message.$line );
+ }
+ }
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/PhpDocumentor.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,30 @@
+<?php
+class Go_PhpDocumentor
+{
+ public function __construct( $arguments )
+ {
+ $config = Go_Library::getConfigData();
+ $configFile = Go_Library::getConfigFile();
+ $reportFile = $config['phpDocumentor']['outputLog']; //
phpDocumentor Report File
+ $command = "phpdoc -c ".$configFile; // Shell Command to run
phpDocumentor
+
+ if( in_array( "--show-config-only", $arguments ) )
+ {
+ remark( "Settings:" );
+ foreach( $config['phpDocumentor'] as $key => $value )
+ {
+ $key .= str_repeat( " ", 20 - strlen( $key ) );
+ remark( $key.$value );
+ }
+ return;
+ }
+ if( in_array( "-q", $arguments ) || in_array( "--quite", $arguments ) )
// Quite Mode is activated
+ {
+ $command .= " > ".$reportFile; // redirect Output into
Report File
+ @unlink( $reportFile ); // remove old Report File
+ }
+ die( $command );
+ passthru( $command ); // run phpDocumentor
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/SelfTester.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,36 @@
+<?php
+require_once dirname( __FILE__ ).'/Library.php5';
+class Go_SelfTester
+{
+ public function __construct( $arguments )
+ {
+ $lib = new Go_Library();
+
+ remark( "testing GO itself\n" );
+
+ $path = dirname( __FILE__ );
+ $data = Go_Library::listClasses( $path );
+
+ Go_Library::testSyntax( $data['files'] );
+ Go_Library::testImports( $data['files'] );
+
+ remark( "create random numbers with 3 digits: " );
+ import( 'de.ceus-media.alg.Randomizer' );
+ import( 'de.ceus-media.math.RomanNumbers' );
+
+ $randomizer = new Alg_Randomizer();
+ $randomizer->useLarges = FALSE;
+ $randomizer->useSmalls = FALSE;
+ $randomizer->useSigns = FALSE;
+ $c = $randomizer->get( 1 ) + 2;
+ for( $i=0; $i<$c; $i++ )
+ print( $randomizer->get( 3 )." " );
+
+ remark( "roman date: " );
+ $year = date( "Y" );
+ print( $year. " is ".Math_RomanNumbers::convertToRoman( $year ) );
+
+ remark( "" );
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/UnitTestCreator.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,21 @@
+<?php
+class Go_UnitTestCreator
+{
+ public function __construct( $arguments )
+ {
+ require_once dirname( dirname( __FILE__ ) ).'/autoload.php5';
+
+ $force = in_array( "-f", $arguments ) || in_array( "--force", $arguments
);
+ if( in_array( "-f", $arguments ) )
+ unset( $arguments[array_search( "-f", $arguments )] );
+ if( in_array( "--force", $arguments ) )
+ unset( $arguments[array_search( "--force", $arguments )] );
+ if( !$arguments )
+ throw new InvalidArgumentException( 'No class name given to create test
class for.' );
+ $class = array_shift( $arguments );
+ $creator = new File_PHP_Test_Creator();
+ $creator->createForFile( $class, $force );
+ remark( 'Created test class "Test_'.$class.'Test".'."\n" );
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/UnitTester.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,56 @@
+<?php
+require_once dirname( __FILE__ ).'/Library.php5';
+class Go_UnitTester
+{
+ public function __construct( $className = NULL )
+ {
+ if( !empty( $className ) )
+ return $this->runTestOfClass( trim( $className ) );
+ $this->runAllTests();
+ }
+
+ protected function runAllTests()
+ {
+ remark( "Reading Class Files:\n" );
+ $data = Go_Library::listClasses( dirname( dirname ( __FILE__ ) ).'/src/'
);
+ $number = count( $data['files'] );
+ $length = strlen( $number );
+ for( $i=0; $i<$number; $i++ )
+ {
+ require_once( $data['files'][$i] );
+ if( !( $i % 60 ) ){
+ $percent = str_pad( round( $i / $number * 100 ), 3, ' ', STR_PAD_LEFT
);
+ $current = str_pad( $i, $length, ' ', STR_PAD_LEFT );
+ echo " ".$current." / ".$number." (".$percent."%)\n";
+ }
+ echo '.';
+ }
+ remark( "\n" );
+
+ $command = "phpunit";
+ $config = Go_Library::getConfigData();
+ foreach( $config['unitTestOptions'] as $key => $value )
+ $command .= " --".$key." ".$value;
+ print( "\nRunning Unit Tests:\n\r" );
+ $command .= " Test";
+ passthru( $command );
+ }
+
+ protected function runTestOfClass( $className )
+ {
+ $parts = explode( "_", $className );
+ $fileKey = array_pop( $parts );
+ $suffix = $fileKey == "All" ? "Tests" : "Test";
+ while( $parts )
+ $fileKey = array_pop( $parts )."/".$fileKey;
+
+ $testClass = "Test_".$className.$suffix;
+ $testFile = "Test/".$fileKey.$suffix.".php";
+ if( !file_exists( $testFile ) )
+ throw new RuntimeException( 'Test Class File "'.$testFile.'" is not
existing' );
+ echo "\nTesting Class: ".$className."\n\n";
+
+ passthru( "phpunit ".$testClass, $return );
+ }
+}
+?>
=======================================
--- /dev/null
+++ /trunk/Go/Updater.php Sat May 23 07:04:12 2015 UTC
@@ -0,0 +1,15 @@
+<?php
+require_once dirname( __FILE__ ).'/Library.php5';
+class Go_Updater
+{
+ public function __construct( $arguments )
+ {
+ $revision = $arguments ? $arguments[0] : "";
+ $path = dirname( dirname( realpath( __FILE__ ) ) );
+ $command = "update ".$path." ".$revision;
+
+ Go_Library::ensureSvnSupport();
+ Go_Library::runSvn( $command );
+ }
+}
+?>
=======================================
--- /trunk/Go/Animal.php5 Fri Apr 16 23:58:04 2010 UTC
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-class Go_Animal
-{
- public function __construct( $sound )
- {
- switch( $sound )
- {
- case 'moo':
- print self::getCow();
- break;
- default:
- break;
- }
- }
-
- public static function getCow()
- {
- return '
- (__)
- ~(..)~
- ,----\(oo)
- /|____|,\'
- * /"\ /\
-';
- }
-}
=======================================
--- /trunk/Go/Application.php5 Sat Apr 4 14:24:55 2015 UTC
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-class Go_Application
-{
- private $basePath;
- private $messages = array(
- 'title' => " > > GO > > - get & organize cmClasses\n",
- 'config_missing' => "No Config File '%s' found.\ncmClasses must be
installed and configured.\nGO must be within installation path.",
- 'command_invalid' => "No valid command set.\nPlease append 'help' for
further information!\n",
- 'subject_create_invalid' => "No valid creator subject set (doc,test).",
- 'subject_test_invalid' => "No valid test subject set
(benchmark,syntax,self,units).",
- 'tool_create_doc' => "No documentation tool set (creator,phpdoc).",
- );
- private $configFile = 'cmClasses.ini';
-
- public function autoload( $className )
- {
- if( preg_match( '/^Go_/', $className ) ) // is it a GO
class ?
- require_once $this->basePath . preg_replace( '/^Go_/', '', $className
).'.php5'; // then require it
- }
-
- public function __construct( $clearScreen = FALSE )
- {
- spl_autoload_register( array( $this, 'autoload' ) );
- if( !empty( $_SERVER['SERVER_ADDR'] ) )
- die( "This tool is for console use only." );
- if( $clearScreen )
- isset( $_SERVER['SHELL'] ) ? passthru( "clear" ) : exec( "command /C
cls" ); // try to clear screen (not working on Windows!?)
- print( "\n".$this->messages['title'] ); // print tool title
-
-# Go_Library::$configFile = $this->configFile;
- $this->basePath = dirname( __FILE__ ).'/';
- $this->configFile = Go_Library::getConfigFile(); // point to
Configuration File
-
- $arguments = array_slice( $_SERVER['argv'], 1 ); // get given
arguments
-
- try
- {
- if( !$arguments ) // no arguments given
- throw new InvalidArgumentException( $this->messages['command_invalid']
);
- $command = strtolower( $arguments[0] ); // extract command
- if( file_exists( $this->configFile ) ) // cmClasses
installed and configured
- {
- require_once( 'autoload.php5' ); // enable cmClasses
- import( 'de.ceus-media.ui.DevOutput' ); // load output
methods
- }
- else if( !( $command == "install" || $command == "configure" ) )
// anything else but installation is impossible
- {
- $message = sprintf( $this->messages['config_missing'],
$this->configFile );
- throw new RuntimeException( $message );
- }
- $this->handle( $this->configFile, $command, $arguments ); //
run tool component switch
- }
-# catch( InvalidArgumentException $e ) // catch argument
exception
-# {
-# $this->showUsage( $e->getMessage() ); // show usage and
message
-# }
- catch( Exception $e ) // catch any other exception
- {
- print( "\nERROR: ".$e->getMessage()."\n" ); // show message
only
- }
- }
-
- private function handle( $configFile, $command, $arguments )
- {
- switch( $command )
- {
- case '-h':
- case '--help':
- case '/?':
- case '-?':
- case 'help':
- $this->showUsage();
- break;
- case 'create':
- if( count( $arguments ) < 2 )
- throw new InvalidArgumentException(
$this->messages['subject_create_invalid'] );
- $subject = strtolower( $arguments[1] );
- switch( $subject )
- {
- case 'doc':
- if( count( $arguments ) < 3 )
- throw new InvalidArgumentException(
$this->messages['tool_create_doc'] );
- $tool = strtolower( $arguments[2] );
- switch( $tool )
- {
- case 'creator':
- new Go_DocCreator( array_slice( $arguments, 3 ) );
- break;
- case 'phpdoc':
- new Go_PhpDocumentor( array_slice( $arguments, 3 ) );
- break;
- default:
- throw new InvalidArgumentException(
$this->messages['tool_create_doc'] );
- }
- break;
- case 'test':
- new Go_UnitTestCreator( array_slice( $arguments, 2 ) );
- break;
- case 'changelog':
- new Go_Changelog();
- break;
- default:
- throw new InvalidArgumentException(
$this->messages['subject_create_invalid'] );
- }
- break;
- case 'test':
- if( count( $arguments ) < 2 )
- throw new InvalidArgumentException(
$this->messages['subject_test_invalid'] );
- $subject = strtolower( $arguments[1] );
- switch( $subject )
- {
- case 'benchmark':
- new Go_Benchmark();
- break;
- case 'syntax':
- new Go_ClassSyntaxTester( $arguments );
- break;
- case 'self':
- new Go_SelfTester( $arguments );
- break;
- case 'units':
- $className = empty( $arguments[2] ) ? NULL : $arguments[2];
- new Go_UnitTester( $className );
- break;
- default:
- throw new InvalidArgumentException(
$this->messages['subject_test_invalid'] );
- }
- break;
- case 'install':
- new Go_Installer( array_slice( $arguments, 1 ) );
- break;
- case 'configure':
- new Go_Configurator( array_slice( $arguments, 1 ) );
- break;
- case 'update':
- new Go_Updater( array_slice( $arguments, 1 ) );
- break;
- case 'moo':
- print Go_Animal::getCow();
- break;
- case 'changelog':
- new Go_Changes();
- break;
- default:
- throw new InvalidArgumentException( $this->messages['command_invalid']
);
- }
- }
-
- public function showUsage( $message = NULL )
- {
- if( $message )
- $message = "\nERROR: ".$message."\n";
- $text = file_get_contents( $this->basePath.'usage.txt' );
- print( "\n".$text."\n".$message );
- }
-}
-?>
=======================================
--- /trunk/Go/Benchmark.php5 Fri Apr 16 23:58:04 2010 UTC
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-require_once dirname( __FILE__ ).'/Library.php5';
-class Go_Benchmark
-{
- public function __construct()
- {
- define( 'LB', "\n" );
- $path = Go_Library::getLibraryPath();
- require_once( $path.'autoload.php5' );
- $path = Go_Library::getSourcePath();
-
- echo LB.'Memory Usage on start:';
- echo LB.'----------------------';
- $this->showMemoryUsage();
- echo LB;
-
- echo LB.'Loading... ';
- $start = microtime( TRUE );
- $data = Go_Library::listClasses( $path );
-
- $number = 0;
- foreach( $data['files'] as $file )
- {
- $number++;
- require_once( $file );
- }
- echo $number.' classes in '.round( ( microtime( TRUE ) - $start ) * 1000
).' ms'.LB;
- echo LB.'Memory Usage after loading:';
- echo LB.'---------------------------';
- $this->showMemoryUsage();
- echo LB;
- }
-
- function showMemoryUsage()
- {
- $usage = memory_get_usage();
- $limit = (int) ini_get( 'memory_limit' ) * 1024 * 1024;
- $ratio = round( $usage / $limit * 100, 3 )."%";
- echo LB.'Limit: '.Alg_UnitFormater::formatBytes( $limit );
- echo LB.'Usage: '.Alg_UnitFormater::formatBytes( $usage );
- echo LB.'Ratio: '.$ratio;
- }
-}
-?>
=======================================
--- /trunk/Go/Changes.php5 Sat Apr 4 14:24:55 2015 UTC
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-class Go_Changes
-{
- public function __construct()
- {
- $path = dirname( dirname( __FILE__ ) )."/";
- $revisions = 1000;
- $prefix = "";
- $fileTmp = "log.tmp";
- $fileTarget = $path."docs/changes.md";
-
- if( !file_exists( $fileTmp ) )
- exec( "svn log -l".$revisions." ".$path." --verbose > ".$fileTmp );
- $c = file_get_contents( $fileTmp );
- $c =
preg_replace( "/------------------------------------------------------------------------/", "----",
$c );
- $c = preg_replace( "/(\n+)----/s", "\n----", $c );
- $c = preg_replace( "/\n\n/", "µµ", $c );
- $c = preg_replace( "/----(.*)µµ(.*)\n/Us", "\n###\\2\n\\1\n", $c );
- $c = preg_replace( "/µµ/", "\n\n", $c );
- $c = preg_replace( "/ (A|D|M|R) /", "- \\1 ", $c );
- $c = preg_replace( "/(Geänderte Pfade|Changed paths):/", "", $c );
- $c = preg_replace( "/ \| [0-9] (Zeilen|Zeile|lines|line)/", "", $c );
- if( $prefix )
- $c = str_replace( "###".$prefix, "###", $c );
-
- file_put_contents( $fileTarget, $c );
- unlink( $fileTmp );
- }
-}
=======================================
--- /trunk/Go/ClassSyntaxTester.php5 Fri Oct 29 18:18:54 2010 UTC
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-require_once dirname( __FILE__ ).'/Library.php5';
-class Go_ClassSyntaxTester
-{
- public function __construct( $arguments )
- {
- remark( "GO Class File Syntax Test\n" );
-
- $path = dirname( dirname( __FILE__ ) )."/src";
- $data = Go_Library::listClasses( $path );
-
- remark( "found ".$data['count']." class files\n" );
- Go_Library::testSyntax( $data['files'] );
- }
-}
-?>
=======================================
--- /trunk/Go/Configurator.php5 Wed Nov 6 02:06:49 2013 UTC
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-class Go_Configurator
-{
- public function __construct( $arguments )
- {
- $force = in_array( "-f", $arguments ) || in_array( "--force", $arguments
);
- $pwd = str_replace( "\\", "/", dirname( dirname( realpath( __FILE__ ) )
) )."/";
-
- if( !defined( 'CM_CLASS_PATH' ) )
- define( 'CM_CLASS_PATH', $pwd );
- ini_set( 'include_path',
CM_CLASS_PATH.PATH_SEPARATOR.ini_get( "include_path" ) );
-# if( !@include_once( "autoload.php5" ) )
-# die( 'Installation of "cmClasses" seems to be
corrupt: '.$pwd.'import.php5 is missing.' );
- require_once( dirname( dirname( __FILE__ ) ).'/src/UI/DevOutput.php5' );
-
- $files = array(
- "cmClasses.ini.dist" => "cmClasses.ini",
- "doc.xml.dist" => "doc.xml",
- ".htaccess.dist" => ".htaccess",
- );
-
- foreach( $files as $sourceFile => $targetFile )
- {
- if( !file_exists( $pwd.$sourceFile ) )
- throw new RuntimeException( 'Source file "'.$sourceFile.'" is not
existing.' );
-
- remark( 'Setting up "'.$targetFile.'"... ' );
- $content = file_get_contents( $pwd.$sourceFile );
- $content = str_replace( "/path/to/cmClasses/version/", $pwd, $content );
- if( file_exists( $pwd."cmClasses.ini" ) ){
- $config = parse_ini_file( $pwd."cmClasses.ini", TRUE );
- $version = $config['project']['version'];
- $content = str_replace( 'title version=""', 'title
version="'.$version.'"', $content );
- }
- if( !$force && file_exists( $pwd.$targetFile ) )
- $status = "already existing, use --force to overwrite";
- else
- {
- file_put_contents( $pwd.$targetFile, $content );
- $status = "done.";
- }
- print( $status );
- }
- if( in_array( "--clean-up", $arguments ) )
- {
- remark( "Removing installer and distribution files..." );
- foreach( $files as $sourceFile => $targetFile )
- unlink( $pwd.$sourceFile );
- }
- remark( "\ncmClasses is now configured and usable.\n" );
- }
-}
-?>
=======================================
--- /trunk/Go/DocCreator.php5 Fri Nov 1 03:21:27 2013 UTC
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-class Go_DocCreator
-{
- public function __construct( $arguments )
- {
- $config = Go_Library::getConfigData();
- require_once dirname( dirname( __FILE__ ) ).'/autoload.php5';
- $path = $config['docCreator']['pathTool'];
- if( !file_exists( $path ) )
- throw new Exception( 'Tool "DocCreator" is not installed' );
- CMC_Loader::registerNew( 'php5', 'DocCreator_', $path."classes/" );
-
CMC_Loader::registerNew( 'php', 'Michelf\\', '/var/www/lib/php-markdown/Michelf/'
);
-
- $file = dirname( dirname( __FILE__ ) )."/doc.xml";
- $runner = new DocCreator_Core_Runner( $file );
- $runner->main();
-
-# $creator = new DocCreator_Core_ConsoleRunner( $file ); // open
new starter
- }
-}
-?>
=======================================
--- /trunk/Go/Installer.php5 Fri Apr 16 23:58:04 2010 UTC
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-require_once dirname( __FILE__ ).'/Library.php5';
-require_once dirname( __FILE__ ).'/Configurator.php5';
-class Go_Installer
-{
- public function __construct( $arguments )
- {
- Go_Library::ensureSvnSupport();
-
- $repos = "
http://cmclasses.googlecode.com/svn/";
- if( count( $arguments ) < 2 )
- throw new InvalidArgumentException( 'No install path set.' );
- if( count( $arguments ) < 1 )
- throw new InvalidArgumentException( 'No version to install set.' );
-
- $command = "co ".$repos.$arguments[0]." ".$arguments[1];
- Go_Library::runSvn( $command );
- chDir( $arguments[1] );
- new Go_Configurator();
- }
-}
-?>
=======================================
--- /trunk/Go/Library.php5 Fri Oct 29 18:18:54 2010 UTC
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-class Go_Library
-{
- public static $configFile = 'cmClasses.ini';
-
- public function getConfigData()
- {
- return parse_ini_file( self::getConfigFile(), TRUE );
- }
-
- public static function getConfigFile()
- {
- return dirname( dirname( __FILE__ ) ).'/'.self::$configFile;
- }
-
- public static function listClasses( $path )
- {
- $count = 0;
- $size = 0;
- $list = array();
- self::listClassesRecursive( $path, $list, $count, $size );
- return array(
- 'path' => $path,
- 'count' => $count,
- 'size' => $size,
- 'files' => $list
- );
- }
-
- public static function ensureSvnSupport()
- {
- echo "checking svn... ";
- $command = 'svn --version --quiet';
- $method = 'system';
- switch( $method )
- {
- case 'system':
- @system( $command, $return );
- $support = $return === 0;
- break;
- case 'exec':
- $results = array();
- @exec( $command, $results, $return );
- print_m( $return );
- $support = $return === 0;
- break;
- case 'passthru':
- $return = 0;
- @passthru( $command, $return );
- $support = $return === 0;
- break;
- default:
- throw new InvalidArgumentException( 'Method "'.$method.'" not
implemented' );
- }
- if( !$support )
- throw new RuntimeException( "Subversion Client (svn) seems to be
missing." );
- }
-
- public static function getGoPath()
- {
- return dirname( __FILE__ ).'/';
- }
-
- public static function getLibraryPath()
- {
- return dirname( dirname( __FILE__ ) ).'/';
- }
-
- public static function getSourcePath()
- {
- return self::getLibraryPath().'/src/';
- }
-
- protected static function listClassesRecursive( $path, &$list, &$count ,
&$size )
- {
- $index = new DirectoryIterator( $path );
- foreach( $index as $entry )
- {
- $pathName = $entry->getPathname();
- if( $entry->isDot() )
- continue;
- if( $entry->getFilename() == ".svn" )
- continue;
- if( $entry->isDir() )
- {
- # echo "Path: ".$entry->getPath()."\n";
- self::listClassesRecursive( $pathName, $list, $count, $size );
- }
- else if( $entry->isFile() )
- {
- $info = pathinfo( $pathName );
- if( $info['extension'] !== "php5" )
- continue;
- if( !preg_match( '/^[A-Z]/', $info['basename'] ) )
- continue;
- $list[] = $pathName;
- $size += filesize( $pathName );
- $count++;
- }
- }
- }
-
- public static function runSvn( $command )
- {
- passthru( "svn ".$command, $return );
- }
-
- public static function showMemoryUsage()
- {
- $number = ceil( memory_get_usage() / 1024 );
- print( "\nmemory: ".$number."KB" );
- }
-
- /**
- * @deprecated since CMC_Loader
- */
- public static function testImports( $files )
- {
- remark( "Checking nested imports\n" );
- $count = 0;
- $path = dirname( __FILE__ )."/";
- $line = str_repeat( "-", 79 );
- $list = array();
- foreach( $files as $file )
- {
- $relative = str_replace( $path, "", $file );
- if( $count && !( $count % 60 ) )
- echo " ".$count."/".count( $files )."\n";
- try
- {
- @require_once( $relative );
- echo ".";
- }
- catch( Exception $e )
- {
- $list[$file] = $e;
- echo "E";
- }
- $count++;
- }
- echo " ".$count."/".count( $files )."\n";
- if( $list )
- {
- remark( "\n! Invalid files:" );
- foreach( $list as $file => $exception )
- {
- $relative = str_replace( $path, "", $file );
- remark( "File: ".$relative );
- remark( $exception->getMessage() );
- remark( $line );
- }
- }
- }
-
- public static function testSyntax( $files )
- {
- remark( "Checking class file syntax\n" );
- $count = 0;
- $path = dirname( __FILE__ )."/";
- $line = str_repeat( "-", 79 );
- $list = array();
- foreach( $files as $file )
- {
- if( $count && !( $count % 60 ) )
- echo " ".$count."/".count( $files )."\n";
- $output = shell_exec('php -l "'.$file.'"');
- if( !preg_match( '/^No syntax errors detected/', $output ) )
- {
- $list[$file] = $output;
- echo "E";
- }
- else
- echo ".";
-
- $count++;
- }
- echo " ".$count."/".count( $files )."\n";
- if( $list )
- {
- remark( "\n! Invalid files:" );
- foreach( $list as $file => $message )
- {
- $relative = str_replace( $path, "", $file );
- remark( "File: ".$relative.$message.$line );
- }
- }
- }
-}
-?>
=======================================
--- /trunk/Go/PhpDocumentor.php5 Fri Jul 23 09:02:52 2010 UTC
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-class Go_PhpDocumentor
-{
- public function __construct( $arguments )
- {
- $config = Go_Library::getConfigData();
- $configFile = Go_Library::getConfigFile();
- $reportFile = $config['phpDocumentor']['outputLog']; //
phpDocumentor Report File
- $command = "phpdoc -c ".$configFile; // Shell Command to run
phpDocumentor
-
- if( in_array( "--show-config-only", $arguments ) )
- {
- remark( "Settings:" );
- foreach( $config['phpDocumentor'] as $key => $value )
- {
- $key .= str_repeat( " ", 20 - strlen( $key ) );
- remark( $key.$value );
- }
- return;
- }
- if( in_array( "-q", $arguments ) || in_array( "--quite", $arguments ) )
// Quite Mode is activated
- {
- $command .= " > ".$reportFile; // redirect Output into
Report File
- @unlink( $reportFile ); // remove old Report File
- }
- die( $command );
- passthru( $command ); // run phpDocumentor
- }
-}
-?>
=======================================
--- /trunk/Go/SelfTester.php5 Fri Apr 16 23:58:04 2010 UTC
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-require_once dirname( __FILE__ ).'/Library.php5';
-class Go_SelfTester
-{
- public function __construct( $arguments )
- {
- $lib = new Go_Library();
-
- remark( "testing GO itself\n" );
-
- $path = dirname( __FILE__ );
- $data = Go_Library::listClasses( $path );
-
- Go_Library::testSyntax( $data['files'] );
- Go_Library::testImports( $data['files'] );
-
- remark( "create random numbers with 3 digits: " );
- import( 'de.ceus-media.alg.Randomizer' );
- import( 'de.ceus-media.math.RomanNumbers' );
-
- $randomizer = new Alg_Randomizer();
- $randomizer->useLarges = FALSE;
- $randomizer->useSmalls = FALSE;
- $randomizer->useSigns = FALSE;
- $c = $randomizer->get( 1 ) + 2;
- for( $i=0; $i<$c; $i++ )
- print( $randomizer->get( 3 )." " );
-
- remark( "roman date: " );
- $year = date( "Y" );
- print( $year. " is ".Math_RomanNumbers::convertToRoman( $year ) );
-
- remark( "" );
- }
-}
-?>
=======================================
--- /trunk/Go/UnitTestCreator.php5 Sat Apr 17 00:02:02 2010 UTC
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-class Go_UnitTestCreator
-{
- public function __construct( $arguments )
- {
- require_once dirname( dirname( __FILE__ ) ).'/autoload.php5';
-
- $force = in_array( "-f", $arguments ) || in_array( "--force", $arguments
);
- if( in_array( "-f", $arguments ) )
- unset( $arguments[array_search( "-f", $arguments )] );
- if( in_array( "--force", $arguments ) )
- unset( $arguments[array_search( "--force", $arguments )] );
- if( !$arguments )
- throw new InvalidArgumentException( 'No class name given to create test
class for.' );
- $class = array_shift( $arguments );
- $creator = new File_PHP_Test_Creator();
- $creator->createForFile( $class, $force );
- remark( 'Created test class "Test_'.$class.'Test".'."\n" );
- }
-}
-?>
=======================================
--- /trunk/Go/UnitTester.php5 Sat Apr 28 01:34:03 2012 UTC
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-require_once dirname( __FILE__ ).'/Library.php5';
-class Go_UnitTester
-{
- public function __construct( $className = NULL )
- {
- if( !empty( $className ) )
- return $this->runTestOfClass( trim( $className ) );
- $this->runAllTests();
- }
-
- protected function runAllTests()
- {
- remark( "Reading Class Files:\n" );
- $data = Go_Library::listClasses( dirname( dirname ( __FILE__ ) ).'/src/'
);
- $number = count( $data['files'] );
- $length = strlen( $number );
- for( $i=0; $i<$number; $i++ )
- {
- require_once( $data['files'][$i] );
- if( !( $i % 60 ) ){
- $percent = str_pad( round( $i / $number * 100 ), 3, ' ', STR_PAD_LEFT
);
- $current = str_pad( $i, $length, ' ', STR_PAD_LEFT );
- echo " ".$current." / ".$number." (".$percent."%)\n";
- }
- echo '.';
- }
- remark( "\n" );
-
- $command = "phpunit";
- $config = Go_Library::getConfigData();
- foreach( $config['unitTestOptions'] as $key => $value )
- $command .= " --".$key." ".$value;
- print( "\nRunning Unit Tests:\n\r" );
- $command .= " Test";
- passthru( $command );
- }
-
- protected function runTestOfClass( $className )
- {
- $parts = explode( "_", $className );
- $fileKey = array_pop( $parts );
- $suffix = $fileKey == "All" ? "Tests" : "Test";
- while( $parts )
- $fileKey = array_pop( $parts )."/".$fileKey;
-
- $testClass = "Test_".$className.$suffix;
- $testFile = "Test/".$fileKey.$suffix.".php";
- if( !file_exists( $testFile ) )
- throw new RuntimeException( 'Test Class File "'.$testFile.'" is not
existing' );
- echo "\nTesting Class: ".$className."\n\n";
-
- passthru( "phpunit ".$testClass, $return );
- }
-}
-?>
=======================================
--- /trunk/Go/Updater.php5 Fri Apr 16 23:58:04 2010 UTC
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-require_once dirname( __FILE__ ).'/Library.php5';
-class Go_Updater
-{
- public function __construct( $arguments )
- {
- $revision = $arguments ? $arguments[0] : "";
- $path = dirname( dirname( realpath( __FILE__ ) ) );
- $command = "update ".$path." ".$revision;
-
- Go_Library::ensureSvnSupport();
- Go_Library::runSvn( $command );
- }
-}
-?>