Browse Source

Update 'GIN_sync_UNIX'

julien colomb 3 years ago
parent
commit
21dfff09be
1 changed files with 28 additions and 1 deletions
  1. 28 1
      GIN_sync_UNIX

+ 28 - 1
GIN_sync_UNIX

@@ -1,5 +1,9 @@
 #!/usr/bin/env bash
 #
+## Double click me to synchornise changes between the mac or linux computer and the server, large files will not be downloaded 
+## To allow large file download, please erase the # sign in line 44-45 and save the file
+## use sync-bash if you are on a windows computer
+#
 # Upload changes from inside repository using GIN CLI
 # Assumes no submodules
 # Assumes gin init was performed or the repository was downloaded via gin get
@@ -9,11 +13,34 @@ if (( $# > 0 )); then
     exit 1
 fi
 
+checkerror() {
+    err=$1
+    msg=$2
+    if [[ ${err} != 0 ]]; then
+        echo ${msg} >> ./log/gin.log
+        echo ${msg}
+        echo "Press [Enter] to close this window"
+        read
+        exit 1
+    fi
+}
+
 loc=$(dirname $0)
 projectdir=$(git -C ${loc} rev-parse --show-toplevel)
 
 pushd ${loc} > /dev/null
-gin download
+
+mkdir -p ./log
+echo "$(date -Iseconds): Sync script executed" >> ./log/gin.log
+
+gin sync
+checkerror $? "Error occurred during 'gin sync'"
 gin commit .
+checkerror $? "Error occurred during 'gin commit'"
 gin upload
+checkerror $? "Error occurred during 'gin upload'"
+
+# Uncomment the two lines below to download all large files
+# gin get-content .
+# checkerror $? "Error occurred during 'gin get-content'"
 popd > /dev/null