Permalink
Browse files

Refactor to use autoload, refactor version info handling

  • Loading branch information...
1 parent 76a39c6 commit f39fa5b1e0c14e6f4fc573d2a4359413645c16ee @theseer committed Mar 28, 2012
Showing with 39 additions and 46 deletions.
  1. +0 −26 autoload.php
  2. +1 −4 pear.sh
  3. +11 −8 phpab.php
  4. +26 −0 src/autoload.php
  5. +1 −8 src/cli.php
View
@@ -1,26 +0,0 @@
-<?php
-// @codingStandardsIgnoreFile
-// @codeCoverageIgnoreStart
-// this is an autogenerated file - do not edit
-spl_autoload_register(
- function($class) {
- static $classes = null;
- if ($classes === null) {
- $classes = array(
- 'theseer\\autoload\\autoloadbuilder' => '/src/autoloadbuilder.php',
- 'theseer\\autoload\\autoloadbuilderexception' => '/src/autoloadbuilder.php',
- 'theseer\\autoload\\classdependencysorter' => '/src/dependencysorter.php',
- 'theseer\\autoload\\classdependencysorterexception' => '/src/dependencysorter.php',
- 'theseer\\autoload\\classfinder' => '/src/classfinder.php',
- 'theseer\\autoload\\classfinderexception' => '/src/classfinder.php',
- 'theseer\\autoload\\cli' => '/src/cli.php',
- 'theseer\\autoload\\staticbuilder' => '/src/staticbuilder.php'
- );
- }
- $cn = strtolower($class);
- if (isset($classes[$cn])) {
- require __DIR__ . $classes[$cn];
- }
- }
-);
-// @codeCoverageIgnoreEnd
View
@@ -3,11 +3,8 @@ rm -f Autoload*.tgz
mkdir -p tmp/TheSeer/Autoload
cp -r src/* tmp/TheSeer/Autoload
cp package.xml tmp
-cp phpab.bat tmp
+cp phpab.* tmp
cd tmp
-sed -e "s@require __DIR__ . '/src/@require 'TheSeer/Autoload/@" ../phpab.php | \
- sed -e "s@require __DIR__ . '/../ezc/current/Base/src/@require 'ezc/Base/@" | \
- sed -e "s@require __DIR__ . '/../DirectoryScanner/@require 'TheSeer/DirectoryScanner/@" > phpab.php
pear package
mv Autoload*.tgz ..
cd ..
View
@@ -42,16 +42,19 @@
* 4 - Lint Error
*/
-require __DIR__ . '/../DirectoryScanner/autoload.php';
-require __DIR__ . '/../ezc/current/Base/src/base.php';
-spl_autoload_register(array('\ezcBase','autoload'));
+define('PHPAB_VERSION', '%development%');
+
+require 'TheSeer/DirectoryScanner/autoload.php';
+require 'ezc/Base/base.php';
+require 'PHP/Timer.php';
-require __DIR__ . '/src/classfinder.php';
-require __DIR__ . '/src/autoloadbuilder.php';
-require __DIR__ . '/src/staticbuilder.php';
-require __DIR__ . '/src/dependencysorter.php';
+if (strpos(PHPAB_VERSION, '%development') === 0) {
+ require __DIR__ . '/src/autoload.php';
+} else {
+ require 'TheSeer/Autoload/autoload.php';
+}
+spl_autoload_register(array('\ezcBase','autoload'));
-require __DIR__ . '/src/cli.php';
$exec = new \TheSeer\Autoload\CLI();
$exec->run();
View
@@ -0,0 +1,26 @@
+<?php
+// @codingStandardsIgnoreFile
+// @codeCoverageIgnoreStart
+// this is an autogenerated file - do not edit
+spl_autoload_register(
+ function($class) {
+ static $classes = null;
+ if ($classes === null) {
+ $classes = array(
+ 'theseer\\autoload\\autoloadbuilder' => '/autoloadbuilder.php',
+ 'theseer\\autoload\\autoloadbuilderexception' => '/autoloadbuilder.php',
+ 'theseer\\autoload\\classdependencysorter' => '/dependencysorter.php',
+ 'theseer\\autoload\\classdependencysorterexception' => '/dependencysorter.php',
+ 'theseer\\autoload\\classfinder' => '/classfinder.php',
+ 'theseer\\autoload\\classfinderexception' => '/classfinder.php',
+ 'theseer\\autoload\\cli' => '/cli.php',
+ 'theseer\\autoload\\staticbuilder' => '/staticbuilder.php'
+ );
+ }
+ $cn = strtolower($class);
+ if (isset($classes[$cn])) {
+ require __DIR__ . $classes[$cn];
+ }
+ }
+);
+// @codeCoverageIgnoreEnd
View
@@ -47,13 +47,6 @@
class CLI {
/**
- * Version identifier
- *
- * @var string
- */
- const VERSION = "%version%";
-
- /**
* Main executor method
*
* @return void
@@ -474,7 +467,7 @@ protected function lintCode($code, $input) {
* Helper to output version information
*/
protected function showVersion() {
- printf("phpab %s - Copyright (C) 2009 - 2012 by Arne Blankerts\n\n", self::VERSION);
+ printf("phpab %s - Copyright (C) 2009 - 2012 by Arne Blankerts\n\n", PHPAB_VERSION);
}
/**

0 comments on commit f39fa5b

Please sign in to comment.