<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>furmanek.net &#187; Development</title>
	<atom:link href="http://www.furmanek.net/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.furmanek.net</link>
	<description>Greg Furmanek's personal blog</description>
	<lastBuildDate>Sat, 28 Aug 2010 18:58:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unix prompt (PS1) with git branch name</title>
		<link>http://www.furmanek.net/39/unix-prompt-for-usage-with-git/</link>
		<comments>http://www.furmanek.net/39/unix-prompt-for-usage-with-git/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:00:32 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Introductions]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[PS1]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=39</guid>
		<description><![CDATA[Working with Git I noticed that I change branches quite a lot.  This is a good thing but sometimes I am in the incorrect branch when I check things in.  I needed a warning system especially when I check things into remote SVN repository.  Since most of my check-ins are done from [...]]]></description>
			<content:encoded><![CDATA[<p>Working with Git I noticed that I change branches quite a lot.  This is a good thing but sometimes I am in the incorrect branch when I check things in.  I needed a warning system especially when I check things into remote SVN repository.  Since most of my check-ins are done from the command line it would be nice to know what branch I am on just by looking at the screen.  Fortunately there is neat way to add the branch information to the Unix prompt.  You can do that by overriding the PS1 variable for example:</p>
<pre>
export PS1="[\D{%Y-%m-%d} \t] \w \n$"
</pre>
<p>would generate</p>
<pre>
[2008-07-12 12:00:00] /foo/bar
$
</pre>
<p>if I am in the <code>/foo/bar</code> directory.</p>
<p>So at this point I would like the prompt to look like:</p>
<pre>
[2008-07-12 12:00:00] /foo/bar <span style="color:green;">[master]</span>
$
</pre>
<p>when I am in a master branch and prompt:</p>
<pre>
[2008-07-12 12:00:00] /foo/bar <span style="color:red;">[experimental]</span>
$
</pre>
<p>when I am in any other branch.</p>
<p>Here are the steps to get this working:<br />
Prerequisites:<br />
- ruby interpreter<br />
- git</p>
<p>Steps:</p>
<ol>
<li> Create a git-ps.rb file
<pre>
green = "\033[0;32m"
white = "\033[0;37m"
red   = "\033[0;31m"
current_branch = `git branch 2>/dev/null`.grep(/^\*/).first
if current_branch
  branch_name = current_branch.gsub(/^\*\s*/,'').strip
  color = branch_name  =~ /master/ ? green : red
  unless current_branch.empty?
    puts "  #{color}[#{branch_name}]#{white}"
  end
end
</pre>
</li>
<li> create .ps file in your home directory:
<pre>
parse_git_branch() {
  ruby ~/git-ps.rb 2>/dev/null
}
export PS1="[\D{%Y-%m-%d} \t] \w\$(parse_git_branch) \n$ "
</pre>
</li>
<li>Include the .ps file in your .bashrc and .bash_profile by inserting following line:
<pre>
. ~/.ps
</pre>
</li>
</ol>
<p>To activate the new prompt in your current execute command:<br />
. ~/.ps</p>
<p>I hope this helps.</p>
<hr/>
<p style="font-weight:bold">References</p>
<p>Ref: <a href="http://wiki.archlinux.org/index.php/Color_Bash_Prompt">Prompt Creation</a><br />
Ref: <a href="http://unboundimagination.com/Current-Git-Branch-in-Bash-Prompt">Git and Bash prompt</a><br />
Ref: <a href="http://blog.ericgoodwin.com/2008/4/10/auto-completion-with-git">__git_ps1</a></p>
<hr/>
<p style="font-weight:bold">Downloads</p>
<p><a href='http://www.furmanek.net/wp-content/uploads/2008/07/colored_branch_name.tgz'>colored_branch_name</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/39/unix-prompt-for-usage-with-git/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using MacRuby to set Xcode project version from git</title>
		<link>http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/</link>
		<comments>http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 08:29:01 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[macruby]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=36</guid>
		<description><![CDATA[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&#8217;s a much newer (D)VCS it does not have as much integration into [...]]]></description>
			<content:encoded><![CDATA[<p>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&#8217;s a much newer (D)VCS it does not have as much integration into systems as subversion.</p>
<p>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&#8217;t care for anymore.  Yes I can program in them but why would I want to.</p>
<p>So here is a quick solution written in MacRuby.</p>
<pre style="font-size: 0.9em">#!/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 =&gt; true)
end</pre>
<p>In my final solution I intend to have an output in following format:</p>
<pre>major.minor.revision (build)</pre>
<p>where the &#8220;build&#8221; is going to correspond with the git commit version<br />
and the other parts will reflect the marketing version numbers.</p>
<hr/>
Ref: <a title="Shiny Frog Article on Integrating git and Xcode" href="http://www.shinyfrog.net/en/sync-svn-version-and-cfbundleversion-in-xcode">Shiny Frog Article</a> Python solution<br />
Ref: <a href="http://www.cimgf.com/2008/04/13/git-and-xcode-a-git-build-number-script/">Cocoa is my Girlfriend Article</a> Perl solution</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CocoaHeads Arizona Google Group</title>
		<link>http://www.furmanek.net/28/cocoaheads-arizona-google-group/</link>
		<comments>http://www.furmanek.net/28/cocoaheads-arizona-google-group/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 15:37:58 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[cocoaheads]]></category>
		<category><![CDATA[arizona]]></category>
		<category><![CDATA[phoenix]]></category>
		<category><![CDATA[scottsdale]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/28/cocoaheads-arizona-google-group/</guid>
		<description><![CDATA[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.
]]></description>
			<content:encoded><![CDATA[<p>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:</p>
<p><a href="http://groups.google.com/group/xcodephoenix">http://groups.google.com/group/xcodephoenix</a></p>
<p>Hope to see you there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/28/cocoaheads-arizona-google-group/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cocoa Heads &#8211; Scottsdale Chapter</title>
		<link>http://www.furmanek.net/25/cocoa-heads-scottsdale-chapter/</link>
		<comments>http://www.furmanek.net/25/cocoa-heads-scottsdale-chapter/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 17:48:14 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[cocoaheads]]></category>
		<category><![CDATA[arizona]]></category>
		<category><![CDATA[cocoa programming]]></category>
		<category><![CDATA[phoenix]]></category>
		<category><![CDATA[scottsdale]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/25/cocoa-heads-scottsdale-chapter/</guid>
		<description><![CDATA[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.
17785 N. Pacesetter Way
Scottsdale AZ, 85255

At: 7:00pm (until 9:00pm)
More information on Cocoa Heads:
CocoaHeads Website
We will conform to the cocoaheads guidelines and [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>First meeting meeting will be held at:</p>
<p><code><br />
Target Training International LTD.<br />
17785 N. Pacesetter Way<br />
Scottsdale AZ, 85255<br />
</code></p>
<p>At: 7:00pm (until 9:00pm)</p>
<p>More information on Cocoa Heads:<br />
<a href="http://www.cocoaheads.org/">CocoaHeads Website</a></p>
<p>We will conform to the cocoaheads guidelines and schedule for meetings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/25/cocoa-heads-scottsdale-chapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
