This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
phpmetrics.bat
90 lines (65 loc) · 2 KB
/
phpmetrics.bat
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
@ECHO OFF
REM Author : AVONTURE Christophe
setlocal enabledelayedexpansion enableextensions
REM Define global variables
SET PROGNAME=PHPMetrics
SET GITHUB=https://github.com/phpmetrics/PhpMetrics
SET COMPOSER=phpmetrics/phpmetrics
SET SCRIPT=%APPDATA%\Composer\vendor\bin\phpmetrics.bat
SET BATCH=%~n0%~x0
CLS
ECHO =================================================
ECHO = Running %PROGNAME% =
ECHO = Static analysis tool for PHP =
ECHO = @see %GITHUB% =
ECHO =================================================
ECHO.
IF "%1"=="/?" GOTO :HELP
if "%1"=="-?" GOTO :HELP
if "%1"=="-h" GOTO :HELP
IF NOT EXIST %SCRIPT% (
GOTO NOTINSTALLED:
)
CALL :fnProcessFolder %cd%
GOTO END:
::--------------------------------------------------------
::-- fnProcessFolder - Process a given folder
::--------------------------------------------------------
:fnProcessFolder
ECHO Process folder %1
ECHO.
REM Define the name for the output folder
SET outputFolder=%tmp%\%PROGNAME%
REM Remove previous file just to be sure that an old version won't remains
IF EXIST %outputFolder% (
DEL /Q /S %outputFolder%\*.* > NUL
)
REM ECHO Command line options are
ECHO %1 (scanned folder)
ECHO --report-html=%outputFolder% (output folder)
ECHO.
CALL %SCRIPT% %1 --report-html=%outputFolder%
START chrome.exe %outputFolder%\index.html
GOTO:EOF
::--------------------------------------------------------
::-- Not installed
::--------------------------------------------------------
:NOTINSTALLED
ECHO %PROGNAME% (%GITHUB%) is not installed
ECHO on your machine. Please run the following command from a DOS prompt:
ECHO.
ECHO composer global require %COMPOSER%
ECHO.
ECHO After a while, the program will be installed in your %APPDATA%\Composer folder.
GOTO END:
::--------------------------------------------------------
::-- Show help instructions
::--------------------------------------------------------
:HELP
ECHO %BATCH% [-h]
ECHO.
ECHO -h : to get this screen
GOTO END:
:END
ECHO.
ECHO End