<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,7 @@
 # Standard library
 require 'yaml'
 require 'time'
+require 'pathname'
 
 # Gem libraries
 require 'rubygems'
@@ -12,41 +13,43 @@ require 'rake/rdoctask'
 require 'lib/setup'
 
 VERSION_DATA   = TarskiUtils::version_info(&quot;conf/version.yml&quot;)
-PUBLICPATH     = &quot;../public&quot;
-PLUGINPATH     = &quot;#{PUBLIC_PATH}/wp/wp-content/plugins/tarskisite&quot;
 TARSKI_VERSION = ENV['v'] || VERSION_DATA.first.first
-TARSKI_DIR     = &quot;tarski&quot;
+
+TARSKI_DIRNAME = &quot;tarski&quot;
+UTIL_DIR       = Pathname.new(__FILE__).dirname
+LIB_DIR        = UTIL_DIR + &quot;lib&quot;
+SRC_DIR        = UTIL_DIR + &quot;src&quot;
+CONF_DIR       = UTIL_DIR + &quot;conf&quot;
+BUILD_DIR      = UTIL_DIR + &quot;build&quot;
+PUBLIC_DIR     = UTIL_DIR + &quot;../public&quot;
+PLUGIN_DIR     = PUBLIC_DIR + &quot;wp/wp-content/plugins/tarskisite&quot;
 
 SVN_URL        = &quot;http://tarski.googlecode.com/svn&quot;
 GIT_REPO       = &quot;git://github.com/ionfish/tarski.git&quot;
 
 FEED_INFO      = {
-  :url         =&gt; &quot;http://tarskitheme.com/&quot;
-  :title       =&gt; &quot;Tarski update notification&quot;
+  :url         =&gt; &quot;http://tarskitheme.com/&quot;,
+  :title       =&gt; &quot;Tarski update notification&quot;,
   :author      =&gt; [&quot;Benedict Eastaugh&quot;, &quot;Chris Sternal-Johnson&quot;]}
 
 desc &quot;Creates a zip archive, and updates the version feed and changelog.&quot;
-task :update =&gt; [:zip, :feed, :changelog, :plugin_version]
+task :update =&gt; [:zip, :feed, :changelog]
 
 desc &quot;Update the version feed to notify Tarski users of the new release.&quot;
 task :feed do
