<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,5 @@
 build
+Packages
 .DS_Store
 *.o
 *.ob
@@ -9,16 +10,4 @@ build
 *~.nib
 designable.nib
 *.tm_build_errors
-Debug
-*.obj
-*.ncb
-*.aps
-*.suo
-*.user
-*.pdb
-*.idb
-BuildLog.htm
-mt.dep
-debuglog.*
-*.intermediate.manifest
 </diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,20 @@
 require 'pathname'
 require 'fileutils'
+require 'time'
+require 'erb'
 require 'rake/testtask'
+require 'pp'
 
 APP_SHORT_NAME = defined?(MACRUBY_VERSION) ? 'MRLimeChat' : 'LimeChat'
 APP_NAME = APP_SHORT_NAME + '.app'
 ROOT_PATH = Pathname.new(__FILE__).dirname
-DESKTOP_PATH = Pathname.new('~/Desktop').expand_path
-TMP_PATH = Pathname.new(&quot;/tmp/#{APP_SHORT_NAME}_build_image&quot;)
-BUILD_APP_PATH = ROOT_PATH + 'build/Release' + APP_NAME
+APP_BUILD_PATH = ROOT_PATH + 'build/Release' + APP_NAME
 DOC_PATH = ROOT_PATH + 'doc'
+PACKAGES_PATH = ROOT_PATH + 'Packages'
+APPCAST_TEMPLATE_PATH = ROOT_PATH + 'etc/appcast_template.rxml'
+APPCAST_PATH = PACKAGES_PATH + 'limechat_appcast.xml'
+
+TMP_PATH = Pathname.new(&quot;/tmp/#{APP_SHORT_NAME}_build_image&quot;)
 
 
 task :default =&gt; :build
@@ -21,68 +27,79 @@ task :build do |t|
   build('10.5')
 end
 
-Rake::TestTask.new do |t|
-  t.test_files = FileList['test/**/*_test.rb']
+task :package =&gt; [:package_app] do |t|
 end
 
-task :package =&gt; [:package_app_10_5, :package_app_10_6, :package_source] do |t|
-end
-
-task :package_app_10_5 =&gt; :clean do |t|
+task :package_app =&gt; :clean do |t|
   sdk = '10.5'
   build(sdk)
-  embed_framework(sdk)
-  package(sdk)
-end
-
-task :package_app_10_6 =&gt; :clean do |t|
-  sdk = '10.6'
-  build(sdk)
-  embed_framework(sdk)
-  package(sdk)
+  package
 end
 
 task :package_source do |t|
   package_source
 end
 
+task :appcast do |t|
+  package_fname = &quot;#{APP_SHORT_NAME}_#{app_version}.tar.bz2&quot;
+	package_path = PACKAGES_PATH + package_fname
+	stat = File.stat(package_path)
+	
+  version = app_version
+	fsize = stat.size
+	ftime = stat.mtime.rfc2822
+  updates = parse_commit_log
+  
+  e = ERB.new(File.open(APPCAST_TEMPLATE_PATH).read, nil, '-')
+  s = e.result(binding)
+  File.open(APPCAST_PATH, 'w') do |f|
+    f.write(s)
+  end
+  
+  sh &quot;mate #{APPCAST_PATH}&quot;
+end
+
+Rake::TestTask.new do |t|
+  t.test_files = FileList['test/**/*_test.rb']
+end
+
 
 def build(sdk)
   sh &quot;xcodebuild -project #{APP_SHORT_NAME}.xcodeproj -target #{APP_SHORT_NAME} -configuration Release -sdk macosx#{sdk} build&quot;
 end
 
 def embed_framework(sdk)
-  sh %Q|/usr/bin/ruby -r etc/package_builder -e &quot;PackageBuilder.build('#{BUILD_APP_PATH}', '#{sdk}')&quot;|
+  sh %Q|/usr/bin/ruby -r etc/package_builder -e &quot;PackageBuilder.build('#{APP_BUILD_PATH}', '#{sdk}')&quot;|
 end
 
-def package(sdk)
-	zip_path = DESKTOP_PATH + &quot;#{APP_SHORT_NAME}_#{app_version}_#{sdk}.zip&quot;
-	zip_path.rmtree
+def package
+	package_path = PACKAGES_PATH + &quot;#{APP_SHORT_NAME}_#{app_version}.tar.bz2&quot;
+	package_path.rmtree
 	TMP_PATH.rmtree
 	TMP_PATH.mkpath
-	BUILD_APP_PATH.cptree(TMP_PATH)
+	APP_BUILD_PATH.cptree(TMP_PATH)
 	
 	DOC_PATH.cptree(TMP_PATH)
 	rmglob(TMP_PATH + '**/ChangeLog.txt')
-	rmglob(TMP_PATH + '**/.svn')
 	rmglob(TMP_PATH + '**/.DS_Store')
 	
 	Dir.chdir(TMP_PATH) do
-		sh &quot;zip -qr #{zip_path} *&quot;
+		sh &quot;tar jcf #{package_path} *&quot;
 	end
 	
 	TMP_PATH.rmtree
 end
 
 def package_source
-	source_zip_path = DESKTOP_PATH + &quot;#{APP_SHORT_NAME}_#{app_version}_src.zip&quot;
-	source_zip_path.rmtree
+	source_package_path = PACKAGES_PATH + &quot;#{APP_SHORT_NAME}_#{app_version}_src.tar.bz2&quot;
+	source_package_path.rmtree
 	TMP_PATH.rmtree
 	
 	ROOT_PATH.cptree(TMP_PATH)
 	
 	rmglob(TMP_PATH + 'build')
 	rmglob(TMP_PATH + 'etc')
+	rmglob(TMP_PATH + 'Packages')
 	rmglob(TMP_PATH + 'script')
 	rmglob(TMP_PATH + 'web')
 	rmglob(TMP_PATH + '*.tmproj')
@@ -91,19 +108,103 @@ def package_source
 	rmglob(TMP_PATH + 'LimeChat.xcodeproj/*.pbxuser')
 	rmglob(TMP_PATH + '**/*.tm_build_errors')
 	rmglob(TMP_PATH + '**/.gitignore')
-	rmglob(TMP_PATH + '**/.svn')
 	rmglob(TMP_PATH + '**/.DS_Store')
 	rmglob(TMP_PATH + '**/*~.nib')
 	rmglob(TMP_PATH + '**/._*')
 	
 	Dir.chdir(TMP_PATH) do
-		sh &quot;zip -qr #{source_zip_path} *&quot;
+		sh &quot;tar jcf #{source_package_path} *&quot;
 	end
 	
 	TMP_PATH.rmtree
 end
 
 
+class CommitLog
+  attr_accessor :hash, :merge, :author, :date
+  attr_reader :lines
+  
+  def initialize
+    @lines = []
+  end
+  
+  def add_line(line)
+    @lines &lt;&lt; line
+  end
+  
+  def release_version
+    ary = @lines.select {|e| e =~ /^released (\d+\.\d+)$/i }
+    if ary
+      $1
+    else
+      nil
+    end
+  end
+  
+  def one_line
+    s = ''
+    @lines.each do |e|
+      s &lt;&lt; e
+      s &lt;&lt; ' '
+    end
+    s.chop
+  end
+  
+  def inspect
+    &quot;&lt;CommitLog #{hash[0...6]} #{author} #{date}&gt;&quot;
+  end
+end
+
+
+def parse_commit_log
+  updates = []
+  commit = nil
+  
+  log = `git log`
+  
+  log.each_line do |s|
+    s.chomp!
+    if s =~ /^commit\s+/
+      if commit
+        updates &lt;&lt; commit
+      end
+      commit = CommitLog.new
+      commit.hash = $~.post_match
+    elsif s =~ /^Author:\s*/
+      commit.author = $~.post_match
+    elsif s =~ /^Date:\s*/
+      commit.date = $~.post_match
+    elsif s =~ /^Merge:\s*/
+      commit.merge = $~.post_match
+    elsif s =~ /^\s*$/
+      ;
+    elsif s =~ /^\s+/
+      commit.add_line($~.post_match)
+    end
+  end
+  
+  updates &lt;&lt; commit
+  
+  ver = app_version
+  first = 0
+  last = 0
+  updates.each_with_index do |e,i|
+    rel = e.release_version
+    if rel
+      if rel == ver
+        first = i + 1
+      else
+        last = i
+        break
+      end
+    end
+  end
+  
+  updates = updates[first...last]
+  updates.map {|e| e.one_line }
+end
+
+
 module Util
 	def app_version
 		file = ROOT_PATH + 'Info.plist'</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,7 @@
         &lt;/html&gt;
       ]]&gt;&lt;/description&gt;
       &lt;pubDate&gt;&lt;%= ftime %&gt;&lt;/pubDate&gt;
