<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>History.txt</filename>
    </added>
    <added>
      <filename>License.txt</filename>
    </added>
    <added>
      <filename>Todo.txt</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) and !$LOAD_PATH.includ
 
 require 'spec/rake/spectask'
 require 'spec/rake/verify_rcov'
-require 'rake/rdoctask'
+require 'hanna/rdoctask'
 
 plugin_name = 'resources_controller'
 
@@ -16,65 +16,73 @@ Spec::Rake::SpecTask.new(:spec) do |t|
   t.spec_opts  = [&quot;--colour&quot;]
 end
 
-namespace :spec do
-  desc &quot;Generate RCov report for #{plugin_name}&quot;
-  Spec::Rake::SpecTask.new(:rcov) do |t|
-    t.spec_files  = FileList['spec/**/*_spec.rb']
-    t.rcov        = true
-    t.rcov_dir    = 'doc/coverage'
-    t.rcov_opts   = ['--text-report', '--exclude', &quot;config/,spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}&quot;] 
-  end
-
-  namespace :rcov do
-    desc &quot;Verify RCov threshold for #{plugin_name}&quot;
-    RCov::VerifyTask.new(:verify =&gt; &quot;spec:rcov&quot;) do |t|
-      t.threshold = 100.0
-      t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
-    end
-  end
-  
-  desc &quot;Generate specdoc for #{plugin_name}&quot;
-  Spec::Rake::SpecTask.new(:doc) do |t|
-    t.spec_files  = FileList['spec/**/*_spec.rb']
-    t.spec_opts   = [&quot;--format&quot;, &quot;specdoc:SPECDOC&quot;]
-   end
+desc &quot;Generate RCov report for #{plugin_name}&quot;
+Spec::Rake::SpecTask.new(:rcov) do |t|
+  t.spec_files  = FileList['spec/**/*_spec.rb']
+  t.rcov        = true
+  t.rcov_dir    = 'doc/coverage'
+  t.rcov_opts   = ['--text-report', '--exclude', &quot;spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}&quot;] 
+end
 
-  namespace :doc do
-    desc &quot;Generate html specdoc for #{plugin_name}&quot;
-    Spec::Rake::SpecTask.new(:html =&gt; :rdoc) do |t|
-      t.spec_files    = FileList['spec/**/*_spec.rb']
-      t.spec_opts     = [&quot;--format&quot;, &quot;html:doc/rspec_report.html&quot;, &quot;--diff&quot;]
-    end
+namespace :rcov do
+  desc &quot;Verify RCov threshold for #{plugin_name}&quot;
+  RCov::VerifyTask.new(:verify =&gt; :rcov) do |t|
+    t.threshold = 100.0
+    t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
   end
 end
 
-task :rdoc =&gt; :doc
-task &quot;SPECDOC&quot; =&gt; &quot;spec:doc&quot;
+# load up the tasks for testing rspec generators against RC
+require File.join(File.dirname(__FILE__), 'spec/generate_rake_task')
 
-desc &quot;Generate rdoc for #{plugin_name}&quot;
-Rake::RDocTask.new(:doc) do |t|
-  t.rdoc_dir = 'doc'
-  t.main     = 'README.rdoc'
-  t.title    = &quot;#{plugin_name}&quot;
-  t.template = ENV['RDOC_TEMPLATE']
-  t.options  = ['--line-numbers', '--inline-source', '--all']
-  t.rdoc_files.include('README.rdoc', 'SPECDOC', 'MIT-LICENSE', 'CHANGELOG')
-  t.rdoc_files.include('lib/**/*.rb')
-end
+task :rdoc =&gt; 'doc:build'
+task :doc =&gt; 'doc:build'
 
-namespace :doc do 
-  desc &quot;Generate all documentation (rdoc, specdoc, specdoc html and rcov) for #{plugin_name}&quot;
-  task :all =&gt; [&quot;spec:doc:html&quot;, &quot;spec:doc&quot;, &quot;spec:rcov&quot;, &quot;doc&quot;]
+namespace :doc do
+  
+  current_sha = `git log HEAD -1 --pretty=format:&quot;%H&quot;`[0..6]
+  
+  Rake::RDocTask.new(:build) do |d|
+    d.rdoc_dir = 'doc'
+    d.main     = 'README.rdoc'
+    d.title    = &quot;#{plugin_name} API Docs (#{current_sha})&quot;
+    d.rdoc_files.include('README.rdoc', 'History.txt', 'License.txt', 'Todo.txt', 'lib/**/*.rb')
+  end
+  
+  task :push =&gt; 'doc:build' do
+    mv 'doc', 'newdoc'
+    on_gh_pages do
+      if doc_changed_sha?('newdoc', 'doc')
+        puts &quot;doc has changed, pushing to gh-pages&quot;
+        `rm -rf doc &amp;&amp; mv newdoc doc`
+        `git add doc`
+        `git commit -a -m &quot;Update API docs&quot;`
+        `git push`
+      else
+        puts &quot;doc is unchanged&quot;
+        rm_rf 'newdoc'
+      end
+    end
+  end
+  
+  def doc_changed_sha?(docpath1, docpath2)
+    `cat #{docpath1}/index.html | grep &quot;&lt;title&gt;&quot;` != `cat #{docpath2}/index.html | grep &quot;&lt;title&gt;&quot;`
+  end
+  
+  def on_gh_pages(&amp;block)
+    `git branch -m gh-pages orig-gh-pages &gt; /dev/null 2&gt;&amp;1`
+    `git checkout -b gh-pages origin/gh-pages`
+    `git pull`
+    yield
+  ensure
+    `git checkout master`
+    `git branch -D gh-pages`
+    `git branch -m orig-gh-pages gh-pages &gt; /dev/null 2&gt;&amp;1`
+  end
 end
 
-# load up the tasks for testing rspec generators against RC
-require File.join(File.dirname(__FILE__), 'spec/generate_rake_task')
-
 task :cruise do
-  # run the garlic task, capture the output, if succesful make the docs and copy them to ardes
   sh &quot;garlic clean &amp;&amp; garlic all&quot;
-  `garlic run &gt; .garlic/report.txt`
-  `scp -i ~/.ssh/ardes .garlic/report.txt ardes@ardes.com:~/subdomains/plugins/httpdocs/doc/#{plugin_name}_garlic_report.txt`
-  `cd .garlic/*/vendor/plugins/#{plugin_name}; rake doc:all; scp -i ~/.ssh/ardes -r doc ardes@ardes.com:~/subdomains/plugins/httpdocs/doc/#{plugin_name}`
+  Rake::Task['doc:push'].invoke
   puts &quot;The build is GOOD&quot;
 end
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>CHANGELOG</filename>
    </removed>
    <removed>
      <filename>MIT-LICENSE</filename>
    </removed>
    <removed>
      <filename>TODO</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>0f8aaf3397e2072c3b3e48ffd963ace859cb468f</id>
    </parent>
  </parents>
  <author>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </author>
  <url>http://github.com/ianwhite/resources_controller/commit/cca4373481fb2bf6098729f74723a915dce582a3</url>
  <id>cca4373481fb2bf6098729f74723a915dce582a3</id>
  <committed-date>2009-02-13T06:26:03-08:00</committed-date>
  <authored-date>2009-02-13T06:26:03-08:00</authored-date>
  <message>Simplify Rakefile and push docs to gh-pages on succesful build</message>
  <tree>3aed6a0ce3a53daab291cd3c1ad4f44101f92e30</tree>
  <committer>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </committer>
</commit>
