2019-03-28 15:51:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2019-03-30 14:11:33 +00:00
|
|
|
#### $$VERSION$$ v0.49-4-g8e08c1f
|
2019-03-29 16:52:00 +00:00
|
|
|
#
|
2019-03-28 15:51:33 +00:00
|
|
|
# Easy Versioning in git:
|
|
|
|
#
|
|
|
|
# for setting your Version in git use e.g.:
|
|
|
|
# git tag -a v0.5 -m 'Version 0.5'
|
|
|
|
#
|
|
|
|
# Push tags upstream—this is not done by default:
|
|
|
|
# git push --tags
|
|
|
|
#
|
|
|
|
# # in case of a wrong tag remove it:
|
|
|
|
# git tag -d v0.5
|
|
|
|
#
|
|
|
|
# delete remote tag (eg, GitHub version)
|
|
|
|
# git push origin :refs/tags/v0.5
|
|
|
|
#
|
|
|
|
# Then use the describe command:
|
|
|
|
#
|
|
|
|
# git describe --tags --long
|
|
|
|
# This gives you a string of the format:
|
|
|
|
#
|
|
|
|
# v0.5-0-gdeadbee
|
|
|
|
# ^ ^ ^^
|
|
|
|
# | | ||
|
|
|
|
# | | |'-- SHA of HEAD (first seven chars)
|
|
|
|
# | | '-- "g" is for git
|
|
|
|
# | '---- number of commits since last tag
|
|
|
|
# |
|
|
|
|
# '--------- last tag
|
|
|
|
#
|
|
|
|
# run this script to (re)place Version number in files
|
|
|
|
#
|
2019-03-29 16:52:00 +00:00
|
|
|
|
|
|
|
unset IFS
|
|
|
|
# set -f # if you are paranoid use set -f to disable globbing
|
2019-03-28 15:51:33 +00:00
|
|
|
|
|
|
|
VERSION="`git describe --tags --long`"
|
|
|
|
echo "Update files to version $VERSION ..."
|
|
|
|
|
|
|
|
for file in `ls`
|
|
|
|
do
|
|
|
|
[ ! -f "$file" ] && continue
|
|
|
|
#[ "$file" == "version" ] && continue
|
|
|
|
echo -n " $file"
|
|
|
|
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '$VERSION'/' $file
|
|
|
|
done
|
|
|
|
echo " done."
|
|
|
|
|