Created
June 9, 2013 01:53
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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