github.com/lyft/flytestdlib@v0.3.12-0.20210213045714-8cdd111ecda1/boilerplate/update.sh (about) 1 #!/usr/bin/env bash 2 3 # WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. 4 # ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: 5 # 6 # TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst 7 8 set -e 9 10 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" 11 12 OUT="$(mktemp -d)" 13 git clone git@github.com:lyft/boilerplate.git "${OUT}" 14 15 echo "Updating the update.sh script." 16 cp "${OUT}/boilerplate/update.sh" "${DIR}/update.sh" 17 echo "" 18 19 20 CONFIG_FILE="${DIR}/update.cfg" 21 README="https://github.com/lyft/boilerplate/blob/master/Readme.rst" 22 23 if [ ! -f "$CONFIG_FILE" ]; then 24 echo "$CONFIG_FILE not found." 25 echo "This file is required in order to select which features to include." 26 echo "See $README for more details." 27 exit 1 28 fi 29 30 if [ -z "$REPOSITORY" ]; then 31 echo '$REPOSITORY is required to run this script' 32 echo "See $README for more details." 33 exit 1 34 fi 35 36 while read directory; do 37 # TODO: Skip empty lines, whitespace only lines, and comment lines 38 echo "***********************************************************************************" 39 echo "$directory is configured in update.cfg." 40 echo "-----------------------------------------------------------------------------------" 41 echo "syncing files from source." 42 dir_path="${OUT}/boilerplate/${directory}" 43 rm -rf "${DIR}/${directory}" 44 mkdir -p $(dirname "${DIR}/${directory}") 45 cp -r "$dir_path" "${DIR}/${directory}" 46 if [ -f "${DIR}/${directory}/update.sh" ]; then 47 echo "executing ${DIR}/${directory}/update.sh" 48 "${DIR}/${directory}/update.sh" 49 fi 50 echo "***********************************************************************************" 51 echo "" 52 done < "$CONFIG_FILE" 53 54 rm -rf "${OUT}"