Skip to content

Commit b11006b

Browse files
committed
fbforum: add ./pack.sh tool
pack the fbforum repository for deployment usage: ./pack.sh [ branch [ prefix ] ] if prefix not given, default is 'fbtest' if branch not given, default is 'master'
1 parent 4991471 commit b11006b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

pack.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# pack the fbforum repository for deployment
4+
#
5+
# usage: ./pack.sh [ branch [ prefix ] ]
6+
#
7+
# if prefix not given, default is 'fbtest'
8+
# if branch not given, default is 'master'
9+
#
10+
set -e
11+
12+
if [ -z "$1" ] ; then
13+
BRANCH=master
14+
else
15+
BRANCH=$1
16+
fi
17+
18+
TODAY=`date +%Y%m%d`
19+
20+
if [ -z "$2" ] ; then
21+
PACKFILE="fbtest-${TODAY}-forum-${BRANCH}"
22+
else
23+
PACKFILE="$2-${TODAY}-forum-${BRANCH}"
24+
fi
25+
26+
echo "packaging: ${PACKFILE}.tar.gz"
27+
git -c core.autocrlf=false archive --format tar --prefix "${PACKFILE}/" "${BRANCH}" | tar xf -
28+
tar --exclude=".gitignore" -czf "../${PACKFILE}.tar.gz" "${PACKFILE}"
29+
rm -rf "${PACKFILE}"
30+
31+
echo "packaging: ${PACKFILE}.zip"
32+
git -c core.autocrlf=true archive --format tar --prefix "${PACKFILE}/" "${BRANCH}" | tar xf -
33+
zip -x ".gitignore" -q -r "../${PACKFILE}.zip" "${PACKFILE}"
34+
rm -rf "${PACKFILE}"

0 commit comments

Comments
 (0)