12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/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
- if (( $# > 0 )); then
- echo "This script takes no arguments"
- 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
- 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
|