<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,9 @@
 $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
 require 'vanilla'
 
-Soup.prepare 
-
 desc &quot;Open an irb session preloaded with this library&quot;
 task :console do
-  sh &quot;irb -Ilib -rvanilla&quot;
+  sh &quot;irb -Ilib -rvanilla/console&quot;
 end
 
 task :clean do
@@ -13,10 +11,12 @@ task :clean do
   FileUtils.rm &quot;soup.db&quot; if File.exist?(&quot;soup.db&quot;)
 end
 
-task :bootstrap do
-  require 'vanilla/snip_helper'
-  
+task :prepare do
   Soup.prepare
+end
+
+task :bootstrap =&gt; :prepare do
+  require 'vanilla/snip_helper'
   
   Dynasnip.persist_all!(overwrite=true)
   
@@ -35,8 +35,35 @@ task :reset =&gt; [:clean, :bootstrap]
 
 namespace :upgrade do
   desc 'Upgrade the dynasnips'
-  task :dynasnips do
-    Dynasnip.persist_all!
+  task :dynasnips =&gt; :prepare do
+    Dynasnip.all.each do |dynasnip|
+      print &quot;Upgrading #{dynasnip.snip_name}... &quot;
+      # TODO: our confused Soup interface might return an array.
+      snip = Soup[dynasnip.snip_name]
+      if snip.empty? || snip.nil?
+        # it's a new dyna
+        Soup &lt;&lt; dynasnip.snip_attributes
+        puts &quot;(new)&quot;
+      elsif snip.created_at == snip.updated_at
+        # it's not been changed, let's upgrade
+        snip.destroy
+        Soup &lt;&lt; dynasnip.snip_attributes
+        puts &quot;(unedited)&quot;
+      else
+        # the dyna exists and has been changed
+        dynasnip.snip_attributes.each do |name, value|
+          unless (existing_value = snip.get_value(name)) == value
+            puts &quot;Conflict in attribute '#{name}':&quot;
+            puts &quot;&gt; Your soup: '#{existing_value}'&quot;
+            puts &quot;&gt;  New soup: '#{value}&quot;
+            print &quot;Upgrade? [Y/n]: &quot;
+            upgrade_value = [&quot;Y&quot;, &quot;y&quot;, &quot;&quot;].include? STDIN.gets.chomp.strip
+            snip.set_value(name, value) if upgrade_value
+          end
+        end
+        snip.save
+      end
+    end
   end
 end
 </diff>
      <filename>Rakefile</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>70ac35f39d721760a73151a05d1cb23f6fa5089c</id>
    </parent>
  </parents>
  <author>
    <name>James Adam</name>
    <login>lazyatom</login>
    <email>james@lazyatom.com</email>
  </author>
  <url>http://github.com/lazyatom/vanilla-rb/commit/452d4f1d0492c4bd3ce0b02d788d43cae6465ccb</url>
  <id>452d4f1d0492c4bd3ce0b02d788d43cae6465ccb</id>
  <committed-date>2008-06-04T14:19:18-07:00</committed-date>
  <authored-date>2008-06-04T14:19:18-07:00</authored-date>
  <message>We should be able to upgrade dynasnips without always clobbering modified attributes.</message>
  <tree>a5139099ed905e414bbdcb97cbd4fe3edb44687b</tree>
  <committer>
    <name>James Adam</name>
    <login>lazyatom</login>
    <email>james@lazyatom.com</email>
  </committer>
</commit>
