Skip to content

Instantly share code, notes, and snippets.

@mkhl
Created June 23, 2009 14:17
Show Gist options
  • Save mkhl/134552 to your computer and use it in GitHub Desktop.
Save mkhl/134552 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -wKU -rubygems
# http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/
# I saw the script from the above URL and thought it was unnecessarily complicated.
# So I uncomplicated it.
require 'osx/plist'
File.open(File.join(ENV['BUILT_PRODUCTS_DIR'], ENV['INFOPLIST_PATH']), 'r+') do |io|
plist, format = OSX::PropertyList.load(io, true)
io.rewind
plist['CFBundleVersion'] = "#{plist['CFBundleVersion'].sub(/\s+\(git sha \w+\)$/, '')} (git sha #{`git rev-parse --short HEAD`.chomp})"
OSX::PropertyList.dump(io, plist, format)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment