-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-zip.sh
executable file
·81 lines (65 loc) · 2.07 KB
/
make-zip.sh
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
#!/bin/bash
# ensure tool finds shrinksafe
export PATH=/usr/local/bin:$PATH
######
##
## Usage:
## do_shirnk file.js
##
######
function do_shrink {
# write release version
sed 's/Vortex.log \(.*\);//g' $1 | sed 's/Vortex.log2 \(.*\);//g' | sed 's/Vortex.warn \(.*\);//g' | sed 's/Vortex.error \(.*\);//g' | sed 's/singleFile : false/singleFile : true/g' | shrinksafe >> ${DEST}/Vortex.js
if [ "$?" != "0" ]; then
echo "Failure found during compression, error code was: $?"
exit -1
fi
# write debug version
sed 's/singleFile : false/singleFile : true/g' $1 | shrinksafe >> ${DEST}/Vortex.debug.js
if [ "$?" != "0" ]; then
echo "Failure found during compression, error code was: $?"
exit -1
fi
return;
}
if [ -n "$1" ]; then
COPY_DIR="$1/"
fi
# update version
python ./prepare-version.py
# acquire current version
jsvortex_version=`cat VERSION`
# create temporal link to simulate release directory
DEST=jsVortex-${jsvortex_version}
mkdir ${DEST}
echo "Creating content into ${DEST}"
cp -v doc/COPYING.txt ${DEST}/COPYING.txt
cp -v README ${DEST}/README
cp -v socket-connector/JavaSocketConnector.jar ${DEST}/
shrinksafe socket-connector/JavaSocketConnector.js > ${DEST}/JavaSocketConnector.js
# prepare shrink-safe: do initial file changing loading style
do_shrink src/Vortex.js
# now append rest of files
do_shrink src/VortexConnection.js
do_shrink src/VortexEngine.js
do_shrink src/VortexChannel.js
do_shrink src/VortexTCPTransport.js
do_shrink src/VortexXMLEngine.js
do_shrink src/VortexSASLEngine.js
do_shrink src/VortexFrame.js
do_shrink src/VortexSASLEnginePlain.js
do_shrink src/VortexSASLEngineAnonymous.js
do_shrink src/VortexMimeHeader.js
# ensure right permissions
chmod 644 ${DEST}/*.{js,txt,jar} ${DEST}/README
zip -q jsVortex-${jsvortex_version}.zip ${DEST}/*.{js,txt,jar} ${DEST}/README
# copy files if defined
if [ -n "${COPY_DIR}" ]; then
echo "Copying to ${COPY_DIR}, listing source"
ls -la ${DEST}
echo "Copying.."
cp -v ${DEST}/* ${COPY_DIR}
fi
rm -rf ${DEST}
# report file created
echo "jsVortex-${jsvortex_version}.zip"