Created
October 2, 2015 00:48
-
-
Save Blackjacx/139f1b7b91c26399f31c to your computer and use it in GitHub Desktop.
App Icon Annotation (version, build number, etc)
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
# check if tools installed | |
if ! type "composite" > /dev/null; then | |
exit 0 | |
fi | |
IFS=$'\n' | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
PATH=${PATH}:/usr/local/bin | |
TARGET_PATH=${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH} | |
function generateIcon () { | |
IMAGE_PATH="$TARGET_PATH/$1" | |
WIDTH=$(identify -format %w ${IMAGE_PATH}) | |
FONT_SIZE=$(echo "$WIDTH * .15" | bc -l) | |
if [ "${CONFIGURATION}" == "Debug" ]; then | |
convert debugRibbon.png -resize ${WIDTH}x${WIDTH} resizedRibbon.png | |
convert ${IMAGE_PATH} -fill white -font Helvetica -pointsize ${FONT_SIZE} -gravity south -annotate 0 "$versionNumber ($buildNumber)" - | composite resizedRibbon.png - ${IMAGE_PATH} | |
fi | |
if [ "${CONFIGURATION}" == "Distribution" ]; then | |
convert betaRibbon.png -resize ${WIDTH}x${WIDTH} resizedRibbon.png | |
convert ${IMAGE_PATH} -fill white -font Helvetica -pointsize ${FONT_SIZE} -gravity SouthEast -annotate 0 "$versionNumber ($buildNumber)" - | composite resizedRibbon.png - ${IMAGE_PATH} | |
fi | |
} | |
declare -a pngs=`ls $TARGET_PATH | grep AppIcon` | |
for i in $pngs;do | |
generateIcon $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment