libin (owner)

Fork Of

Revisions

gist: 68337 Download_button fork
public
Public Clone URL: git://gist.github.com/68337.git
Embed All Files: show embed
autopopulate_git_sha.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env macruby
 
# From: http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/
# Expanded from here: http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizern
# Converted to MacRuby by Gregory Furmanek
# Merged with MacRuby version by elliottcable
# Appends the git sha to the version number set in Xcode.
 
git = `sh /etc/profile; which git`.chomp
sha = `#{git} rev-parse --short HEAD`.chomp
 
info_file = ENV['BUILT_PRODUCTS_DIR'] + "/" + ENV['INFOPLIST_PATH']
 
list = NSMutableDictionary.dictionaryWithContentsOfFile info_file
list['CFBundleVersion'] = sha
list.writeToFile 'Info.plist', :atomically => true