<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:ent="http://www.purl.org/NET/ENT/1.0/" version="2.0">
  <channel>
    <title>Curiouser and Curiouser! on appcasting</title>
    <link>http://matt.blogs.it/</link>
    <description>RSS feed for topic appcasting</description>
    <copyright>Copyright 2007 Matt Mower. Some rights reserved.</copyright>
    <generator>Squib/0.5.0.382</generator>
    <managingEditor>self@mattmower.com</managingEditor>
    <webMaster>self@mattmower.com</webMaster>
    <language>en-gb</language>
    <item>
      <title>Automating Sparkle deployment</title>
      <link>http://matt.blogs.it/entries/00002599.html</link>
      <pubDate>Sun, 08 Jul 2007 15:03:22 +0100</pubDate>
      <description>&lt;p&gt;As I've mentioned before &lt;a href="http://sparkle.andymatuschak.org/"&gt;Sparkle&lt;/a&gt; is a great auto-update framework for Cocoa applications. I use it in Diffly and I'm going to use it for Transference too. I've also managed, more or less, to automate the deployment process. Here is what I do and I'd welcome any suggestions for improving it.&lt;/p&gt;

&lt;p&gt;The first step is building the .tgz archive Sparkle will update from. I used to do this by hand, then I figured out I could use an XCode &lt;strong&gt;run script&lt;/strong&gt; build phase to create an archive but couldn't figure out how to get the version info so I had to rename it by hand. A few days ago I realised I could use Ruby for the build script (by changing the executable path from the default of /bin/sh) and using Ruby it was easy to get the right name. (I realise you could do this with a shell script but by bash-fu is weak). Here is my build script:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;APP_NAME = ENV['TARGET_NAME']
BUILD_DIR = ENV['TARGET_BUILD_DIR']

Dir.chdir( BUILD_DIR  ) do
    app_path = "#{APP_NAME}.app"
    plist_path = File.join( File.expand_path( app_path ), 'Contents', 'Info' )
    version=`defaults read #{plist_path} CFBundleVersion`.chomp
    tar_name = "#{APP_NAME}_#{version}.tgz"
    command = "tar czf #{tar_name} #{app_path}"
    system( command )
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After XCode has built the application this script is invoked and pulls the version information from the Info.plist file then builds an appropriately named archive. So after clicking build I end up with the application and also &lt;code&gt;Diffly_1_0.tgz&lt;/code&gt; (or whatever the version happens to be) ready to be uploaded.&lt;/p&gt;

&lt;p&gt;The next step is publishing the archive and it's Sparkle appcast feed. The appcast feed is an RSS feed that contains release information and enclosures for the app itself. Diffly reads this feed when it starts up to see if there is a new version available. Building and publishing this feed is admirably handled for me by &lt;a href="http://reinventedsoftware.com/feeder/"&gt;Feeder&lt;/a&gt; from Reinvented Software.&lt;/p&gt;

&lt;p&gt;I just create a new item in my Diffly feed, point at the archive file on disk, copy in the release notes then click publish. Feeder does the rest.&lt;/p&gt;

&lt;p&gt;&lt;img width="305" height="325" alt="A new item in Feeder" src="http://matt.blogs.it/images/misc/feeder_diffly.jpg" /&gt;&lt;/p&gt;

&lt;p&gt;The last step is to run Diffly and check the auto-update proceeds and that the new version works. I think my next task is to add a beta appcast feed and a toggle (a la TextMate) so that I can push new changes to the more adventurous without risking breaking things for everyone. With only one feed it can be unnerving to release a new feature through the appcast.&lt;/p&gt;</description>
      <guid isPermaLink="true">http://matt.blogs.it/entries/00002599.html</guid>
      <ent:cloud ent:href="http://matt.blogs.it/topics/">
      </ent:cloud>
    </item>
  </channel>
</rss>
