-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.bat
More file actions
104 lines (80 loc) · 3.01 KB
/
Copy pathmake.bat
File metadata and controls
104 lines (80 loc) · 3.01 KB
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
Rem Set package name based on the current directory
FOR %%I IN (.) DO SET PACKAGE_NAME="dev.dmedia.unix.bbcode"
Rem Extract version number from package.xml
FOR /f "delims=" %%a in ('findstr /i /l /c:"<version>" "package.xml"') DO SET "PACKAGE_VERSION=%%a"
SET "PACKAGE_VERSION=%PACKAGE_VERSION:*<version>=%"
FOR /f "delims=<" %%a in ("%PACKAGE_VERSION%") DO SET "PACKAGE_VERSION=%%a"
Rem Replace spaces with underscores
SET PACKAGE_VERSION=%PACKAGE_VERSION: =_%
Rem Replace uppercase letters to lowercase (supports the words "alpha", "beta", "dev", "pl" & "rc"
FOR %%a IN ("A=a" "B=b" "C=c" "D=d" "E=e" "H=h" "L=l" "M=m" "P=p" "R=r" "T=t" "V=v") DO (
CALL SET PACKAGE_VERSION=%%PACKAGE_VERSION:%%~a%%
)
Rem Delete files*.tar if present
IF EXIST files*.tar (
del files*.tar
)
Rem Delete templates*.tar if present
IF EXIST templates*.tar (
del templates*.tar
)
Rem Delete acptemplates*.tar if present
IF EXIST acptemplates*.tar (
del acptemplates*.tar
)
Rem Delete PACKAGE_NAME*.tar if present
IF EXIST %PACKAGE_NAME%*.tar (
del %PACKAGE_NAME%*.tar
)
Rem Delete PACKAGE_NAME*.tar.gz if present
IF EXIST %PACKAGE_NAME%*.tar.gz (
del %PACKAGE_NAME%*.tar.gz
)
Rem Compress files directory if present
IF EXIST files (
7z.exe a -ttar -mx=9 files.tar .\files\*
)
Rem Compress files_update directory if present
IF EXIST files_update (
7z.exe a -ttar -mx=9 files_update.tar .\files_update\*
)
Rem Compress templates directory if present
IF EXIST templates (
7z.exe a -ttar -mx=9 templates.tar .\templates\*
)
Rem Compress templates_update directory if present
IF EXIST templates_update (
7z.exe a -ttar -mx=9 templates_update.tar .\templates_update\*
)
Rem Compress acptemplates directory if present
IF EXIST acptemplates (
7z.exe a -ttar -mx=9 acptemplates.tar .\acptemplates\*
)
Rem Compress acptemplates_update directory if present
IF EXIST acptemplates_update (
7z.exe a -ttar -mx=9 acptemplates_update.tar .\acptemplates_update\*
)
Rem Create PACKAGE_NAME.tar
7z.exe a -ttar -mx=9 %PACKAGE_NAME%_v%PACKAGE_VERSION%.tar .\* -x!acptemplates -x!acptemplates_update -x!files -x!files_update -x!templates -x!templates_update -x!%PACKAGE_NAME%.tar -x!.git -x!.github -x!.gitignore -x!make.bat -x!make.sh -x!.vscode -x!.idea -x!constants.php -x!README.md -x!LICENSE -x!.phpcs.xml -x!.php-cs-fixer.dist.php -x!.php-cs-fixer.cache -x!tsconfig.json -x!ts -x!tsconfig.json -x!.prettierrc -x!.eslintrc.js -x!-eslintignore -x!node_modules -x!.eslintignore -x!.gitattributes -x!package.json -x!package-lock.json
timeout 1 >nul
Rem Create PACKAGE_NAME.tar.gz
7z.exe a -tgzip %PACKAGE_NAME%_v%PACKAGE_VERSION%.tar.gz %PACKAGE_NAME%_v%PACKAGE_VERSION%.tar
timeout 1 >nul
Rem Delete files*.tar if present
IF EXIST files*.tar (
del files*.tar
)
Rem Delete templates*.tar if present
IF EXIST templates*.tar (
del templates*.tar
)
Rem Delete acptemplates*.tar if present
IF EXIST acptemplates*.tar (
del acptemplates*.tar
)
timeout 1 >nul
Rem Delete PACKAGE_NAME*.tar if present
IF EXIST %PACKAGE_NAME%*.tar (
del %PACKAGE_NAME%*.tar
)