Cleanup first draft.
authorGunnar Wrobel <p@rdus.de>
Wed, 30 Jun 2010 08:33:30 +0000 (10:33 +0200)
committerGunnar Wrobel <p@rdus.de>
Mon, 23 Aug 2010 07:51:49 +0000 (09:51 +0200)
framework/Qc/lib/Horde/Qc/Autoloader.php [new file with mode: 0644]
framework/Qc/lib/Horde/Qc/Config/Cli.php
framework/Qc/lib/Horde/Qc/Config/Interface.php [deleted file]
framework/Qc/package.xml
framework/Qc/script/horde-quality-control.php

diff --git a/framework/Qc/lib/Horde/Qc/Autoloader.php b/framework/Qc/lib/Horde/Qc/Autoloader.php
new file mode 100644 (file)
index 0000000..e91dad3
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'Horde/Autoloader.php';
+require_once 'Horde/Autoloader/ClassPathMapper.php';
+require_once 'Horde/Autoloader/ClassPathMapper/Default.php';
+
+class Horde_Qc_Autoloader extends Horde_Autoloader
+{
+    public function __construct()
+    {
+        foreach (array_reverse(explode(PATH_SEPARATOR, get_include_path())) as $path) {
+            if ($path == '.') { continue; }
+            $path = realpath($path);
+            if ($path) {
+                $this->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Default($path));
+            }
+        }
+    }
+}
+
+$__autoloader = new Horde_Qc_Autoloader();
+$__autoloader->registerAutoloader();
index 66f0ad9..3e4c723 100644 (file)
 erver
  */
 class Horde_Qc_Config_Cli
-implements Horde_Qc_Config_Interface
 {
-
-    private $_parser;
-
     private $_opts;
 
     private $_args;
@@ -45,18 +41,16 @@ implements Horde_Qc_Config_Interface
      */
     public function __construct(Horde_Qc_Modules $modules)
     {
-        $options = array();
-
-        foreach ($modules as $module) {
-            $options = array_merge($options, $module->getOptions());
-        }
-
-        $this->_parser = new Horde_Argv_Parser(
+        $parser = new Horde_Argv_Parser(
             array(
-                'optionList' => array_values($options),
                 'usage' => '%prog ' . _("[options] PACKAGE_PATH")
             )
         );
+
+        foreach ($modules as $module) {
+            $parser->addOptionGroup($module->getOptions());
+        }
+
         list($this->_opts, $this->_args) = $parser->parseArgs();
     }
 }
diff --git a/framework/Qc/lib/Horde/Qc/Config/Interface.php b/framework/Qc/lib/Horde/Qc/Config/Interface.php
deleted file mode 100644 (file)
index bf0bfeb..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * Horde_Qc_Config_Interface:: represents configuration for the Horde quality
- * control tool.
- *
- * PHP version 5
- *
- * @category Horde
- * @package  Qc
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Qc
- */
-
-/**
- * Horde_Qc_Config_Interface:: represents configuration for the Horde quality
- * control tool.
- *
- * Copyright 2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Horde
- * @package  Qc
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Qc
-erver
- */
-interface Horde_Qc_Config_Interface
-{
-}
\ No newline at end of file
index 3f99a8d..4d41851 100644 (file)
@@ -43,6 +43,7 @@
    <dir name="lib">
     <dir name="Horde">
      <dir name="Qc">
+      <file name="Autoloader.php" role="php" />
       <dir name="Config">
        <file name="Cli.php" role="php" />
        <file name="Interface.php" role="php" />
@@ -82,6 +83,7 @@
  </dependencies>
  <phprelease>
   <filelist>
+   <install as="Horde/Qc/Autoloader.php" name="lib/Horde/Qc/Autoloader.php" />
    <install as="Horde/Qc/Config/Cli.php" name="lib/Horde/Qc/Config/Cli.php" />
    <install as="Horde/Qc/Config/Interface.php" name="lib/Horde/Qc/Config/Interface.php" />
    <install as="hqc" name="script/horde-quality-control.php" />
index afa8f19..64ac2b7 100755 (executable)
@@ -1,4 +1,4 @@
 #!/usr/bin/env php
 <?php
-require_once('Horde/Autoloader.php');
+require_once 'Horde/Qc/Autoloader.php';
 Horde_Qc::main();