123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/usr/bin/env bash
- #
- # 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
|