Rocket/scripts/bump_version.sh

30 lines
856 B
Bash
Raw Normal View History

2016-12-24 20:41:30 +00:00
#! /usr/bin/env bash
#
# Bumps the version number from <current> to <next> on all libraries.
#
2018-10-07 04:16:02 +00:00
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPT_DIR}/config.sh"
if [ -z "${1}" ] || [ -z "${2}" ]; then
2016-12-24 20:41:30 +00:00
echo "Usage: $0 <current> <next>"
echo "Example: $0 0.1.1 0.1.2"
exit 1
fi
2018-10-07 04:16:02 +00:00
if ! git grep -c "${1}" > /dev/null; then
echo "The version '${1}' doesn't appear to be correct."
echo "Exiting."
exit 1
fi
today=$(date "+%b %d, %Y")
2018-10-07 04:16:02 +00:00
find "${PROJECT_ROOT}" -name "lib.rs" | xargs sed -i.bak "s/${1}/${2}/g"
find "${PROJECT_ROOT}" -name "*.toml" | xargs sed -i.bak "s/${1}/${2}/g"
find "${SITE_ROOT}" -name "*.md" | xargs sed -i.bak "s/${1}/${2}/g"
sed -i.bak "s/^date.*/date = \"$today\"/" "${SITE_ROOT}/index.toml"
sed -i.bak "s/${1}/${2}/g" "${SCRIPT_DIR}/config.sh"
find ${PROJECT_ROOT} -name "*.bak" | xargs rm