<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
 gem_deploy.rake
 pkg
-coverage
\ No newline at end of file
+coverage
+*.tmproj
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -7,9 +7,13 @@ end
 
 require 'rake/rdoctask'
 require 'spec/rake/spectask'
+require 'rake/gempackagetask'
 
 # allow require of spec/spec_helper
-$:.unshift File.dirname(__FILE__) + '/../'
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../'
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
+
+require 'thinking_sphinx'
 
 desc 'Generate documentation'
 Rake::RDocTask.new(:rdoc) do |rdoc|
@@ -31,4 +35,32 @@ Spec::Rake::SpecTask.new(:rcov) do |t|
   t.spec_files = FileList['spec/**/*_spec.rb']
   t.rcov = true
   t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems', '--exclude', 'riddle']
+end
+
+spec = Gem::Specification.new do |s|
+  s.name              = &quot;thinking_sphinx&quot;
+  s.version           = ThinkingSphinx::Version::String
+  s.summary           = &quot;A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching.&quot;
+  s.description       = &quot;A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching.&quot;
+  s.author            = &quot;Pat Allan&quot;
+  s.email             = &quot;pat@freelancing-gods.com&quot;
+  s.homepage          = &quot;http://ts.freelancing-gods.com&quot;
+  s.has_rdoc          = true
+  s.rdoc_options     &lt;&lt; &quot;--title&quot; &lt;&lt; &quot;Thinking Sphinx -- Rails/Merb Sphinx Plugin&quot; &lt;&lt;
+                        &quot;--line-numbers&quot;
+  s.rubyforge_project = &quot;thinking-sphinx&quot;
+  s.test_files        = FileList[&quot;spec/**/*_spec.rb&quot;]
+  s.files             = FileList[
+    &quot;lib/**/*.rb&quot;,
+    &quot;LICENCE&quot;,
+    &quot;README&quot;,
+    &quot;tasks/**/*.rb&quot;,
+    &quot;tasks/**/*.rake&quot;
+  ]
+end
+
+Rake::GemPackageTask.new(spec) do |p|
+  p.gem_spec = spec
+  p.need_tar = true
+  p.need_zip = true
 end
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -66,10 +66,14 @@ module ThinkingSphinx
           # if running in the test environment.
           # 
           def index_delta
-            unless ThinkingSphinx::Configuration.environment == &quot;test&quot; || !ThinkingSphinx.deltas_enabled?
-              configuration = ThinkingSphinx::Configuration.new
-              system &quot;indexer --config #{configuration.config_file} --rotate #{self.class.name.downcase}_delta&quot;
+            if ThinkingSphinx::Configuration.environment == &quot;test&quot; ||
+              !ThinkingSphinx.deltas_enabled?
+              return true
             end
