<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,25 +1,120 @@
+# I think this is the one that should be moved to the extension Rakefile template
+
+# In rails 1.2, plugins aren't available in the path until they're loaded.
+# Check to see if the rspec plugin is installed first and require
+# it if it is.  If not, use the gem version.
+
+# Determine where the RSpec plugin is by loading the boot
+unless defined? RADIANT_ROOT
+  ENV[&quot;RAILS_ENV&quot;] = &quot;test&quot;
+  case
+  when ENV[&quot;RADIANT_ENV_FILE&quot;]
+    require File.dirname(ENV[&quot;RADIANT_ENV_FILE&quot;]) + &quot;/boot&quot;
+  when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
+    require &quot;#{File.expand_path(File.dirname(__FILE__) + &quot;/../../../../../&quot;)}/config/boot&quot;
+  else
+    require &quot;#{File.expand_path(File.dirname(__FILE__) + &quot;/../../../&quot;)}/config/boot&quot;
+  end
+end
+
 require 'rake'
-require 'rake/testtask'
 require 'rake/rdoctask'
+require 'rake/testtask'
 
-desc 'Default: run unit tests.'
-task :default =&gt; :test
+rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
+$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+require 'spec/rake/spectask'
+# require 'spec/translator'
 
-desc 'Test the share_layouts extension.'
-Rake::TestTask.new(:test) do |t|
-  t.libs &lt;&lt; 'lib'
-  t.pattern = 'test/**/*_test.rb'
-  t.verbose = true
+# Cleanup the RADIANT_ROOT constant so specs will load the environment
+Object.send(:remove_const, :RADIANT_ROOT)
+
+extension_root = File.expand_path(File.dirname(__FILE__))
+
+task :default =&gt; :spec
+task :stats =&gt; &quot;spec:statsetup&quot;
+
+desc &quot;Run all specs in spec directory&quot;
+Spec::Rake::SpecTask.new(:spec) do |t|
+  t.spec_opts = ['--options', &quot;\&quot;#{extension_root}/spec/spec.opts\&quot;&quot;]
+  t.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+namespace :spec do
+  desc &quot;Run all specs in spec directory with RCov&quot;
+  Spec::Rake::SpecTask.new(:rcov) do |t|
+    t.spec_opts = ['--options', &quot;\&quot;#{extension_root}/spec/spec.opts\&quot;&quot;]
+    t.spec_files = FileList['spec/**/*_spec.rb']
+    t.rcov = true
+    t.rcov_opts = ['--exclude', 'spec', '--rails']
+  end
+  
+  desc &quot;Print Specdoc for all specs&quot;
+  Spec::Rake::SpecTask.new(:doc) do |t|
+    t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--dry-run&quot;]
+    t.spec_files = FileList['spec/**/*_spec.rb']
+  end
+
+  [:models, :controllers, :views, :helpers].each do |sub|
+    desc &quot;Run the specs under spec/#{sub}&quot;
+    Spec::Rake::SpecTask.new(sub) do |t|
+      t.spec_opts = ['--options', &quot;\&quot;#{extension_root}/spec/spec.opts\&quot;&quot;]
+      t.spec_files = FileList[&quot;spec/#{sub}/**/*_spec.rb&quot;]
+    end
+  end
+  
+  # Hopefully no one has written their extensions in pre-0.9 style
+  # desc &quot;Translate specs from pre-0.9 to 0.9 style&quot;
+  # task :translate do
+  #   translator = ::Spec::Translator.new
+  #   dir = RAILS_ROOT + '/spec'
+  #   translator.translate(dir, dir)
+  # end
+
+  # Setup specs for stats
+  task :statsetup do
+    require 'code_statistics'
+    ::STATS_DIRECTORIES &lt;&lt; %w(Model\ specs spec/models)
+    ::STATS_DIRECTORIES &lt;&lt; %w(View\ specs spec/views)
+    ::STATS_DIRECTORIES &lt;&lt; %w(Controller\ specs spec/controllers)
+    ::STATS_DIRECTORIES &lt;&lt; %w(Helper\ specs spec/views)
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;Model specs&quot;
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;View specs&quot;
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;Controller specs&quot;
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;Helper specs&quot;
+    ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
+  end
+
+  namespace :db do
+    namespace :fixtures do
+      desc &quot;Load fixtures (from spec/fixtures) into the current environment's database.  Load specific fixtures using FIXTURES=x,y&quot;
+      task :load =&gt; :environment do
+        require 'active_record/fixtures'
+        ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
+        (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
+          Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
+        end
+      end
+    end
+  end
 end
 
-desc 'Generate documentation for the share_layouts extension.'
+desc 'Generate documentation for the &lt;%= file_name %&gt; extension.'
 Rake::RDocTask.new(:rdoc) do |rdoc|
   rdoc.rdoc_dir = 'rdoc'
-  rdoc.title    = 'ShareLayoutsExtension'
+  rdoc.title    = '&lt;%= class_name %&gt;'
   rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source'
   rdoc.rdoc_files.include('README')
   rdoc.rdoc_files.include('lib/**/*.rb')
 end
 
+# For extensions that are in transition
+desc 'Test the &lt;%= file_name %&gt; extension.'
+Rake::TestTask.new(:test) do |t|
+  t.libs &lt;&lt; 'lib'
+  t.pattern = 'test/**/*_test.rb'
+  t.verbose = true
+end
+
 # Load any custom rakefiles for extension
 Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -21,9 +21,8 @@ class RailsPage &lt; Page
   end
    
   def build_parts_from_hash!(content)
-    parts.clear
     content.each do |k,v|
-      parts.build(:name =&gt; k.to_s, :content =&gt; v)
+      (part(k) || parts.build(:name =&gt; k.to_s)).content = v
     end
   end 
   </diff>
      <filename>app/models/rails_page.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,10 @@
 module ShareLayouts::Helper
   
   def radiant_layout(name = @radiant_layout)
-    returning String.new do |output|
-      page = find_page
-      assign_attributes!(page, name)
-      page.build_parts_from_hash!(extract_captures) 
-      output &lt;&lt; page.render
-    end
+    page = find_page
+    assign_attributes!(page, name)
+    page.build_parts_from_hash!(extract_captures) 
+    page.render
   end
   
   def assign_attributes!(page, name = @radiant_layout)</diff>
      <filename>lib/share_layouts/helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,6 @@ class ShareLayoutsExtensionTest &lt; Test::Unit::TestCase
   end
   
   def test_should_add_helper
-    assert ApplicationController.master_helper_module.included_modules.include?(ShareLayouts::Helper)
+    assert ActionView::Base.included_modules.include?(ShareLayouts::Helper)
   end
 end</diff>
      <filename>test/functional/share_layouts_extension_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,4 +46,16 @@ class RailsPageTest &lt; Test::Unit::TestCase
   def test_should_defer_to_default_url_when_not_initialized
     assert_equal '/app/', pages(:rails_page).url
   end
+  
+  def test_should_modify_existing_parts_but_not_save_them
+    @page = pages(:rails_page)
+    @page.parts.create(:name =&gt; &quot;sidebar&quot;, :content =&gt; &quot;This is the sidebar.&quot;)
+    
+    @page.build_parts_from_hash!(:body =&gt; &quot;This is the body&quot;)
+    assert_equal 'This is the sidebar.', @page.part(:sidebar).content
+    
+    @page.build_parts_from_hash!(:sidebar =&gt; &quot;OVERRIDE&quot;)
+    assert_equal 'OVERRIDE', @page.part(:sidebar).content
+    assert_equal 'This is the sidebar.', @page.part(:sidebar).reload.content
+  end
 end</diff>
      <filename>test/unit/rails_page_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,7 @@ TEXT
   
   def test_should_assign_layout_of_page
     assign_attributes!(@page)
-    assert_equal @page._layout, layouts(:main)
+    assert_equal @page.layout, layouts(:main)
   end
   
   def test_should_assign_page_title_from_instance_var</diff>
      <filename>test/unit/share_layouts_helper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9021a56fd2c0f3fba57267a90107ef13951f5150</id>
    </parent>
  </parents>
  <author>
    <name>Sean Cribbs</name>
    <email>seancribbs@gmail.com</email>
  </author>
  <url>http://github.com/radiant/radiant-share-layouts-extension/commit/d1264342acad95d2b5a5814f5724bda0454d3fa2</url>
  <id>d1264342acad95d2b5a5814f5724bda0454d3fa2</id>
  <committed-date>2008-06-24T08:24:21-07:00</committed-date>
  <authored-date>2008-06-24T08:24:21-07:00</authored-date>
  <message>Allow RailsPages in the tree to provide content to views rendered by controllers.</message>
  <tree>8198fa16fadac0180cbd3a2babbb4304ada99afd</tree>
  <committer>
    <name>Sean Cribbs</name>
    <email>seancribbs@gmail.com</email>
  </committer>
</commit>
