|
eZ Publish
[4.0]
|
00001 #!/usr/bin/env php 00002 <?php 00003 // 00004 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00005 // SOFTWARE NAME: eZ Publish 00006 // SOFTWARE RELEASE: 4.0.x 00007 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00008 // SOFTWARE LICENSE: GNU General Public License v2.0 00009 // NOTICE: > 00010 // This program is free software; you can redistribute it and/or 00011 // modify it under the terms of version 2.0 of the GNU General 00012 // Public License as published by the Free Software Foundation. 00013 // 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of version 2.0 of the GNU General 00020 // Public License along with this program; if not, write to the Free 00021 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00022 // MA 02110-1301, USA. 00023 // 00024 // 00025 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00026 // 00027 00028 if ( file_exists( "config.php" ) ) 00029 { 00030 require "config.php"; 00031 } 00032 00033 //Setup, includes 00034 //{ 00035 if ( !@include( 'ezc/Base/base.php' ) ) 00036 { 00037 require "Base/src/base.php"; 00038 } 00039 00040 require 'lib/ezutils/classes/ezautoloadgenerator.php'; 00041 00042 function __autoload( $className ) 00043 { 00044 ezcBase::autoload( $className ); 00045 } 00046 //} 00047 00048 // Setup console parameters 00049 //{ 00050 $params = new ezcConsoleInput(); 00051 00052 $helpOption = new ezcConsoleOption( 'h', 'help' ); 00053 $helpOption->mandatory = false; 00054 $helpOption->shorthelp = "Show help information"; 00055 $params->registerOption( $helpOption ); 00056 00057 $targetOption = new ezcConsoleOption( 't', 'target', ezcConsoleInput::TYPE_STRING ); 00058 $targetOption->mandatory = false; 00059 $targetOption->default = "autoload"; 00060 $targetOption->shorthelp = "The directory to where the generated autoload file should be written."; 00061 $params->registerOption( $targetOption ); 00062 00063 $verboseOption = new ezcConsoleOption( 'v', 'verbose', ezcConsoleInput::TYPE_NONE ); 00064 $verboseOption->mandatory = false; 00065 $verboseOption->shorthelp = "Whether or not to display more information."; 00066 $params->registerOption( $verboseOption ); 00067 00068 $dryrunOption = new ezcConsoleOption( 'n', 'dry-run', ezcConsoleInput::TYPE_NONE ); 00069 $dryrunOption->mandatory = false; 00070 $dryrunOption->shorthelp = "Whether a new file autoload file should be written."; 00071 $params->registerOption( $dryrunOption ); 00072 00073 $kernelFilesOption = new ezcConsoleOption( 'k', 'kernel', ezcConsoleInput::TYPE_NONE ); 00074 $kernelFilesOption->mandatory = false; 00075 $kernelFilesOption->shorthelp = "If an autoload array for the kernel files should be generated."; 00076 $params->registerOption( $kernelFilesOption ); 00077 00078 $extensionFilesOption = new ezcConsoleOption( 'e', 'extension', ezcConsoleInput::TYPE_NONE ); 00079 $extensionFilesOption->mandatory = false; 00080 $extensionFilesOption->shorthelp = "If an autoload array for the extensions should be generated."; 00081 $params->registerOption( $extensionFilesOption ); 00082 00083 $excludeDirsOption = new ezcConsoleOption( '', 'exclude', ezcConsoleInput::TYPE_STRING ); 00084 $excludeDirsOption->mandatory = false; 00085 $excludeDirsOption->shorthelp = "Folders to exclude from the class search."; 00086 $params->registerOption( $excludeDirsOption ); 00087 00088 // Process console parameters 00089 try 00090 { 00091 $params->process(); 00092 } 00093 catch ( ezcConsoleOptionException $e ) 00094 { 00095 print( $e->getMessage(). "\n" ); 00096 print( "\n" ); 00097 00098 echo $params->getHelpText( 'Autoload file generator.' ) . "\n"; 00099 00100 echo "\n"; 00101 exit(); 00102 } 00103 00104 if ( $helpOption->value === true ) 00105 { 00106 echo $params->getHelpText( 'Autoload file generator.' ) . "\n"; 00107 exit(); 00108 } 00109 //} 00110 00111 if ( $excludeDirsOption->value !== false ) 00112 { 00113 $excludeDirs = explode( ' ', $excludeDirsOption->value ); 00114 } 00115 else 00116 { 00117 $excludeDirs = false; 00118 } 00119 00120 00121 $autoloadGenerator = new eZAutoloadGenerator( getcwd(), 00122 $kernelFilesOption->value, 00123 $extensionFilesOption->value, 00124 $verboseOption->value, 00125 !$dryrunOption->value, 00126 $targetOption->value, 00127 $excludeDirs ); 00128 try { 00129 $autoloadGenerator->buildAutoloadArrays(); 00130 } catch (Exception $e) { 00131 echo $e->getMessage() . "\n"; 00132 } 00133 00134 ?>