+            
+            configuration = ThinkingSphinx::Configuration.new
+            system &quot;indexer --config #{configuration.config_file} --rotate #{self.class.name.downcase}_delta&quot;
+            
             true
           end
         end</diff>
      <filename>lib/thinking_sphinx/active_record/delta.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,13 +156,13 @@ source #{model.name.downcase}_#{i}_delta : #{model.name.downcase}_#{i}_core
 index #{model.name.downcase}_core
 {
   #{source_list}
-  morphology = #{self.morphology}
+  morphology = #{index.options[:morphology] || self.morphology}
   path = #{self.searchd_file_path}/#{model.name.downcase}_core
-  charset_type = #{self.charset_type}
+  charset_type = #{index.options[:charset_type] || self.charset_type}
   INDEX
-          unless self.charset_table.nil?
+          unless index.options[:charset_type].nil? &amp;&amp; self.charset_table.nil?
             file.write &lt;&lt;-INDEX
-  charset_table  = #{self.charset_table}
+  charset_table  = #{index.options[:charset_type] || self.charset_table}
             INDEX
           end
           </diff>
      <filename>lib/thinking_sphinx/configuration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,7 @@ CREATE TABLE `people` (
   `birthday` datetime NOT NULL,
   `team_id` int(11) NULL,
   `team_type` varchar(50) NULL,
+  `delta` tinyint(1) NOT NULL DEFAULT 0,
   PRIMARY KEY  (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 </diff>
      <filename>spec/fixtures/structure.sql</filename>
    </modified>
    <modified>
      <diff>@@ -0,0 +1,184 @@
+require 'spec/spec_helper'
+
+describe &quot;ThinkingSphinx::ActiveRecord::Delta&quot; do
+  describe &quot;after_commit callback&quot; do
+    before :each do
+      Person.stub_method(:write_inheritable_array =&gt; true)
+    end
+    
+    after :each do
+      Person.unstub_method(:write_inheritable_array)
+    end
+    
+    it &quot;should add callbacks&quot; do
+      Person.after_commit :toggle_delta
+      
+      Person.should have_received(:write_inheritable_array).with(
+        :after_commit, [:toggle_delta]
+      )
+    end
+  end
+  
+  describe &quot;save_with_after_commit_callback method&quot; do
+    before :each do
+      @person = Person.new
+      @person.stub_methods(
+        :save_without_after_commit_callback =&gt; true,
+        :callback                           =&gt; true
+      )
+    end
+    
+    it &quot;should call the normal save method&quot; do
+      @person.save
+      
+      @person.should have_received(:save_without_after_commit_callback)
+    end
+    
+    it &quot;should call the callbacks if the save was successful&quot; do
+      @person.save
+      
+      @person.should have_received(:callback).with(:after_commit)
+    end
+    
+    it &quot;shouldn't call the callbacks if the save failed&quot; do
+      @person.stub_method(:save_without_after_commit_callback =&gt; false)
+      
+      @person.save
+      
+      @person.should_not have_received(:callback)
+    end
+    
+    it &quot;should return the normal save's result&quot; do
+      @person.save.should be_true
+      
+      @person.stub_method(:save_without_after_commit_callback =&gt; false)
+      
+      @person.save.should be_false
+    end
+  end
+  
+  describe &quot;save_with_after_commit_callback! method&quot; do
+    before :each do
+      @person = Person.new
+      @person.stub_methods(
+        :save_without_after_commit_callback! =&gt; true,
+        :callback                            =&gt; true
+      )
+    end
+    
+    it &quot;should call the normal save! method&quot; do
+      @person.save!
+      
+      @person.should have_received(:save_without_after_commit_callback!)
+    end
+    
+    it &quot;should call the callbacks if the save! was successful&quot; do
+      @person.save!
+      
+      @person.should have_received(:callback).with(:after_commit)
+    end
+    
+    it &quot;shouldn't call the callbacks if the save! failed&quot; do
+      @person.stub_method(:save_without_after_commit_callback! =&gt; false)
+      
+      @person.save!
+      
+      @person.should_not have_received(:callback)
+    end
+    
+    it &quot;should return the normal save's result&quot; do
+      @person.save!.should be_true
+      
+      @person.stub_method(:save_without_after_commit_callback! =&gt; false)
+      
+      @person.save!.should be_false
+    end
+  end
+  
+  describe &quot;destroy_with_after_commit_callback method&quot; do
+    before :each do
+      @person = Person.new
+      @person.stub_methods(
+        :destroy_without_after_commit_callback  =&gt; true,
+        :callback                               =&gt; true
+      )
+    end
+    
+    it &quot;should call the normal destroy method&quot; do
+      @person.destroy
+      
+      @person.should have_received(:destroy_without_after_commit_callback)
+    end
+    
+    it &quot;should call the callbacks if the destroy was successful&quot; do
+      @person.destroy
+      
+      @person.should have_received(:callback).with(:after_commit)
+    end
+    
+    it &quot;shouldn't call the callbacks if the destroy failed&quot; do
+      @person.stub_method(:destroy_without_after_commit_callback =&gt; false)
+      
+      @person.destroy
+      
+      @person.should_not have_received(:callback)
+    end
+    
+    it &quot;should return the normal save's result&quot; do
+      @person.destroy.should be_true
+      
+      @person.stub_method(:destroy_without_after_commit_callback =&gt; false)
+      
+      @person.destroy.should be_false
+    end
+  end
+  
+  describe &quot;toggle_delta method&quot; do
+    it &quot;should set the delta value to true&quot; do
+      @person = Person.new
+      
+      @person.delta.should be_false
+      @person.send(:toggle_delta)
+      @person.delta.should be_true
+    end
+  end
+  
+  describe &quot;index_delta method&quot; do
+    before :each do
+      ThinkingSphinx::Configuration.stub_method(:environment =&gt; &quot;spec&quot;)
+      ThinkingSphinx.stub_method(:deltas_enabled? =&gt; true)
+      
+      @person = Person.new
+      @person.stub_method(:system =&gt; true)
+    end
+    
+    after :each do
+      ThinkingSphinx::Configuration.unstub_method(:environment)
+      ThinkingSphinx.unstub_method(:deltas_enabled?)
+    end
+    
+    it &quot;shouldn't index if delta indexing is disabled&quot; do
+      ThinkingSphinx.stub_method(:deltas_enabled? =&gt; false)
+      
+      @person.send(:index_delta)
+      
+      @person.should_not have_received(:system)
+    end
+    
+    it &quot;shouldn't index if the environment is 'test'&quot; do
+      ThinkingSphinx::Configuration.stub_method(:environment =&gt; &quot;test&quot;)
+      
+      @person.send(:index_delta)
+      
+      @person.should_not have_received(:system)
+    end
+    
+    it &quot;should call indexer for the delta index&quot; do
+      @person.send(:index_delta)
+      
+      @person.should have_received(:system).with(
+        &quot;indexer --config #{ThinkingSphinx::Configuration.new.config_file} --rotate person_delta&quot;
+      )
+    end
+  end
+end
\ No newline at end of file</diff>
      <filename>spec/unit/thinking_sphinx/active_record/delta_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9f9e58b4b0be48907293427d883ac0f39c8be8f7</id>
    </parent>
  </parents>
  <author>
    <name>Pat Allan</name>
    <email>pat@freelancing-gods.com</email>
  </author>
  <url>http://github.com/freelancing-god/thinking-sphinx/commit/70448dc7d9df9b8f419b41ec23a25d5158598b2d</url>
  <id>70448dc7d9df9b8f419b41ec23a25d5158598b2d</id>
  <committed-date>2008-04-21T02:24:33-07:00</committed-date>
  <authored-date>2008-04-21T02:24:33-07:00</authored-date>
  <message>Added gem building rake task. Completed specs for ThinkingSphinx::ActiveRecord::Delta. Added delta field to spec's Person model. Tweaked charset and morphology settings to allow index-specific values.</message>
  <tree>da98c30239d21ea891f0fad69e2d0eeb2f707aa9</tree>
  <committer>
    <name>Pat Allan</name>
    <email>pat@freelancing-gods.com</email>
  </committer>
</commit>
