summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/make-archive.sh69
1 files changed, 50 insertions, 19 deletions
diff --git a/scripts/make-archive.sh b/scripts/make-archive.sh
index 0993092b..14f21c2b 100755
--- a/scripts/make-archive.sh
+++ b/scripts/make-archive.sh
@@ -1,30 +1,61 @@
#!/bin/sh
-VERSION=$1
+if [ "$#" -lt 1 ]
+then
+ echo "Usage: $0 <version> [destination]"
+ exit 1
+fi
+
APP="kanboard"
+VERSION=$1
+DESTINATION=$2
-cd /tmp
-rm -rf /tmp/$APP /tmp/$APP-*.zip 2>/dev/null
+if [ -z "$2" ]
+then
+ DESTINATION=~/Devel/websites/$APP
+fi
-git clone --depth 1 https://github.com/fguillot/$APP.git
+echo "Build package for version $VERSION => $DESTINATION"
-rm -rf $APP/data/*.sqlite \
- $APP/.git $APP/.gitignore \
- $APP/scripts \
- $APP/tests \
- $APP/Vagrantfile \
- $APP/.*.yml \
- $APP/README.markdown \
- $APP/docs \
- $APP/Dockerfile
+# Cleanup
+rm -rf /tmp/$APP /tmp/$APP-*.zip 2>/dev/null
-sed -i.bak s/master/$VERSION/g $APP/app/constants.php && rm -f $APP/app/*.bak
-zip -r $APP-$VERSION.zip $APP
+# Download source code
+cd /tmp
+git clone --depth 1 -q https://github.com/fguillot/$APP.git >/dev/null
+
+# Install vendors
+cd /tmp/$APP
+composer --prefer-dist --no-dev --optimize-autoloader --quiet install
+
+# Remove useless files
+rm -rf data/*.sqlite \
+ .git \
+ .gitignore \
+ scripts \
+ tests \
+ Vagrantfile \
+ .*.yml \
+ README.markdown \
+ docs \
+ Dockerfile \
+ composer.*
+
+# Set the version number
+sed -i.bak s/master/$VERSION/g app/constants.php && rm -f app/*.bak
+
+# Make the archive
+cd /tmp
+zip -r $APP-$VERSION.zip $APP > /dev/null
+mv $APP-$VERSION.zip $DESTINATION
-mv $APP-$VERSION.zip ~/Devel/websites/$APP
+cd $DESTINATION
-cd ~/Devel/websites/$APP/
-unlink $APP-latest.zip
-ln -s $APP-$VERSION.zip $APP-latest.zip
+# Make symlink for generic archive
+if [ -L $APP-latest.zip ]
+then
+ unlink $APP-latest.zip
+ ln -s $APP-$VERSION.zip $APP-latest.zip
+fi
rm -rf /tmp/$APP 2>/dev/null