Skip to content

Instantly share code, notes, and snippets.

@d-amend
Created September 5, 2013 09:29
Show Gist options
  • Save d-amend/6447960 to your computer and use it in GitHub Desktop.
Save d-amend/6447960 to your computer and use it in GitHub Desktop.
Writes the CFBundleShortVersionString from the currently used Info.plist and the build number, generated from the git commit count to the Root.plist in a Settings.bundle
# Get the commit count
GIT_COMMIT_COUNT=`git rev-list --all | wc -l | tr -d ' '`
#copy template to settingsbundle
bundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
#update Root.plist in settingsbundle with current version and build number
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:0:DefaultValue $bundleVersion (build $GIT_COMMIT_COUNT)" "${PROJECT_DIR}"/Settings.bundle/Root.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment