From 121d71d8f942710b7b7baa699fb2bf8a66dcd60f Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Mon, 13 Jan 2014 16:23:07 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20push-update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ push-update.sh | 30 +++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60e50fe..d2c35f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +0.0.03 (2014-01-13) +------------------- + +- Корректировки push-update. [Alexander Demidov] + +- Правка push-update. [Alexander Demidov] + 0.0.01 (2014-01-13) ------------------- diff --git a/push-update.sh b/push-update.sh index 68a5ad3..e5e5475 100755 --- a/push-update.sh +++ b/push-update.sh @@ -1,16 +1,23 @@ #!/bin/bash PATH_LIB='/lib/Image' PROJECTS=( "/var/www/10ballov" "/var/www/predelanet" "/var/www/zelenoemore" "/var/www/d753_common" ) -if [ ! test -n CHANGELOG.md ] +if [ ! -f "CHANGELOG.md" ] then - echo 'CHANGELOG.md not exists or empty.' + echo "CHANGELOG.md not exists\n" + exit 1 +fi +test -n "`tail CHANGELOG.md`" +CHANGELOG_EMPTY=`echo $?` +if [ $CHANGELOG_EMPTY == 1 ] +then + echo -e "CHANGELOG.md is empty\n" exit 1 fi git diff-index --quiet HEAD -- REPO_CHANGED=`echo $?` -if [ $REPO_CHANGED ] +if [ $REPO_CHANGED == 1 ] then - echo 'Please commit all changes in repository.' + echo -e "Please commit all changes in repository\n" exit 1 fi VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1` @@ -31,33 +38,34 @@ MESSAGE="Update ${PATH_LIB} on ${VERSION}" CURRENT_DIR=`pwd` for project in "${PROJECTS[@]}" do - echo "Update lib for ${i}...\n" + echo -e "Update lib for ${i}...\n" (cd "${project}${PATH_LIB}" && git fetch > /dev/null && git checkout $VERSION > /dev/null) || - (echo "Failed to checkout lib on tag ${VERSION}\n" && + (echo -e "Failed to checkout lib on tag ${VERSION}\n" && exit 1) cd "${project}" git diff-index --quiet HEAD "${PATH_LIB#'/'}" - if [ `echo $?` ] + LIB_NEW_COMMITS=`echo $?` + if [ $LIB_NEW_COMMITS == 1 ] then (git reset > /dev/null git add "${PATH_LIB#'/'}" > /dev/null && git commit -m $MESSAGE > /dev/null) || - (echo "Failed to update lib for ${project}\n" && + (echo -e "Failed to update lib for ${project}\n" && exit 1) if [ $project == "/var/www/d753_common" ] then (git push origin master > /dev/null && cd /var/www/d753/ && ./merge-from-master.sh > /dev/null cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null) || - (echo "Failed to update dependency d753 branches... Please resolve that problem by hand\n" && + (echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n" && exit 1) fi else - echo "Already update\n" + echo -e "Already update\n" fi done -echo "All operations succeed\n" +echo -e "All operations succeed\n" exit 0 \ No newline at end of file