Archive for the ‘Xcode’ Category

Using MacRuby to set Xcode project version from git

Thursday, June 19th, 2008

I have been looking into automating some of my development tasks in Cocoa/Xcode environment.  For the longest time I was using Subversion which would integrate quite well with Xcode. Recently, however, I have been exploring other version control systems.  Especially git.  Since it’s a much newer (D)VCS it does not have as much integration into systems as subversion.

I have managed to find some interesting solutions to include Git version number in Xcode project however the only actual solutions I have found are written in languages I don’t care for anymore.  Yes I can program in them but why would I want to.

So here is a quick solution written in MacRuby.

#!/usr/local/bin/macruby

git_output = `git show --abbrev-commit`
commit_version = git_output.split("\n").grep(/^commit/).first
version = commit_version.gsub(/^commit\s+(.*)\.{3}/, "\\1")
if version
  list = NSMutableDictionary.dictionaryWithContentsOfFile("Info.plist")
  list["CFBundleVersion"] = version
  list.writeToFile(’Info.plist’, :atomically => true)
end

In my final solution I intend to have an output in following format:

major.minor.revision (build)

where the “build” is going to correspond with the git commit version
and the other parts will reflect the marketing version numbers.


Ref: Shiny Frog Article Python solution
Ref: Cocoa is my Girlfriend Article Perl solution

Quick rename of menu items in XCode

Tuesday, June 10th, 2008

Sometimes a little bit of automation goes a long way and other times it may be just wasted time. I have run into one of these situations recently when dealing with Xcode and trying to rename menu items from NewApplication to the Application Name.

For Example:

Quit NewApplication -> Quit TestApp

My first approach was to use Ruby open the MainMenu.xib and do a replacement. This technique may prove to be useful in the future when I have more command line tools for other tasks, but currently there is a much simpler way of dealing with renaming menu items.

1. Right click on MainMenu.nib and select “Open As” -> “Source Code File”

2. Press: “Command-F” to open find/replace dialog

3. Replace all NewApplication strings with desired application name.

That’s it

CocoaHeads Arizona Google Group

Sunday, December 16th, 2007

It seems that Google (the search engine) has hard time associating XcodePhoenix with CocoaHeads Arizona or Cocoaheads and Phoenix and people are finding my site when searching for the group. My previous post did not mention the Google forum XcodePhoenix uses for communication so here it is:

http://groups.google.com/group/xcodephoenix

Hope to see you there.

Cocoa Heads - Scottsdale Chapter

Thursday, October 11th, 2007

Today we are organizing new Cocoa Heads chapter in Scottsdale Arizona. We hope to be the place for cocoa developers in the Greater Phoenix area.

First meeting meeting will be held at:


Target Training International LTD.
16020 N. 77th Street
Scottsdale AZ, 85260

At: 7:00pm (until 9:00pm)

More information on Cocoa Heads:
CocoaHeads Website

We will conform to the cocoaheads guidelines and schedule for meetings.

You are currently browsing the archives for the Xcode category.

Social Networking

Gregory Furmanek's Facebook profile
View Gregory Furmanek's profile on LinkedIn