-
Notifications
You must be signed in to change notification settings - Fork 0
/
-apicra.bat
159 lines (159 loc) · 3.96 KB
/
-apicra.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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
::::::::::::::::::::::::::::::::::::::::::
:: manager for apicra, gitst on github ::
:: author: Tom Sapletta ::
:: url: https://apicra.com/ ::
::::::::::::::::::::::::::::::::::::::::::
@echo off
:: Variables
set PARAM=%~1
set MODULE=%~2
set OS=win
set APICRA_PATH=.apicra
set CMD=.apicra.bat
set NAME=Apicra
set APICRA_CONFIG=apicra.txt
:: get Variable from File
IF "%PARAM%"=="" GOTO help
::
:: config
if "%PARAM%"=="c" GOTO config
if "%PARAM%"=="config" GOTO config
:: install
if "%PARAM%"=="i" GOTO install
if "%PARAM%"=="install" GOTO install
:: reinstall
if "%PARAM%"=="r" GOTO reinstall
if "%PARAM%"=="reinstall" GOTO reinstall
:: delete
if "%PARAM%"=="d" GOTO delete
if "%PARAM%"=="delete" GOTO delete
:: update
if "%PARAM%"=="u" GOTO update
if "%PARAM%"=="update" GOTO update
::
:help
echo %CMD% exist
echo %CMD% config
echo %CMD% install
echo %CMD% install "modulname"
echo %CMD% reinstall
echo %CMD% delete
echo %CMD% delete "modulname"
GOTO end
::
:exist
IF EXIST ".apicra" (
ECHO true
) ELSE (
ECHO false
)
GOTO end
::
:reinstall
echo :: "Do you really want delete the whole apicra modules and projects?
RMDIR /Q/S %APICRA_PATH% && echo :: %NAME% :: %APICRA_PATH% :: Folder is deleted
del /f %APICRA_CONFIG% && echo :: %NAME% :: %APICRA_CONFIG% :: Config file is deleted
GOTO install
::
:install
echo ::
echo :: Apicra :: Install
IF NOT "%MODULE%"=="" GOTO install_module_shortcut
IF EXIST %APICRA_PATH% (
IF EXIST %APICRA_CONFIG% GOTO install_module_from_config
echo :: %NAME% :: Path not exist
GOTO help
)
::mkdir .apicra
echo .apicra/ >> .gitignore
git clone https://github.com/apicra/npm-github-win.git .apicra && echo :: %NAME% :: is installed
IF EXIST %APICRA_CONFIG% (
echo :: %NAME% :: Installation of all modules from config file %APICRA_CONFIG%
GOTO install_module_from_config
) ELSE (
echo :: %NAME% :: Config not exist
GOTO config
)
::
:: script to use in root tree of project as module shortcut, e.g: -github.bat, -ticket.bat, -version.bat
:: Install for defined module or for all
:: if no params then all modules shortcuts
:: if param then current
:install_module_shortcut
echo ::
IF EXIST -%MODULE%.bat (
echo :: %NAME% :: %MODULE% :: Module shortcut is Not Created, because existed ::
) ELSE (
echo :: %NAME% :: %MODULE% :: Module shortcut is Created ::
echo @echo off > -%MODULE%.bat
echo .apicra\-project.bat %MODULE% %%1 %%2 %%3 >> -%MODULE%.bat
)
GOTO install_module
::
:delete_module_shortcut
echo ::
echo :: %NAME% :: %MODULE% :: module shortcut is deleted ::
del -%MODULE%.bat
GOTO delete_module
::
:update_shortcut
echo ::
:: Install for defined module or for all
GOTO end
::
:install_module
echo ::
IF EXIST .apicra\module\%MODULE% (
echo :: %NAME% :: %MODULE% :: Module is Existing
GOTO end
)
.apicra\-module.bat install %MODULE%
GOTO install_shortcut
::
:install_module_from_config
echo ::
echo :: %NAME% :: %MODULE% :: Install modules from config file
for /f "delims==" %%a in (%APICRA_CONFIG%) do .apicra\-module.bat install %%a
GOTO install_shortcut
::
:config
echo ::
IF EXIST %APICRA_CONFIG% GOTO end
echo github > %APICRA_CONFIG% && echo :: %NAME% :: %MODULE% :: apicra.txt config file is created
GOTO end
::
:update
echo ::
git -C .apicra pull origin master && echo %NAME% :: %MODULE% :: %NAME% is updated
GOTO end
::
:download_power
echo ::
powershell -Command "Invoke-WebRequest https://raw.githubusercontent.com/tom-sapletta-com/do/master/install.bat -OutFile install.bat"
GOTO end
::
:download_curl
echo ::
.apicra/curl
GOTO end
::
:delete
echo ::
echo :: %NAME% :: %MODULE% :: Deleting Module
IF NOT "%MODULE%"=="" GOTO delete_module_shortcut
IF NOT EXIST %APICRA_PATH% (
echo :: %NAME% :: %APICRA_PATH% :: Path not exist
GOTO help
)
echo "Do you really wan't delete the whole apicra modules and projects?
pause
RMDIR /Q/S .apicra && echo %NAME% :: %MODULE% :: folder is deleted ::
::del /f apicra.txt && echo %NAME% config file is deleted
GOTO end
::
:delete_module
echo ::
.apicra/-module.bat delete %MODULE%
GOTO end
::
:end