Remove hard-coded paths from documentation generation script, and don't allow running except from CLI.

Added --all option to skip the prompt so this can be run as part of an automated release build process.
Place the generated files into docs/html.
This commit is contained in:
Brion Vibber 2004-09-04 01:58:17 +00:00
parent 0e082d4454
commit 699a4f9b99
2 changed files with 43 additions and 11 deletions

4
docs/html/README Normal file
View file

@ -0,0 +1,4 @@
This directory is for the auto-generated phpdoc documentation.
Run 'php mwdocgen.php' in the maintenance subdirectory to build the docs.
Get phpDocumentor from http://phpdoc.org/

View file

@ -22,17 +22,40 @@
# Variables / Configuration
#
if( php_sapi_name() != 'cli' ) {
die( "Run me from the command line." );
}
/** Phpdoc script with full path */
$pdExec = '/usr/bin/phpdoc';
#$pdExec = '/usr/bin/phpdoc';
$pdExec = 'phpdoc';
/** Figure out the base directory. This is harder than it should be. */
/** Since we're on the command line, don't trust the PWD! */
$here = null;
$self = $_SERVER['SCRIPT_FILENAME'];
$sep = DIRECTORY_SEPARATOR;
foreach( get_included_files() as $f ) {
if( preg_match( "!^(.*)maintenance$sep$self\$!", $f, $matches ) ) {
$here = $matches[1];
}
}
if( is_null( $here ) ) {
die( "Couldn't determine current directory.\n" );
}
/** where Phpdoc should output documentation */
$pdOutput = '/var/www/mwdoc/';
#$pdOutput = '/var/www/mwdoc/';
$pdOutput = "{$here}{$sep}docs{$sep}html";
/** Some more Phpdoc settings */
$pdOthers = '';
//$pdOthers = ' -dn \'MediaWiki\' ';
$pdOthers .= ' --title \'MediaWiki generated documentation\' -o \'HTML:frames:DOM/earthli\' ';
/** MediaWiki location */
$mwPath = '/var/www/mediawiki/';
/** Mediawiki location */
#$mwPath = '/var/www/mediawiki/';
$mwPath = "{$here}{$sep}";
/** MediaWiki subpaths */
$mwPathI = $mwPath.'includes/';
@ -62,7 +85,11 @@ function readaline( $prompt = '') {
# Main !
#
print <<<END
if( is_array( $argv ) && isset( $argv[1] ) && $argv[1] == '--all' ) {
# Quick option
$input = 0;
} else {
print <<<END
Several documentation possibilities:
0 : whole documentation (1 + 2 + 3)
1 : only includes
@ -70,12 +97,13 @@ Several documentation possibilities:
3 : only skins
4 : only a given file
END;
while ( !is_numeric($input) )
{
$input = readaline( "\nEnter your choice [0]:" );
if($input == '') {
$input = 0;
while ( !is_numeric($input) )
{
$input = readaline( "\nEnter your choice [0]:" );
if($input == '') {
$input = 0;
}
}
}