summaryrefslogtreecommitdiff
path: root/buildscripts/PhpDocumentor/pear-phpdoc.bat
blob: 04e3bcc3293f9f397a8446d6ec707b917c08d55c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@ECHO OFF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Batch file to start phpDocumentor with PHP's CLI
::
:: This SW was contributed by BlueShoes www.blueshoes.org "The PHP Framework"
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::----------------------------------------------------------------------------------
:: Please set following to PHP's CLI
:: NOTE: In PHP 4.2.x the PHP-CLI used to be named php-cli.exe. 
::       PHP 4.3.x names it php.exe but stores it in a subdir called /cli/php.exe
::       E.g. for PHP 4.2 C:\phpdev\php-4.2-Win32\php-cli.exe
::            for PHP 4.3 C:\phpdev\php-4.3-Win32\cli\php.exe
  
  SET phpCli=@PHP-BIN@



::---------------------------------------------------------------------------------
::---------------------------------------------------------------------------------
:: Do not modify below this line!! (Unless you know what your doing :)
::---------------------------------------------------------------------------------
::---------------------------------------------------------------------------------

:: Only show this intro when no options are passed
IF '%1'=='' (
  ECHO ******************************************************************************
  ECHO * PhpDocument Command-Line  Starter 
  ECHO * 
  ECHO * phpDocumentor is a JavaDoc-like automatic documentation generator for PHP
  ECHO * written in PHP. It is the most versatile tool for documenting PHP.
  ECHO *
  ECHO * This batch-file will try to run the phpDocumentor using the command-line
  ECHO * version of PHP4. NOTE: It will not run with the PHP ISAPI module! 
  ECHO * Please update the path in this batch-file to your PHP-CLI.
  ECHO *
  ECHO * Tip: o Grab a copy of one of the ini-files in the user/ dir of the 
  ECHO *        phpDocumentor and modify the settings there. 
  ECHO *      o To see the command line options type  phpdoc -h
  ECHO * 
  ECHO * @version 1.3  2003-06-28
  ECHO * @author Sam Blum sam@blueshoes.org
  ECHO * @Copyright Free Software released under the GNU/GPL license
  ECHO * 
  ECHO * This SW was contributed by BlueShoes www.blueshoes.org "The PHP Framework"
  ECHO ******************************************************************************
)

:: Check existence of php.exe
IF EXIST "%phpCli%" (
  SET doNothing=
) ELSE GOTO :NoPhpCli

:: If called using options, just call phpdoc and end after without pausing.
:: This will allow use where pausing is not wanted.
IF '%1'=='' (
  SET doNothing=
) ELSE (
  "%phpCli%" "@BIN-DIR@\phpdoc" %*
  GOTO :EOF
)


SET iniFile=

ECHO ------------------------------------------------------------------------------
ECHO Select Ini-File [default is phpDocumentor.ini]
ECHO ------------------------------------------------------------------------------
ECHO # 0: phpDocumentor.ini
SET count=0
FOR /R "@DATA-DIR@\PhpDocumentor\user" %%I IN (*.ini) DO (
  SET /a count+=1
  CALL :exec ECHO # %%count%%: %%~nI%%~xI
)

:LOOP_1
:: SET /P prompts for input and sets the variable
:: to whatever the user types
SET iniNr=
SET /P iniNr=Type a number and press Enter[0]:

::  Use default
IF '%iniNr%'=='' (
  SET iniNr=0
)

:: Check for default selection
SET iniFile=phpDocumentor.ini
IF %iniNr%==0 (
  CALL :exec GOTO :run
  GOTO :PAUSE_END
)

:: Check selected
SET count=0
SET found=
FOR /R "@DATA-DIR@\PhpDocumentor\user" %%I IN (*.ini) DO (
  SET /a count+=1
  SET iniFile=%%~nI%%~xI
  CALL :exec IF '%%iniNr%%'=='%%count%%' GOTO :run 
)

:: Check if selected # was found
IF '%found%'=='' (
  ECHO Invalid input [%iniNr%]... try again
  ECHO.
  GOTO :LOOP_1
)

::
:: php.exe not found error  
GOTO :PAUSE_END
:NoPhpCli
ECHO ** ERROR *****************************************************************
ECHO * Sorry, can't find the php.exe file.
ECHO * You must edit this file to point to your php.exe (CLI version!)
ECHO *    [Currently set to %phpCli%]
ECHO * 
ECHO * NOTE: In PHP 4.2.x the PHP-CLI used to be named php-cli.exe. 
ECHO *       PHP 4.3.x renamed it php.exe but stores it in a subdir 
ECHO *       called /cli/php.exe
ECHO *       E.g. for PHP 4.2 C:\phpdev\php-4.2-Win32\php-cli.exe
ECHO *            for PHP 4.3 C:\phpdev\php-4.3-Win32\cli\php.exe
ECHO **************************************************************************

::
:: Stupid MS-batch: Can't evaluate environment variable inside a FOR loop!!! :((  
GOTO :PAUSE_END
:exec 
%*
GOTO :EOF

::
:: Start the phpDocumentor 
GOTO :PAUSE_END
:run
SET found=1
ECHO Starting: "%phpCli%" "@BIN-DIR@\phpdoc" -c "%iniFile%"
ECHO.
"%phpCli%" "@BIN-DIR@\phpdoc" -c "%iniFile%"
GOTO :EOF

:PAUSE_END
PAUSE