-
Notifications
You must be signed in to change notification settings - Fork 136
/
release.sh
executable file
·132 lines (112 loc) · 3.67 KB
/
release.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
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
#!/usr/bin/env bash
echo "Export the plugin to a zip with no .git folder"
echo "And build a windows installer"
# Make sure has the proper sub module state
git submodule init
git submodule update
VERSION=`cat metadata.txt | grep ^version | sed 's/version=//g'`
STATUS=`cat metadata.txt | grep ^status | sed 's/status=//g'`
if [ "${STATUS}" != "final" ]; then
VERSION="${VERSION}.${STATUS}"
fi
echo ${VERSION}
#see http://stackoverflow.com/questions/1371261/get-current-working-directory-name-in-bash-script
DIR='inasafe'
OUT="/tmp/${DIR}.${VERSION}.zip"
WORKDIR=/tmp/${DIR}
TARGZFILE="/tmp/${DIR}.tar.gz"
mkdir -p ${WORKDIR}
# Archive source code of the current branch to tar gz file.
# Use git-archive-all since we use git submodule.
brew install git-archive-all
git-archive-all ${TARGZFILE}
# Extract the file
tar -xf ${TARGZFILE} -C ${WORKDIR}
# Remove tar gz file
rm ${TARGZFILE}
rm -rf ${WORKDIR}/${DIR}/docs/en/_static/user*
rm -rf ${WORKDIR}/${DIR}/docs/id/_static/user*
rm -rf ${WORKDIR}/${DIR}/unit_test_data
rm -rf ${WORKDIR}/${DIR}/run*
rm -rf ${WORKDIR}/${DIR}/docs
rm -rf ${WORKDIR}/${DIR}/Vagrantfile
rm -rf ${WORKDIR}/${DIR}/.idea
rm -rf ${WORKDIR}/${DIR}/Makefile
rm -rf ${WORKDIR}/${DIR}/.git*
rm -rf ${WORKDIR}/${DIR}/.scrutinizer.yml
rm -rf ${WORKDIR}/${DIR}/.checkignore.yml
rm -rf ${WORKDIR}/${DIR}/scripts
rm -rf ${WORKDIR}/${DIR}/pylintrc
rm -rf ${WORKDIR}/${DIR}/extras
rm -rf ${WORKDIR}/${DIR}/safe/test
rm -rf ${WORKDIR}/${DIR}/realtime
rm -rf ${WORKDIR}/${DIR}/bin
rm -rf ${WORKDIR}/${DIR}/headless
rm -rf ${WORKDIR}/${DIR}/files
rm -rf ${WORKDIR}/${DIR}/fabfile.py
# Commented out next line for #832 - reinstate when that issue is resolved
#rm -rf ${WORKDIR}/${DIR}/safe_qgis/resources
rm -rf ${WORKDIR}/${DIR}/pylintrc_jenkins
rm -rf ${WORKDIR}/${DIR}/.travis.yml
rm -rf ${WORKDIR}/${DIR}/Dockerfile
rm -rf ${WORKDIR}/${DIR}/docs/README.BEFORE.CHANGING.DOCS.txt
rm -rf ${WORKDIR}/${DIR}/71-apt-cacher-ng
rm -rf ${WORKDIR}/${DIR}/.dockerignore
rm -rf ${WORKDIR}/${DIR}/REQUIREMENTS.txt
find ${WORKDIR}/${DIR} -name test*.py -delete
find ${WORKDIR}/${DIR} -name *_test.py -delete
find ${WORKDIR}/${DIR} -name *.po -delete
find ${WORKDIR}/${DIR} -name *.ts -delete
rm -rf ${WORKDIR}/${DIR}/*.bat
pushd .
cd ${WORKDIR}
find . -name test -exec /bin/rm -rf {} \;
# Compress all images shipped
#for FILE in `find . -type f -name "*.png"`
#do
# echo "Compressing $FILE"
# convert -dither FloydSteinberg -colors 128 $FILE $FILE
#done
# The \* tells zip to ignore recursively
rm ${OUT}
zip -r ${OUT} ${DIR} --exclude \*.pyc \
${DIR}/.git\* \
${DIR}/*.bat \
${DIR}/.gitattributes \
${DIR}/.settings\* \
${DIR}/.pydev\* \
${DIR}/.coverage\* \
${DIR}/.project\* \
${DIR}/.achievements\* \
${DIR}/Makefile \
${DIR}/scripts\* \
${DIR}/impossible_state.* \
${DIR}/riab_demo_data\* \
${DIR}/\*.*~ \
${DIR}/\*test_*.py \
${DIR}/\*.*.orig \
${DIR}/\*.bat \
${DIR}/\*.xcf \
${DIR}/\.tx\* \
${DIR}/\*.sh \
${DIR}/\Vagrantfile \
${DIR}/~
popd
#rm -rf ${WORKDIR}
echo "Your plugin archive has been generated as"
ls -lah ${OUT}
echo "${OUT}"
# For nsis installer
brew install rpl
brew install makensis
cp scripts/windows-install-builder.nsi scripts/build.nsi
rpl "[[VERSION]]" "${VERSION}" scripts/build.nsi
rm -rf /tmp/nsis-data
mv ${WORKDIR} /tmp/nsis-data
makensis scripts/build.nsi
rm scripts/build.nsi
mv scripts/*.exe /tmp
echo "NSIS Installer created in /tmp/"
ls /tmp/InaSAFE*.exe
make test-translations
make flake8