From bc15dd4cf93d10092492ee5fce820c13fb801bef Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 18 Aug 2016 13:17:04 +0200 Subject: [PATCH] Updated synchro script - fixed minor bugs --- docs/src/main/bash/sync_ghpages.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/src/main/bash/sync_ghpages.sh b/docs/src/main/bash/sync_ghpages.sh index ca21593b..37c9ec0d 100755 --- a/docs/src/main/bash/sync_ghpages.sh +++ b/docs/src/main/bash/sync_ghpages.sh @@ -43,11 +43,12 @@ function update_ghpages_script() { fi local REPO_NAME=$1 local BRANCH_NAME=$2 - download_ghpages_if_missing echo "Updating ghpages script for [${REPO_NAME}] and branch [${BRANCH_NAME}]" cd ${REPO_NAME} echo "Checking out [${BRANCH_NAME}]" git checkout ${BRANCH_NAME} + echo "Resetting the repo and pulling before commiting" + git reset --hard origin/${BRANCH_NAME} && git pull origin ${BRANCH_NAME} # If the user wants to just push we will not copy / add / commit files if [[ "${JUST_PUSH}" != "yes" ]] ; then echo "Copying [${GHPAGES_DOWNLOAD_PATH}] to [${GHPAGES_IN_REPO_PATH}]" @@ -64,16 +65,12 @@ function update_ghpages_script() { cd ${ROOT_FOLDER} } -# Downloads ghpages.sh if it wasn't already downloaded -function download_ghpages_if_missing() { - if [ ! -f ${GHPAGES_DOWNLOAD_PATH} ] - then - echo "Downloading ghpages.sh from [${GHPAGES_URL}] to [${GHPAGES_DOWNLOAD_PATH}]" - curl ${GHPAGES_URL} -o ${GHPAGES_DOWNLOAD_PATH} - chmod +x ${GHPAGES_DOWNLOAD_PATH} - else - echo "ghpages.sh was already found at [${GHPAGES_DOWNLOAD_PATH}]" - fi +# Downloads ghpages.sh +function download_ghpages() { + rm -rf ${GHPAGES_DOWNLOAD_PATH} + echo "Downloading ghpages.sh from [${GHPAGES_URL}] to [${GHPAGES_DOWNLOAD_PATH}]" + curl ${GHPAGES_URL} -o ${GHPAGES_DOWNLOAD_PATH} + chmod +x ${GHPAGES_DOWNLOAD_PATH} } # Either clones or pulls the repo for given project and then updates gh-pages for the given project @@ -124,6 +121,8 @@ EOF function print_usage() { cat <