diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-12-05 20:55:08 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-12-05 20:55:08 -0500 |
commit | 2c6d810411820fe5fc0826e37d2d663f7e579f30 (patch) | |
tree | 8938f7fa5185afc0da804a749d036bf87daad4bf | |
parent | 1a75d1118fceb9f36284911fd53bbd360b04a5de (diff) |
Improve make-archive.sh
-rwxr-xr-x | scripts/make-archive.sh | 69 |
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 |