Permalink
Browse files

Switched to theseer's Autoload.

Adapted build automation for Hudson CI.
  • Loading branch information...
1 parent d45d47e commit 7ffefe850f6b7f9605ff9d99c2958bd69ebbdab1 @spriebsch committed Feb 13, 2010
Showing with 222 additions and 520 deletions.
  1. +1 −1 CreatePhar.php
  2. +1 −0 TODO
  3. +51 −37 build.xml
  4. +9 −4 phpunit.xml
  5. +71 −0 src/Autoload.php
  6. +0 −228 src/Autoloader.php
  7. +0 −160 src/Loader.php
  8. +0 −75 src/_ClassMap.php
  9. +3 −6 src/phpca.php
  10. +84 −0 tests/Autoload.php
  11. +0 −2 tests/CLITest.php
  12. +2 −7 tests/bootstrap.php
View
@@ -1,6 +1,6 @@
<?php
-$phar = new Phar('_phar/phpca.phar');
+$phar = new Phar('_logs/phar/phpca.phar');
$phar->buildFromDirectory('src');
$phar->setStub(file_get_contents('PharStub.php'));
View
1 TODO
@@ -46,3 +46,4 @@ Rules to add (in no particular order, just a collection of ideas)
* find classes that are aliased in a namespace, but not used
* single = in if comparison
* print rule and printf-family?
+* disallow explicit calling of magic methods (except parent::__construct etc.)
View
@@ -1,52 +1,66 @@
-<?xml version="1.0"?>
+<project name="PHPca" default="all" basedir=".">
-<project name="PHPca" default="build" basedir=".">
+ <property name="src" location="src"/>
+ <property name="lib" location="lib"/>
+ <property name="tests" location="tests"/>
- <target name="build" depends="phpunit" description="Performs quality assurance." />
+ <property name="build" location="_build"/>
+ <property name="output" location="_logs"/>
- <target name="clean" description="Cleans up.">
- <delete dir="_docs" />
- <delete dir="_coverage" />
- <delete dir="_phar" />
+ <target name="init">
+ <mkdir dir="${build}"/>
+ <mkdir dir="${output}"/>
+ <mkdir dir="${output}/coverage-html"/>
+ <mkdir dir="${output}/coverage-xml"/>
+ <mkdir dir="${output}/junit"/>
+ <mkdir dir="${output}/testdox"/>
+ <mkdir dir="${output}/apidoc"/>
+ <mkdir dir="${output}/phar"/>
</target>
- <target name="phar" description="Creates Phar archive.">
- <delete dir="_phar" />
- <mkdir dir="_phar" />
- <exec dir="${basedir}" executable="php" failonerror="true">
- <arg line="CreatePhar.php" />
- </exec>
+ <target name="clean">
+ <delete dir="${build}"/>
+ <delete dir="${output}"/>
</target>
- <target name="doc" description="Creates API documentation.">
- <delete dir="_docs" />
- <exec command="doxygen" checkReturn="true"/>
+ <target name="create_autoloader">
+ <exec executable="phpab" failonerror="true">
+ <arg value="-o"/>
+ <arg value="${src}/Autoload.php"/>
+ <arg value="${src}"/>
+ </exec>
+ <exec executable="phpab" failonerror="true">
+ <arg value="-o"/>
+ <arg value="${tests}/Autoload.php"/>
+ <arg value="${tests}"/>
+ </exec>
</target>
-<!--
- <target name="lint" description="Runs lint check.">
- <phplint haltonfailure="true">
- <fileset dir="src">
- <include name="*.php"/>
- <include name="**/*.php"/>
- </fileset>
- </phplint>
-
- <phplint haltonfailure="true">
- <fileset dir="tests">
- <include name="*.php"/>
- <include name="**/*.php"/>
- <exclude name="_testdata/*.php"/>
- <exclude name="_testdata/**/*.php"/>
- </fileset>
- </phplint>
+ <target name="test" depends="init">
+ <exec executable="phpunit" failonerror="true">
+ <arg value="--configuration phpunit.xml"/>
+ </exec>
+ </target>
+
+ <target name="apidoc" depends="init">
+ <exec executable="phpdoc" failonerror="true">
+ <arg value="-d"/>
+ <arg value="${src}"/>
+ <arg value="-t"/>
+ <arg value="${output}/apidoc"/>
+ <arg value="-o"/>
+ <arg value="HTML:frames:earthli"/>
+ <arg value="-i"/>
+ <arg value="Autoload.php"/>
+ </exec>
</target>
--->
- <target name="phpunit" description="Runs unit tests.">
- <exec dir="${basedir}" executable="phpunit" failonerror="true">
- <arg line="--configuration phpunit.xml" />
+ <target name="phar" description="Creates Phar archive.">
+ <exec dir="${basedir}" executable="php" failonerror="true">
+ <arg line="CreatePhar.php" />
</exec>
</target>
+ <target name="all" depends="clean, init, test, apidoc"/>
+
</project>
View
@@ -2,7 +2,8 @@
<phpunit backupGlobals="false"
backupStaticAttributes="false"
- syntaxCheck="false" bootstrap="tests/bootstrap.php">
+ bootstrap="tests/bootstrap.php"
+ syntaxCheck="false">
<testsuites>
<testsuite name="PHPca">
@@ -20,6 +21,10 @@
</filter>
<logging>
- <log type="coverage-html" target="_coverage" charset="UTF-8"
- yui="true" highlight="true"/>
- </logging></phpunit>
+ <log type="coverage-html" target="_logs/coverage" charset="UTF-8" yui="true" highlight="true"/>
+ <log type="coverage-xml" target="_logs/coverage-xml/clover.xml"/>
+ <log type="testdox-html" target="_logs/testdox/testdox.html"/>
+ <log type="junit" target="_logs/junit/junit.xml" logIncompleteSkipped="false"/>
+ </logging>
+
+</phpunit>
View
@@ -0,0 +1,71 @@
+<?php // this is an autogenerated file - do not edit (created Sat, 13 Feb 2010 12:40:57 +0100)
+spl_autoload_register(
+ function($class) {
+ static $classes = array(
+ 'spriebsch\\phpca\\phpfilefilteriterator' => '/PhpFileFilterIterator.php',
+ 'spriebsch\\phpca\\file' => '/File.php',
+ 'spriebsch\\phpca\\cli' => '/CLI.php',
+ 'spriebsch\\phpca\\exception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\loaderexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\cannotinstantiateloaderexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\classmapnotfoundexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\invalidclassmapexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\unknownvariableexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\linterexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\tokenizerexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\emptypatternexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\pattern\\patternexception' => '/Exceptions.php',
+ 'spriebsch\\phpca\\rule\\nocarriagereturnsrule' => '/Rule/NoCarriageReturnsRule.php',
+ 'spriebsch\\phpca\\rule\\functionsmusthavedocblockrule' => '/Rule/FunctionsMustHaveDocBlockRule.php',
+ 'spriebsch\\phpca\\rule\\noglobalstatementsrule' => '/Rule/NoGlobalStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\opentagatbeginningrule' => '/Rule/OpenTagAtBeginningRule.php',
+ 'spriebsch\\phpca\\rule\\notabulatorsrule' => '/Rule/NoTabulatorsRule.php',
+ 'spriebsch\\phpca\\rule\\notrailingwhitespacerule' => '/Rule/NoTrailingWhitespaceRule.php',
+ 'spriebsch\\phpca\\rule\\closetagatendrule' => '/Rule/CloseTagAtEndRule.php',
+ 'spriebsch\\phpca\\rule\\indentationrule' => '/Rule/IndentationRule.php',
+ 'spriebsch\\phpca\\rule\\novardumpstatementsrule' => '/Rule/NoVarDumpStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\methodsmusthavevisibilityoperatorrule' => '/Rule/MethodsMustHaveVisibilityOperatorRule.php',
+ 'spriebsch\\phpca\\rule\\nogotostatementsrule' => '/Rule/NoGotoStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\noechostatementsrule' => '/Rule/NoEchoStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\noshutupoperatorsrule' => '/Rule/NoShutupOperatorsRule.php',
+ 'spriebsch\\phpca\\rule\\classesmusthavedocblockrule' => '/Rule/ClassesMustHaveDocBlockRule.php',
+ 'spriebsch\\phpca\\rule\\novarkeywordsrule' => '/Rule/NoVarKeywordsRule.php',
+ 'spriebsch\\phpca\\rule\\includeandrequirewithoutbracketsrule' => '/Rule/IncludeAndRequireWithoutBracketsRule.php',
+ 'spriebsch\\phpca\\rule\\noevalstatementsrule' => '/Rule/NoEvalStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\keywordsarelowercaserule' => '/Rule/KeywordsAreLowercaseRule.php',
+ 'spriebsch\\phpca\\rule\\novariablevariablesrule' => '/Rule/NoVariableVariablesRule.php',
+ 'spriebsch\\phpca\\rule\\noprintstatementsrule' => '/Rule/NoPrintStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\noinlinehtmlrule' => '/Rule/NoInlineHtmlRule.php',
+ 'spriebsch\\phpca\\rule\\noalternativesyntaxstatementsrule' => '/Rule/NoAlternativeSyntaxStatementsRule.php',
+ 'spriebsch\\phpca\\rule\\onetruebracestylerule' => '/Rule/OneTrueBraceStyleRule.php',
+ 'spriebsch\\phpca\\tokenfilteriterator' => '/TokenFilterIterator.php',
+ 'spriebsch\\phpca\\result' => '/Result.php',
+ 'spriebsch\\phpca\\application' => '/Application.php',
+ 'spriebsch\\phpca\\constants' => '/Constants.php',
+ 'spriebsch\\phpca\\helper' => '/Helper.php',
+ 'spriebsch\\phpca\\tokenizer' => '/Tokenizer.php',
+ 'spriebsch\\phpca\\finder' => '/Finder.php',
+ 'spriebsch\\phpca\\configuration' => '/Configuration.php',
+ 'spriebsch\\phpca\\linter' => '/Linter.php',
+ 'spriebsch\\phpca\\unknowntokenexception' => '/UnknownTokenException.php',
+ 'spriebsch\\phpca\\pattern\\zeroormore' => '/Pattern/ZeroOrMore.php',
+ 'spriebsch\\phpca\\pattern\\oneormore' => '/Pattern/OneOrMore.php',
+ 'spriebsch\\phpca\\pattern\\pattern' => '/Pattern/Pattern.php',
+ 'spriebsch\\phpca\\pattern\\patterninterface' => '/Pattern/PatternInterface.php',
+ 'spriebsch\\phpca\\pattern\\oneof' => '/Pattern/OneOf.php',
+ 'spriebsch\\phpca\\pattern\\token' => '/Pattern/Token.php',
+ 'spriebsch\\phpca\\progressprinterinterface' => '/ProgressPrinterInterface.php',
+ 'spriebsch\\phpca\\token' => '/Token.php',
+ 'spriebsch\\phpca\\rule\\rule' => '/Rule.php',
+ 'spriebsch\\phpca\\message' => '/Message/Message.php',
+ 'spriebsch\\phpca\\violation' => '/Message/Violation.php',
+ 'spriebsch\\phpca\\skipped' => '/Message/Skipped.php',
+ 'spriebsch\\phpca\\linterror' => '/Message/LintError.php',
+ 'spriebsch\\phpca\\ruleerror' => '/Message/RuleError.php'
+ );
+ $cn = strtolower($class);
+ if (isset($classes[$cn])) {
+ require __DIR__ . $classes[$cn];
+ }
+ }
+);
Oops, something went wrong.

0 comments on commit 7ffefe8

Please sign in to comment.