This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkettle_launcher.bat
104 lines (85 loc) · 2.52 KB
/
kettle_launcher.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
103
104
@echo off
setlocal enabledelayedexpansion
set KETTLE_D=%CD%\Kettle
set CURRENT_DIR=%CD%
set USER_DIR=%UserProfile%
set /A COUNTER=0
set /A COUNTER2=0
echo Projects
echo -----------------------
echo.
FOR /D %%i in (*.*) DO (
IF NOT %%i==Kettle (
set /A COUNTER+=1
echo !COUNTER!: %%i
set PROJECTLIST[!COUNTER!]=%%i
)
)
IF %COUNTER%==0 (
echo ERROR:No Projects found!
pause
exit
)
set /p PROJECTNUM="Choose Project:" %=%
echo.
set PROJECTNAME=!PROJECTLIST[%PROJECTNUM%]!
IF EXIST .\%PROJECTNAME%\config.cfg (
FOR /F "tokens=1* delims==" %%i IN (.\%PROJECTNAME%\config.cfg) DO set "prop_%%i=%%j"
set PROJECT_DIR=%CURRENT_DIR%\%PROJECTNAME%
echo kettle version: !prop_KETTLE_VERSION!
goTo:launch
) ELSE (
cd "%PROJECTNAME%"
echo Subprojecs/Environment
echo -----------------------
echo.
FOR /D %%i in (*.*) DO (
IF NOT %%i==Kettle (
set /A COUNTER2+=1
echo !COUNTER2!: %%i
set ENVLIST[!COUNTER2!]=%%i
)
)
)
IF %COUNTER2%==0 (
echo ERROR:No Environments found!
pause
exit
)
set /p ENVNUM="Choose Environment:" %=%
echo.
set ENVNAME=!ENVLIST[%ENVNUM%]!
IF EXIST .\%ENVNAME%\config.cfg (
FOR /F "tokens=1* delims==" %%i IN (.\%ENVNAME%\config.cfg) DO set "prop_%%i=%%j"
set PROJECT_DIR=%CURRENT_DIR%\%PROJECTNAME%/%ENVNAME%
echo kettle version: !prop_KETTLE_VERSION!
) ELSE (
echo "ERROR: Not a Valid project/environment (is there a config.cfg file ?)"
)
:launch
IF DEFINED prop_KETTLE_VERSION (
set KETTLE_HOME=%PROJECT_DIR%
IF EXIST %KETTLE_D%\%prop_KETTLE_VERSION% (
IF EXIST %PROJECT_DIR%\jdbc.properties (
copy /y "%PROJECT_DIR%\jdbc.properties" "%KETTLE_D%\%prop_KETTLE_VERSION%\simple-jndi\jdbc.properties"
) ELSE (
echo INFO: no JDBC file found creating empty file
IF EXIST "%KETTLE_D%\%prop_KETTLE_VERSION%\simple-jndi\jdbc.properties" (
del /Q "%KETTLE_D%\%prop_KETTLE_VERSION%\simple-jndi\jdbc.properties"
copy /y NUL "%KETTLE_D%\%prop_KETTLE_VERSION%\simple-jndi\jdbc.properties"
)
)
IF EXIST %PROJECT_DIR%\pwd (
del /Q "%KETTLE_D%\%prop_KETTLE_VERSION%\pwd"
copy /y "%PROJECT_DIR%\pwd" "%KETTLE_D%\%prop_KETTLE_VERSION%\pwd"
) ELSE (
echo INFO: no Carte configuration found will use what is present in kettle directory
)
CD %KETTLE_D%\%prop_KETTLE_VERSION%\
CALL spoon.bat
) ELSE (
echo ERROR: The specified kettle version %prop_KETTLE_VERSION% does not exist in the Kettle folder
)
) ELSE (
echo ERROR: no KETTLE_VERSION specified in config.cfg
)