Skip to content

Instantly share code, notes, and snippets.

@bubudrc
Created December 23, 2015 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bubudrc/d387d6c16ed522805d3d to your computer and use it in GitHub Desktop.
Save bubudrc/d387d6c16ed522805d3d to your computer and use it in GitHub Desktop.
SNIPPETS - Script to use on Xcode
# HIGHLIGHT YOUR TODOS, FIXMES, & ERRORS IN XCODE
TAGS="TODO:|FIXME:"
ERRORTAG="ERROR:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$|($ERRORTAG).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" | perl -p -e "s/($ERRORTAG)/ error: \$1/"
# ------------------------------------------
# CHANGE BUILD VERSION
# This splits a two-decimal version string, such as "0.45.123", allowing us to increment the third position.
# Dont forget to change the number on BUIL input (Target -> General -> Build)
VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
NEWSUBVERSION=`echo $VERSIONNUM | awk -F "." '{print $3}'`
NEWSUBVERSION=$(($NEWSUBVERSION + 1))
NEWVERSIONSTRING=`echo $VERSIONNUM | awk -F "." '{print $1 "." $2 ".'$NEWSUBVERSION'" }'`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $NEWVERSIONSTRING" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment