From 1a378e3ccabaf94e8857af1a0c874cb867137b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Laxstr=C3=B6m?= Date: Fri, 15 Apr 2016 07:47:23 +0200 Subject: [PATCH] Update upstream update scripts * Allow to run any directory * Leaving stuff on /tmp was not nice * Git pull was run on wrong directory Change-Id: Ia7f82de55c9bd446c29afc0684660ed00b6585bf --- scripts/update-jquery-i18n.sh | 25 +++++++++++++---------- scripts/update-jquery-ime.sh | 33 +++++++++++++++++++------------ scripts/update-jquery-uls.sh | 25 +++++++++++++---------- scripts/update-jquery-webfonts.sh | 25 +++++++++++++---------- 4 files changed, 65 insertions(+), 43 deletions(-) diff --git a/scripts/update-jquery-i18n.sh b/scripts/update-jquery-i18n.sh index 537164be..e96d1ca3 100755 --- a/scripts/update-jquery-i18n.sh +++ b/scripts/update-jquery-i18n.sh @@ -1,17 +1,22 @@ #!/bin/bash -DEST="../lib/jquery.i18n"; -CLONEDIR="/tmp/jquery.i18n"; -HERE=$(pwd); -UPSTREAM="https://github.com/wikimedia/jquery.i18n.git"; +BASEDIR=$(dirname "$0") +BASEDIR="$BASEDIR/.." -echo -e "Getting latest jquery.i18n from $UPSTREAM\n"; +DEST="$BASEDIR/lib/jquery.i18n" +CLONEDIR="$BASEDIR/vendor/jquery.i18n" -if [ -d $CLONEDIR ]; then - git pull; +UPSTREAM="https://github.com/wikimedia/jquery.i18n.git" + +echo "Getting latest jquery.i18n from $UPSTREAM" + +if [ -d "$CLONEDIR" ]; then + pushd "$CLONEDIR" + git pull + popd else - git clone $UPSTREAM $CLONEDIR; + git clone "$UPSTREAM" "$CLONEDIR" fi -cd "$HERE"; -cp -rf $CLONEDIR/src/* $DEST +rm -rf "$DEST"/* +cp -R "$CLONEDIR"/src/* "$DEST" diff --git a/scripts/update-jquery-ime.sh b/scripts/update-jquery-ime.sh index bb5e8b2e..4a76117d 100755 --- a/scripts/update-jquery-ime.sh +++ b/scripts/update-jquery-ime.sh @@ -1,20 +1,27 @@ #!/bin/bash -DEST="../lib/jquery.ime"; -CLONEDIR="/tmp/jquery.ime"; -HERE=$(pwd); -UPSTREAM="https://github.com/wikimedia/jquery.ime.git"; +BASEDIR=$(dirname "$0") +BASEDIR="$BASEDIR/.." -echo -e "Getting latest jquery.ime from $UPSTREAM\n"; +DEST="$BASEDIR/lib/jquery.ime" +CLONEDIR="$BASEDIR/vendor/jquery.ime" -if [ -d $CLONEDIR ]; then - git pull; +UPSTREAM="https://github.com/wikimedia/jquery.ime.git" + +echo "Getting latest jquery.ime from $UPSTREAM" + +if [ -d "$CLONEDIR" ]; then + pushd "$CLONEDIR" + git pull + popd else - git clone $UPSTREAM $CLONEDIR; + git clone "$UPSTREAM" "$CLONEDIR" fi -cd $CLONEDIR; -npm install; -grunt copy concat; -cd "$HERE"; -cp -rf $CLONEDIR/dist/jquery.ime/{images,css,rules,jquery.ime.js} $DEST; +pushd "$CLONEDIR" +npm install +./node_modules/.bin/grunt copy concat +popd + +rm -rf "$DEST"/* +cp -R "$CLONEDIR"/dist/jquery.ime/{images,css,rules,jquery.ime.js} "$DEST" diff --git a/scripts/update-jquery-uls.sh b/scripts/update-jquery-uls.sh index 8797d669..6f341d23 100755 --- a/scripts/update-jquery-uls.sh +++ b/scripts/update-jquery-uls.sh @@ -1,17 +1,22 @@ #!/bin/bash -DEST="../lib/jquery.uls"; -CLONEDIR="/tmp/jquery.uls"; -HERE=$(pwd); -UPSTREAM="https://github.com/wikimedia/jquery.uls.git"; +BASEDIR=$(dirname "$0") +BASEDIR="$BASEDIR/.." -echo -e "Getting latest jquery.uls from $UPSTREAM\n"; +DEST="$BASEDIR/lib/jquery.uls" +CLONEDIR="$BASEDIR/vendor/jquery.uls" -if [ -d $CLONEDIR ]; then - git pull; +UPSTREAM="https://github.com/wikimedia/jquery.uls.git" + +echo "Getting latest jquery.uls from $UPSTREAM" + +if [ -d "$CLONEDIR" ]; then + pushd "$CLONEDIR" + git pull + popd else - git clone $UPSTREAM $CLONEDIR; + git clone "$UPSTREAM" "$CLONEDIR" fi -cd "$HERE"; -cp -rf $CLONEDIR/{images,css,src,i18n} $DEST +rm -rf "$DEST"/* +cp -R "$CLONEDIR"/{images,css,src,i18n} "$DEST" diff --git a/scripts/update-jquery-webfonts.sh b/scripts/update-jquery-webfonts.sh index f2ff8115..6a980c00 100755 --- a/scripts/update-jquery-webfonts.sh +++ b/scripts/update-jquery-webfonts.sh @@ -1,17 +1,22 @@ #!/bin/bash -DEST="../lib/"; -CLONEDIR="/tmp/jquery.webfonts"; -HERE=$(pwd); -UPSTREAM="https://github.com/wikimedia/jquery.webfonts.git"; +BASEDIR=$(dirname "$0") +BASEDIR="$BASEDIR/.." -echo -e "Getting latest jquery.webfonts from $UPSTREAM\n"; +DEST="$BASEDIR/lib/" +CLONEDIR="$BASEDIR/vendor/jquery.wefonts" -if [ -d $CLONEDIR ]; then - git pull; +UPSTREAM="https://github.com/wikimedia/jquery.webfonts.git" + +echo "Getting latest jquery.wefonts from $UPSTREAM" + +if [ -d "$CLONEDIR" ]; then + pushd "$CLONEDIR" + git pull + popd else - git clone $UPSTREAM $CLONEDIR; + git clone "$UPSTREAM" "$CLONEDIR" fi -cd "$HERE"; -cp -rf $CLONEDIR/src/* $DEST +rm -rf "$DEST/jquery.webfonts.js" +cp -R "$CLONEDIR/src/jquery.webfonts.js" "$DEST/jquery.webfonts.js"