forked from ushahidi/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease
More file actions
executable file
·82 lines (66 loc) · 1.9 KB
/
release
File metadata and controls
executable file
·82 lines (66 loc) · 1.9 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
#!/bin/bash
# if someone invokes this with bash
set -e
# build release tarball
usage() {
echo usage: $0 VERSION
exit 2
}
test $# -eq 1 || usage
VERSION=$1
CWD=$(pwd)
TMP_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t platform-build)
WORK_DIR=$TMP_DIR/ushahidi-platform-bundle-${VERSION}
mkdir $WORK_DIR
if [ -z "$DEST_DIR" ]; then
DEST_DIR="${CWD}/build"
fi
echo "Copy to temp dir"
cp -R ./ $WORK_DIR
pushd $WORK_DIR
if [ -d "./.git" ]; then
echo "Clean out extra files"
git clean -fdx
fi
popd
pushd $TMP_DIR
# Tar it up.
echo "Building tarball"
if [ ! -d "$DEST_DIR" ]; then
mkdir -p "$DEST_DIR"
fi
TARFILE="${DEST_DIR}/ushahidi-platform-bundle-${VERSION}.tar"
tar -cf $TARFILE \
--exclude 'application/cache' \
--exclude 'application/logs' \
--exclude 'application/media/uploads' \
--exclude 'application/config/environments' \
--exclude 'application/routes' \
--exclude '.htaccess' \
--exclude 'build' \
--exclude 'application/tests' \
--exclude 'spec' \
--exclude '.phpspec' \
--exclude '.travis.yml' \
--exclude '.librarian' \
--exclude '.vagrant' \
--exclude '.tmp' \
--exclude 'phpspec.yml.dist' \
--exclude 'behat.yml.dist' \
--exclude 'phpunit.xml.dist' \
--exclude '.arc*' \
--exclude '.git' \
--exclude '.git*' \
ushahidi-platform-bundle-${VERSION}/
# Add extra file that would have been excluded otherwise
tar -rf $TARFILE \
ushahidi-platform-bundle-${VERSION}/application/cache/.gitignore \
ushahidi-platform-bundle-${VERSION}/application/logs/.gitignore \
ushahidi-platform-bundle-${VERSION}/application/media/uploads/.gitignore \
ushahidi-platform-bundle-${VERSION}/application/config/environments/development/.gitignore \
ushahidi-platform-bundle-${VERSION}/application/routes/default.php
gzip -f $TARFILE
echo "Release tarball: ${TARFILE}.gz"
ls -la ${TARFILE}.gz
popd
rm -rf $TMP_DIR