-      &lt;enclosure url=&quot;http://limechat.com/mac/&lt;%= package_fname %&gt;&quot; length=&quot;&lt;%= fsize %&gt;&quot; type=&quot;application/octet-stream&quot;/&gt;
+      &lt;enclosure url=&quot;http://cloud.github.com/downloads/psychs/limechat/&lt;%= package_fname %&gt;&quot; length=&quot;&lt;%= fsize %&gt;&quot; type=&quot;application/octet-stream&quot;/&gt;
     &lt;/item&gt;
     
   &lt;/channel&gt;</diff>
      <filename>etc/appcast_template.rxml</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>resource/rubycocoa/RubyCocoa_1.0.0p3_10.5.tar.gz</filename>
    </removed>
    <removed>
      <filename>resource/rubycocoa/RubyCocoa_1.0.0p3_10.6.tar.gz</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>a5add3b263bf354b8dee00d1555300d410816bd2</id>
    </parent>
  </parents>
  <author>
    <name>Satoshi Nakagawa</name>
    <email>psychs@limechat.net</email>
  </author>
  <url>http://github.com/psychs/limechat/commit/3f41db4bdc8002eca239ee09e880c43c4aeb70c3</url>
  <id>3f41db4bdc8002eca239ee09e880c43c4aeb70c3</id>
  <committed-date>2009-10-14T00:22:12-07:00</committed-date>
  <authored-date>2009-10-14T00:22:12-07:00</authored-date>
  <message>finished appcast</message>
  <tree>6aa36c78d95f3c5d58ba0ba73aa07430addcabb5</tree>
  <committer>
    <name>Satoshi Nakagawa</name>
    <email>psychs@limechat.net</email>
  </committer>
</commit>
