<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+* [10/22/2008] - 0.1.4
+  
+  Prevent rails/init from loading factories.rb, etc. if inside rake db:*
+
 * [10/22/2008] - 0.1.3
 
   FactoryBuilder was using #classify which also calls #singularize... now uses camelize instead.</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 Gem::Specification.new do |spec|
   spec.name = 'factories-and-workers'
-  spec.version = '0.1.3'
+  spec.version = '0.1.4'
   spec.date = '2008-10-22'
   spec.summary = 'Fixtures replacement'
   spec.email = 'david@internautdesign.com'</diff>
      <filename>factories-and-workers.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 if defined?(RAILS_ENV) &amp;&amp; __FILE__ =~ %r{vendor/plugins} # are we running as a rails plugin?
 
-# Modify the variable below to specify in which environments this plugin should be loaded.
+  # Modify the variable below to specify in which environments this plugin should be loaded.
   load_plugin_in = {
     'test'        =&gt; true,
     'development' =&gt; true,   # NOTE: often comes in handy in the console
@@ -24,5 +24,3 @@ else  # bootstrap the gem
   # end
 
 end  
-
-</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,26 +2,28 @@ require 'fileutils'
 
 config.after_initialize do
 
-  # if script_console_running = defined?(::IRB) &amp;&amp; ::IRB.conf[:LOAD_MODULES] &amp;&amp; ::IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
-  #   # mixin to Object if we are running in ./script/console
+  unless $*.grep(/db:*/)  # prevent the plugin from loading if we are simply running rake db:migrate, etc.
+    
+    # if script_console_running = defined?(::IRB) &amp;&amp; ::IRB.conf[:LOAD_MODULES] &amp;&amp; ::IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
+    #   # mixin to Object if we are running in ./script/console
     obj = Object
-  # else # otherwise just mix into Test::Unit to play it safe
-  #   obj = Test::Unit::TestCase
-  # end
+    # else # otherwise just mix into Test::Unit to play it safe
+    #   obj = Test::Unit::TestCase
+    # end
 
-  # mixin plugin
-  obj.send :include, FactoriesAndWorkers::Factory
-  obj.send :include, FactoriesAndWorkers::Worker
-  
-  # load factory and worker definition files if they exist
-  %w(spec/factories.rb spec/factory_workers.rb test/factories.rb test/factory_workers.rb).each do |file|
-    path = File.join(Dir.pwd, file)
-    require path if File.exists?(path)
-  end
+    # mixin plugin
+    obj.send :include, FactoriesAndWorkers::Factory
+    obj.send :include, FactoriesAndWorkers::Worker
 
-  # mixin factory and worker definitions
-  obj.send :include, ::TestFactories if defined?(TestFactories)
-  obj.send :include, ::FactoryWorkers if defined?(FactoryWorkers)
-end
+    # load factory and worker definition files if they exist
+    %w(spec/factories.rb spec/factory_workers.rb test/factories.rb test/factory_workers.rb).each do |file|
+      path = File.join(Dir.pwd, file)
+      require path if File.exists?(path)
+    end
 
+    # mixin factory and worker definitions
+    obj.send :include, ::TestFactories if defined?(TestFactories)
+    obj.send :include, ::FactoryWorkers if defined?(FactoryWorkers)
+  end
 
+end
\ No newline at end of file</diff>
      <filename>rails/init.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>979d324bc3d2f96b7d699383929587117a6efa94</id>
    </parent>
  </parents>
  <author>
    <name>David Lowenfels</name>
    <email>david@internautdesign.com</email>
  </author>
  <url>http://github.com/dfl/factories-and-workers/commit/4365282a6f95363731acd07a5bcf6ebcfa156212</url>
  <id>4365282a6f95363731acd07a5bcf6ebcfa156212</id>
  <committed-date>2008-10-22T14:13:47-07:00</committed-date>
  <authored-date>2008-10-22T14:13:47-07:00</authored-date>
  <message>Prevent rails/init from loading factories.rb, etc. if inside rake db:*</message>
  <tree>1b89fc6423c01275ba592b799ea6716454ba886a</tree>
  <committer>
    <name>David Lowenfels</name>
    <email>david@internautdesign.com</email>
  </committer>
</commit>
