-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfjarsoap.bat
102 lines (101 loc) · 2.69 KB
/
cfjarsoap.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
91
92
93
94
95
96
97
98
99
100
101
102
@echo off
set CFDISTRO_HOME=%userprofile%\cfdistro
set FILE_URL="http://cfmlprojects.org/artifacts/cfdistro/latest/cfdistro.zip"
set FILE_DEST=%CFDISTRO_HOME%\cfdistro.zip
set buildfile=build/build.xml
set ANT_HOME=%CFDISTRO_HOME%\ant
set ANT_CMD=%CFDISTRO_HOME%\ant\bin\ant.bat
if not exist "%CFDISTRO_HOME%" (
mkdir "%CFDISTRO_HOME%"
)
if not exist "%FILE_DEST%" (
echo Downloading with powershell: %FILE_URL% to %FILE_DEST%
powershell.exe -command "$webclient = New-Object System.Net.WebClient; $url = \"%FILE_URL%\"; $file = \"%FILE_DEST%\"; $webclient.DownloadFile($url,$file);"
echo Expanding with powershell to: %CFDISTRO_HOME%
powershell -command "$shell_app=new-object -com shell.application; $zip_file = $shell_app.namespace(\"%FILE_DEST%\"); $destination = $shell_app.namespace(\"%CFDISTRO_HOME%\"); $destination.Copyhere($zip_file.items())"
) else (
echo "cfdistro.zip already downloaded, delete to re-download"
)
if "%1" == "" goto MENU
set args=%1
SHIFT
:Loop
IF "%1" == "" GOTO Continue
SET args=%args% -D%1%
SHIFT
IF "%1" == "" GOTO Continue
SET args=%args%=%1%
SHIFT
GOTO Loop
:Continue
if not exist %buildfile% (
set buildfile="%CFDISTRO_HOME%\build.xml"
)
call "%ANT_CMD%" -nouserlib -f %buildfile% %args%
goto end
:MENU
cls
echo.
echo cfjarsoap menu
REM echo usage: cfjarsoap.bat [start|stop|{target}]
echo.
echo 1. Start server and open browser
echo 2. Stop server
echo 3. List available targets
echo 4. Update project
echo 5. Run Target
echo 6. Quit
echo.
set choice=
set /p choice= Enter option 1, 2, 3, 4, 5 or 6 :
echo.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto startServer
if '%choice%'=='2' goto stopServer
if '%choice%'=='3' goto listTargets
if '%choice%'=='4' goto updateProject
if '%choice%'=='5' goto runTarget
if '%choice%'=='6' goto end
::
echo.
echo.
echo "%choice%" is not a valid option - try again
echo.
pause
goto MENU
::
:startServer
cls
call "%ANT_CMD%" -nouserlib -f %buildfile% build.start.launch
echo to stop the server, run this again or run: cfjarsoap.bat stop
goto end
::
:stopServer
call "%ANT_CMD%" -nouserlib -f %buildfile% server.stop
goto end
::
:listTargets
call "%ANT_CMD%" -nouserlib -f %buildfile% help
echo press any key ...
pause > nul
goto MENU
::
:updateProject
call "%ANT_CMD%" -nouserlib -f %buildfile% project.update
echo press any key ...
pause > nul
goto MENU
::
:runTarget
set target=
set /p target= Enter target name:
if not "%target%"=="" call %0 %target%
echo press any key ...
pause > nul
goto MENU
::
:end
set choice=
echo press any key ...
pause
REM EXIT