Skip to content

Instantly share code, notes, and snippets.

@ryanbriones
Created April 3, 2009 17:05
Show Gist options
  • Select an option

  • Save ryanbriones/89839 to your computer and use it in GitHub Desktop.

Select an option

Save ryanbriones/89839 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
# Update your Cocoa Project build number with git HEAD
require 'osx/foundation'
INFO_PLIST_FILE = "#{Dir.pwd}/Info.plist"
BUILD_NUMBER = (`git show-ref --head --abbrev HEAD | grep -v origin | awk '{print $1}'`).chomp
info_plist = OSX::NSMutableDictionary.dictionaryWithContentsOfFile(INFO_PLIST_FILE)
info_plist.setObject_forKey(BUILD_NUMBER, "CFBundleVersion")
info_plist.writeToFile_atomically(INFO_PLIST_FILE, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment