if [ "$1" == "" ]; then
echo "Usage: version.sh <new-version-number>"
exit 1
fi
VERSION=$(
ls **/Cargo.toml | \
xargs grep "# GLUON$" | \
perl -p -e 's/.*version = "([0-9.]+)"[^#]+# GLUON$/$1/' |
sort |
uniq)
if [ $(echo $VERSION | wc -w) != 1 ]; then
echo "Error: inconsistent versions detected across Cargo.toml files!"
echo "$VERSION"
exit 1
fi
echo "Found consistent version $VERSION"
perl -p -i -e 's/version *= *"[0-9.]+"([^#]+)# GLUON/version = "'$1'"$1# GLUON/' \
$(ls **/Cargo.toml Cargo.toml)
perl -p -i -e 's/^gluon *= *"[0-9.]+"/gluon = "'$1'"/' \
README.md
perl -p -i -e 's/[0-9][0-9.]+([^#]+)# GLUON/'$1'$1# GLUON/' \
$(ls **/src/lib.rs src/lib.rs)