Xcode-Scripts/Git Version.sh

22 lines
946 B
Bash
Raw Normal View History

2011-04-21 11:18:03 -05:00
#!/bin/bash
#
# Git Version
#
# Created by Mr. Gecko <GRMrGecko@gmail.com> on 4/21/11.
# No Copyright Claimed. Public Domain.
#
# DISCLAIMER: This script is provided as-is. I am not responsible if this script somehow causes harm to you or your system in any way, I am providing this for free in hope that it will of use to someone. I WILL NOT pay you any amount of money if anything happen to your data or you because of the changes this script makes nor am I obligated to help you fix issues this causes.
#
2011-04-21 11:18:03 -05:00
PATH="${PATH}:/usr/local/git/bin/"
2011-04-21 11:18:03 -05:00
INFO="${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Info"
GITDIR="${PROJECT_DIR}/.git"
VERSION=`defaults read "${INFO}" CFBundleVersion`
if [ -d "${GITDIR}" ]; then
REVISION=`git --git-dir="${GITDIR}" rev-parse --short HEAD`
defaults write "${INFO}" CFBundleShortVersionString -string "${VERSION} (${REVISION})"
else
defaults write "${INFO}" CFBundleShortVersionString -string "${VERSION}"
fi