-  require 'lib/tarski_version'
-  puts &quot;Generating version feed...&quot;  
-  TarskiVersion.new(VERSION_DATA, FEED_INFO).publish_feed(&quot;#{PUBLIC_PATH}/version.atom&quot;)
-  puts &quot;Done.&quot;
+  require LIB_DIR + 'tarski_version'
+  
+  TarskiVersion.new(VERSION_DATA, FEED_INFO).publish_feed(PUBLIC_DIR + &quot;version.atom&quot;)
 end
 
 desc &quot;Generate the hooks documentation page.&quot;
-task :hooks =&gt; :download do
+task :hooks =&gt; [:co_working_copy, :pull_master] do
   require 'erb'
-  require 'lib/tarski_docs'
+  require LIB_DIR + 'tarski_docs'
   
-  puts &quot;Generating hooks documentation...&quot;
-  TarskiDocs.new(Dir.pwd + '/' + TARSKI_DIR).read.write(&quot;#{PUBLIC_PATH}/hooks.html&quot;)
+  TarskiDocs.new(SRC_DIR + TARSKI_DIRNAME).read.write(PUBLIC_DIR + &quot;hooks.html&quot;)
   
-  puts &quot;Cleaning up checked-out files...&quot;
   `rm -rf tarski/`
-  puts &quot;Done.&quot;
 end
 
 desc &quot;Generate a new changelog HTML file.&quot;
@@ -56,13 +59,11 @@ task :changelog do
   require 'hpricot'
   require 'open-uri'
   
-  puts &quot;Reading changelog...&quot;
-  
-  struct = File.open(&quot;conf/changelog-structure.html&quot;, &quot;r&quot;) do |file|
+  struct = File.open(UTIL_DIR + &quot;conf/changelog-structure.html&quot;, &quot;r&quot;) do |file|
     Hpricot(file.read)
   end
   
-  doc = open(&quot;#{SVN_URL}/trunk/CHANGELOG&quot;) do |file|
+  doc = open(SRC_DIR + TARSKI_DIRNAME + &quot;CHANGELOG&quot;) do |file|
     # The changelog is provided in Markdown format, so it needs to be
     # passed through BlueCloth before being read into Hpricot.
     Hpricot(Markdown.new(file.read).to_html)
@@ -70,8 +71,6 @@ task :changelog do
   
   vlinks = Array.new
   
-  puts &quot;Generating HTML...&quot;
-  
   (doc/&quot;h1&quot;).remove
   
   (doc/&quot;h3&quot;).each do |header|
@@ -84,16 +83,14 @@ task :changelog do
   struct.at(&quot;#version-links&quot;).inner_html = vlinks.join(&quot;\n&quot;)
   struct.search(&quot;#version-links&quot;).after(doc.to_html)
   
-  File.open(&quot;#{PUBLIC_PATH}/changelog.html&quot;, &quot;w+&quot;) do |changelog|
+  File.open(PUBLIC_DIR + &quot;changelog.html&quot;, &quot;w+&quot;) do |changelog|
     changelog.puts(RubyPants.new(struct.to_html).to_html)
   end
-  
-  puts &quot;Done.&quot;
 end
 
 desc &quot;Add version data to the Tarski website plugin.&quot;
 task :plugin_version do
-  File.open(&quot;#{PLUGINPATH}/version.php&quot;, &quot;w+&quot;) do |f|
+  File.open(PLUGIN_DIR + &quot;version.php&quot;, &quot;w+&quot;) do |f|
     f.print &quot;&lt;?php
 
 define('TARSKI_RELEASE_VERSION', #{TARSKI_VERSION});
@@ -104,35 +101,31 @@ define('TARSKI_RELEASE_BRANCH', #{TARSKI_VERSION});
   end
 end
 
-desc &quot;Create a zip file of the lastest release in the downloads directory.&quot;
-task :zip =&gt; :download do
-  puts &quot;Creating zip file...&quot;
-  %x{zip -rm #{PUBLIC_PATH}/downloads/tarski_#{TARSKI_VERSION}.zip #{TARSKI_DIR}}
-  puts &quot;Done.&quot;
+task :co_working_copy do
+  Dir.chdir(SRC_DIR)
+  `git clone #{GIT_REPO} #{TARSKI_DIRNAME}` if Dir.glob(TARSKI_DIRNAME).empty?
 end
 
-desc &quot;Export the latest release files.&quot;
-task :download do
-  %x{rm -rf #{TARSKI_DIR}}
-  Rake::Task['git_export'].invoke
+task :pull_master do
+  Dir.chdir(SRC_DIR + TARSKI_DIRNAME)
+  `git pull origin master`
 end
 
-desc &quot;Export the latest release from the Subversion repository.&quot;
-task :svn_export do
-  puts &quot;Downloading Tarski files...&quot;
-  %x{svn export #{SVN_URL}/releases/#{TARSKI_VERSION} #{TARSKI_DIR}}
+task :export do
+  src   = SRC_DIR   + TARSKI_DIRNAME
+  build = BUILD_DIR + TARSKI_DIRNAME
+  
+  `rm -rf #{build}`        # Clean up any old exports
+  `cp -R #{src} #{build}`  # Copy working tree to build directory
+  `rm -rf #{build}/.git`   # Remove repository
+  `rm #{build}/.gitignore` # Remove dotfile
 end
 
-desc &quot;Export the latest release from a Git repository.&quot;
-task :git_export do
-  here = Dir.pwd
-  there = &quot;#{here}/#{TARSKI_DIR}&quot;
-  puts &quot;Cloning Git repository...&quot;
-  %x{git clone #{GIT_REPO} #{there}}
-  Dir.chdir(there)
-  %x{git checkout -b #{TARSKI_VERSION} #{TARSKI_VERSION}}
-  puts &quot;Pruning .git directory...&quot;
-  %x{rm -rf #{there}/.git/}
-  %x{rm #{there}/.gitignore}
-  Dir.chdir(here)
+desc &quot;Create a zip file of the lastest release in the downloads directory.&quot;
+task :zip =&gt; [:co_working_copy, :pull_master, :export] do
+  filename = &quot;tarski_&quot; + TARSKI_VERSION + &quot;.zip&quot;
+  
+  Dir.chdir(BUILD_DIR)
+  `zip -rm #{PUBLIC_DIR + &quot;downloads/&quot; + filename} \
+    #{TARSKI_DIRNAME}`
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ require 'find'
 class TarskiDocs
   
   def initialize(src_dir, options = {})
-    @template = options[:template] || Dir.pwd + &quot;/conf/hooks.erb&quot;
+    @template = options[:template] || CONF_DIR + &quot;hooks.erb&quot;
     locate_src_files(src_dir)
   end
   </diff>
      <filename>lib/tarski_docs.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,13 +23,13 @@ class TarskiVersion
     xml = Builder::XmlMarkup.new(:target =&gt; @file, :indent =&gt; 2)
     xml.instruct!
     xml.feed :xmlns =&gt; &quot;http://www.w3.org/2005/Atom&quot;, &quot;xml:lang&quot; =&gt; &quot;en-GB&quot; do
-      xml.title     @config[&quot;title&quot;]
-      xml.link      :rel =&gt; &quot;alternate&quot;, :href =&gt; @config[&quot;url&quot;]
-      xml.link      :rel =&gt; &quot;self&quot;, :href =&gt; @config[&quot;url&quot;] + File.basename(target)
-      xml.id        @config[&quot;url&quot;]
+      xml.title     @config[:title]
+      xml.link      :rel =&gt; &quot;alternate&quot;, :href =&gt; @config[:url]
+      xml.link      :rel =&gt; &quot;self&quot;, :href =&gt; @config[:url] + File.basename(target)
+      xml.id        @config[:url]
       xml.updated   @datetime
 
-      @config[&quot;author&quot;].each do |name|
+      @config[:author].each do |name|
         xml.author  { xml.name name }
       end
       </diff>
      <filename>lib/tarski_version.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9f2ac1a9f8a6c05a8d565fc89d23af423e351347</id>
    </parent>
  </parents>
  <author>
    <name>Benedict Eastaugh</name>
    <email>benedict@eastaugh.net</email>
  </author>
  <url>http://github.com/ionfish/tarski-utilities/commit/f2b7fffa92b0ddbdbcb726c7020a103d173f87c2</url>
  <id>f2b7fffa92b0ddbdbcb726c7020a103d173f87c2</id>
  <committed-date>2009-08-11T16:40:59-07:00</committed-date>
  <authored-date>2009-08-11T16:40:59-07:00</authored-date>
  <message>Modernisation of the Rake tasks.

Everything is now built on cloning a local version of the Tarski Git repository, and operating on the resultant files in various ways.</message>
  <tree>d9e0483181100572d1ef7082aa257935d1d3b08b</tree>
  <committer>
    <name>Benedict Eastaugh</name>
    <email>benedict@eastaugh.net</email>
  </committer>
</commit>
