Created
November 24, 2011 00:38
-
-
Save thetron/1390351 to your computer and use it in GitHub Desktop.
Automatic, Apple-style build numbers
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
#!/usr/bin/env ruby | |
bundle_version_short = %x{/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE"} | |
bundle_version = %x{/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE"} | |
build_number = bundle_version_short.split(".").first | |
build_number += (bundle_version_short.split(".")[1].to_i + 65).chr | |
build_number += (bundle_version.scan(/\d+[A-Z](\d+)/).flatten.first.to_i + 1).to_s | |
%x{/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{build_number}" "$INFOPLIST_FILE"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment