-
Notifications
You must be signed in to change notification settings - Fork 10
/
create_dist.sh
executable file
·75 lines (55 loc) · 1.67 KB
/
create_dist.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
#!/usr/bin/env bash
# source repo
SOURCEPATH=${1}
# output folder no trailing slashes
OUTPUT=${2}
# Version number
version=${3}
if [ -z "$SOURCEPATH" ]
then
echo "No source folder given"
exit 0
fi
if [ -z "$OUTPUT" ]
then
echo "No output folder given"
exit 0
fi
if [ -z "$version" ]
then
echo "Version number not given"
exit 0
fi
# tempoary file location
temp=$(mktemp -d -t ci-XXXXXXXXXX)
# get variables
path=${SOURCEPATH}
zpath=${temp}/wfexpenses
output=${OUTPUT}/
fname=wfexpenses${version}
cd ${path}
echo "Running grunt updating scripts"
npm test
echo "Creating temp project"
mkdir -p ${temp}
cp -R ${path} ${temp}/${fname}
cd "${temp}"
echo "Coping files to temp"
cp -f ${fname}/index-production.php ${fname}/index.php
cp -f ${fname}/protected/config/database-copy.php ${fname}/protected/config/database.php
rm -r ${fname}/assets/*
rm -r ${fname}/backup/*
rm -r ${fname}/temp/*
rm -r ${fname}/protected/runtime/*
rm -r ${fname}/protected/controllers/TestController.php # remove test controller
cd "${temp}" ..
echo "Creating archive"
tar --force-local -rf ${output}wfexpenses${version}.tar ${fname}/assets ${fname}/images ${fname}/protected
tar --force-local -rf ${output}wfexpenses${version}.tar ${fname}/public ${fname}/screenshots ${fname}/sql
tar --force-local -rf ${output}wfexpenses${version}.tar ${fname}/yii ${fname}/index.php ${fname}/README.md
tar --force-local -rf ${output}wfexpenses${version}.tar ${fname}/.htaccess ${fname}/icon.ico ${fname}/backup ${fname}/temp
gzip -f ${output}wfexpenses${version}.tar
echo "Archive creation complete"
echo "Cleaning up assets"
rm -rf ${temp}/${fname}/
echo "All done... You can close this window"