#!/bin/bash # # setVersion - place the version info given as argument # into all the necessary places in the Lumiera tree # # set -e function fail() { echo -e "\nFAIL: $1\n\n" exit -1 } PROJ_ROOT=$(git rev-parse --show-toplevel) cd $PROJ_ROOT [ $# -eq 1 ] || fail "need version as argument\n\nsetVersion " [ -n "$1" ] || fail "need a nonemty version spec" VER="$1" function rewrite() { # Process the indicated file with sed and replace the existing version spec # The PREFIX argument must match everything from line start before the version; # then the _remainder_ of this line will be replaced by the NEWVER FILE="$1" PREFIX="$2" NEWVER="$3" echo "rewrite..... $FILE" egrep -q "^$PREFIX" $FILE || fail "not found in $FILE : $PREFIX" # sed -r -f - -i "$FILE" <