Skip to content

Instantly share code, notes, and snippets.

@demonnico
Created June 9, 2013 01:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demonnico/5737294 to your computer and use it in GitHub Desktop.
Save demonnico/5737294 to your computer and use it in GitHub Desktop.
To Mark a version number,git commit hash and branch name on a image, it can be your App's icons.
commit=`git rev-parse --short HEAD`
branch=`git rev-parse --abbrev-ref HEAD`
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"`
function processIcon() {
export PATH=$PATH:/usr/local/bin
base_file=$1
base_path=`find ${SRCROOT} -name $base_file`
if [[ ! -f ${base_path} || -z ${base_path} ]]; then
return;
fi
target_file=`echo $base_file | sed "s/_base//"`
target_path="${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${target_file}"
if [ $CONFIGURATION = "Release" ]; then
cp ${base_file} $target_path
return
fi
width=`identify -format %w ${base_path}`
convert -background '#0008' -fill white -gravity center -size ${width}x40\
caption:"${version} ${branch} ${commit}"\
${base_path} +swap -gravity south -composite ${target_path}
}
processIcon "icon-114.png"
processIcon "icon-57.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment