<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,7 @@ module Admin
     before :find_article, :only =&gt; %w(edit update delete show)
 
     def index
-      @articles = Article.paginate(:page =&gt; params[:page], :per_page =&gt; 10, :order =&gt; &quot;created_at DESC&quot;)
+      @articles = Article.paginate(:page =&gt; params[:page], :per_page =&gt; 10, :order =&gt; [:created_at.desc])
       display @articles
     end
     </diff>
      <filename>app/controllers/admin/articles.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ module Admin
     before :check_for_user
     
     def index
-      @activity = Activity.all(:order =&gt; &quot;created_at DESC&quot;, :limit =&gt; 5)
+      @activity = Activity.all(:order =&gt; [:created_at.desc], :limit =&gt; 5)
       display @activity
     end
     </diff>
      <filename>app/controllers/admin/dashboard.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,7 @@ class Application &lt; Merb::Controller
   ##
   # This ensures all plugins are loaded before any requests are dealt with - if one of the other server processes in a cluster adds one, it needs to be picked up
   def load_plugins
-    Plugin.all(:order =&gt; :name).each do |plugin|
+    Plugin.all(:order =&gt; [:name]).each do |plugin|
       plugin.load unless plugin.loaded?
     end
   end</diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,8 @@ class Articles &lt; Application
 
   # This handles the index (recent articles), or the year/month/day views
   def index
-    @archives = Article.get_archive_hash
+    #@archives = Article.get_archive_hash
+    @archives = []
     if params[:day]
       @articles = Article.find_by_year_month_day(params[:year], params[:month], params[:day])
     elsif params[:month]</diff>
      <filename>app/controllers/articles.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,9 @@
-class Activity &lt; DataMapper::Base
-  property :message, :string, :nullable =&gt; false, :length =&gt; 255
-  property :created_at, :datetime
+class Activity
+
+  include DataMapper::Resource
+  
+  property :id, Integer, :key =&gt; true
+  property :message, String, :nullable =&gt; false, :length =&gt; 255
+  property :created_at, DateTime
+
 end
\ No newline at end of file</diff>
      <filename>app/models/activity.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,30 +1,37 @@
-class Article &lt; DataMapper::Base  
-  property :title, :string, :nullable =&gt; false, :length =&gt; 255
-  property :content, :text, :nullable =&gt; false
-  property :created_at, :datetime
-  property :published_at, :datetime
-  property :user_id, :integer, :nullable =&gt; false
-  property :permalink, :string, :length =&gt; 255
-  property :published, :boolean, :default =&gt; false
-  property :formatter, :string, :default =&gt; &quot;default&quot;
-  validates_presence_of :title, :key =&gt; &quot;uniq_title&quot;
-  validates_presence_of :content, :key =&gt; &quot;uniq_content&quot;
-  validates_presence_of :user_id, :key =&gt; &quot;uniq_user_id&quot;
+class Article
+  
+  include DataMapper::Resource
+  include DataMapper::Validate
+  
+  property :id, Integer, :key =&gt; true
+  property :title, String, :nullable =&gt; false, :length =&gt; 255
+  # was TEXT, should be TEXT again
+  property :content, String, :nullable =&gt; false
+  property :created_at, DateTime
+  property :published_at, DateTime
+  property :user_id, Integer, :nullable =&gt; false
+  property :permalink, String, :length =&gt; 255
+  property :published, TrueClass, :default =&gt; false
+  property :formatter, String, :default =&gt; &quot;default&quot;
+  
+  validates_present :title, :key =&gt; &quot;uniq_title&quot;
+  validates_present :content, :key =&gt; &quot;uniq_content&quot;
+  validates_present :user_id, :key =&gt; &quot;uniq_user_id&quot;
   
   belongs_to :user
   
   # Core filters
-  before_save :set_published_permalink
-  after_create :set_create_activity
-  after_update :set_update_activity
+  before :save, :set_published_permalink
+  after :save, :set_create_activity
+  after :save, :set_update_activity
   
   # Event hooks for plugins
-  before_create :fire_before_create_event
-  before_update :fire_before_update_event
-  before_save :fire_before_save_event
-  after_create :fire_after_create_event
-  after_update :fire_after_update_event
-  after_save :fire_after_save_event
+  before :save, :fire_before_create_event
+  before :save, :fire_before_update_event
+  before :save, :fire_before_save_event
+  after :save, :fire_after_create_event
+  after :save, :fire_after_update_event
+  after :save, :fire_after_save_event
   
   ##
   # This sets the published date and permalink when an article is published
@@ -41,23 +48,29 @@ class Article &lt; DataMapper::Base
   end
 
   def set_create_activity
-    a = Activity.new
-    a.message = &quot;Article \&quot;#{self.title}\&quot; created&quot;
-    a.save
+    if new_record?
+      a = Activity.new
+      a.message = &quot;Article \&quot;#{self.title}\&quot; created&quot;
+      a.save
+    end
   end
 
   def set_update_activity
-    a = Activity.new
-    a.message = &quot;Article \&quot;#{self.title}\&quot; updated&quot;
-    a.save
+    unless new_record?
+      a = Activity.new
+      a.message = &quot;Article \&quot;#{self.title}\&quot; updated&quot;
+      a.save
+    end
   end
 
   def fire_before_create_event
-    Hooks::Events.before_create_article(self)
+    if new_record?
+      Hooks::Events.before_create_article(self)
+    end
   end
 
   def fire_before_update_event
-    Hooks::Events.before_update_article(self)
+    Hooks::Events.before_update_article(self) unless new_record?
   end
 
   def fire_before_save_event
@@ -66,11 +79,13 @@ class Article &lt; DataMapper::Base
   end
 
   def fire_after_create_event
-    Hooks::Events.after_create_article(self)
+    if new_record?
+      Hooks::Events.after_create_article(self)
+    end
   end
   
   def fire_after_update_event
-    Hooks::Events.after_update_article(self)
+    Hooks::Events.after_update_article(self) unless new_record?
   end
 
   def fire_after_save_event
@@ -102,22 +117,22 @@ class Article &lt; DataMapper::Base
     # Custom finders
 
     def find_recent
-      self.all(:published =&gt; true, :limit =&gt; 10, :order =&gt; &quot;published_at DESC&quot;)
+      self.all(:published =&gt; true, :limit =&gt; 10, :order =&gt; [:published_at.desc])
     end
 
     def find_by_year(year)
-      self.all(:published_at.like =&gt; &quot;#{year}%&quot;, :published =&gt; true, :order =&gt; &quot;published_at DESC&quot;)
+      self.all(:published_at.like =&gt; &quot;#{year}%&quot;, :published =&gt; true, :order =&gt; [:published_at.desc])
     end
 
     def find_by_year_month(year, month)
       month = Padding::pad_single_digit(month)
-      self.all(:published_at.like =&gt; &quot;#{year}-#{month}%&quot;, :published =&gt; true, :order =&gt; &quot;published_at DESC&quot;)
+      self.all(:published_at.like =&gt; &quot;#{year}-#{month}%&quot;, :published =&gt; true, :order =&gt; [:published_at.desc])
     end
 
     def find_by_year_month_day(year, month, day)
       month = Padding::pad_single_digit(month)
       day = Padding::pad_single_digit(day)
-      self.all(:published_at.like =&gt; &quot;#{year}-#{month}-#{day}%&quot;, :published =&gt; true, :order =&gt; &quot;published_at DESC&quot;)
+      self.all(:published_at.like =&gt; &quot;#{year}-#{month}-#{day}%&quot;, :published =&gt; true, :order =&gt; [:published_at.desc])
     end
 
     def find_by_permalink(permalink)</diff>
      <filename>app/models/article.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,17 @@
-class Configuration &lt; DataMapper::Base
-  property :title, :string
-  property :tag_line, :string, :length =&gt; 255
-  property :about, :text
-  property :about_formatter, :string
-  property :permalink_format, :string
+class Configuration
 
-  after_save :set_activity
-  before_save :prepend_slash_on_permalink
+  include DataMapper::Resource
+
+  property :id, Integer, :key =&gt; true
+  property :title, String
+  property :tag_line, String, :length =&gt; 255
+  # TODO: was TEXT, is VARCHAR now, should be TEXT again
+  property :about, String
+  property :about_formatter, String
+  property :permalink_format, String
+
+  after :save, :set_activity
+  before :save, :prepend_slash_on_permalink
 
   def set_activity
     a = Activity.new</diff>
      <filename>app/models/configuration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,20 +1,23 @@
-class Plugin &lt; DataMapper::Base
-  property :url, :string, :length =&gt; 255
-  property :path, :string, :length =&gt; 255
-  property :name, :string
-  property :version, :string
-  property :author_name, :string
-  property :author_email, :string
-  property :author_homepage, :string
-  property :homepage, :string, :length =&gt; 255
-  property :about, :string, :length =&gt; 255
-  property :active, :boolean
+class Plugin
+  include DataMapper::Resource
 
-  before_create :download
-  after_create :install
-  after_create :set_create_activity
-  after_update :set_update_activity
-  after_destroy :remove
+  property :id, Integer, :key =&gt; true  
+  property :url, String, :length =&gt; 255
+  property :path, String, :length =&gt; 255
+  property :name, String
+  property :version, String
+  property :author_name, String
+  property :author_email, String
+  property :author_homepage, String
+  property :homepage, String, :length =&gt; 255
+  property :about, String, :length =&gt; 255
+  property :active, Boolean
+
+  before :save, :download
+  after :save, :install
+  after :save, :set_create_activity
+  after :save, :set_update_activity
+  after :destroy, :remove
 
   class &lt;&lt; self
     @@loaded = []
@@ -23,34 +26,38 @@ class Plugin &lt; DataMapper::Base
   ##
   # This grabs the plugin using its url, unpacks it, and loads the metadata for it
   def download
-    # Load the manifest yaml
-    manifest = YAML::load(Net::HTTP.get(URI.parse(url)))
-    # Grab metadata from manifest
-    self.name = manifest[&quot;name&quot;]
-    self.author = manifest[&quot;author&quot;]
-    self.version = manifest[&quot;version&quot;]
-    self.homepage = manifest[&quot;homepage&quot;]
-    self.about = manifest[&quot;about&quot;]
-    # Build the path
-    self.path = File.join(Merb.root, &quot;app&quot;, &quot;plugins&quot;, self.name)
-    # Remove any existing plugin at the path
-    FileUtils.rm_rf(self.path)
-    FileUtils.mkdir_p(self.path)
-    # Download the package and untgz
-    package_url = File.join(url.split('/').slice(0..-2).join('/'), manifest[&quot;package&quot;])
-    package = Net::HTTP.get(URI.parse(package_url))
-    Archive::Tar::Minitar.unpack(Zlib::GzipReader.new(StringIO.new(package)), self.path)
-    # Unpack any gems downloaded
-    unpack_gems(Dir.glob(File.join(self.path, &quot;gems&quot;, &quot;*.gem&quot;)).collect { |p| p.split(&quot;/&quot;).last })
+    if new_record?
+      # Load the manifest yaml
+      manifest = YAML::load(Net::HTTP.get(URI.parse(url)))
+      # Grab metadata from manifest
+      self.name = manifest[&quot;name&quot;]
+      self.author = manifest[&quot;author&quot;]
+      self.version = manifest[&quot;version&quot;]
+      self.homepage = manifest[&quot;homepage&quot;]
+      self.about = manifest[&quot;about&quot;]
+      # Build the path
+      self.path = File.join(Merb.root, &quot;app&quot;, &quot;plugins&quot;, self.name)
+      # Remove any existing plugin at the path
+      FileUtils.rm_rf(self.path)
+      FileUtils.mkdir_p(self.path)
+      # Download the package and untgz
+      package_url = File.join(url.split('/').slice(0..-2).join('/'), manifest[&quot;package&quot;])
+      package = Net::HTTP.get(URI.parse(package_url))
+      Archive::Tar::Minitar.unpack(Zlib::GzipReader.new(StringIO.new(package)), self.path)
+      # Unpack any gems downloaded
+      unpack_gems(Dir.glob(File.join(self.path, &quot;gems&quot;, &quot;*.gem&quot;)).collect { |p| p.split(&quot;/&quot;).last })
+    end
   end
 
   ##
   # This loads and installs the plugin
   def install
-    # Load the plugin
-    self.load
-    # Also, if there is an &quot;install.rb&quot; script present, run that to setup anything the plugin needs (database tables etc)
-    require File.join(self.path, &quot;install.rb&quot;) if File.exists?(File.join(self.path, &quot;install.rb&quot;))
+    if new_record?
+      # Load the plugin
+      self.load
+      # Also, if there is an &quot;install.rb&quot; script present, run that to setup anything the plugin needs (database tables etc)
+      require File.join(self.path, &quot;install.rb&quot;) if File.exists?(File.join(self.path, &quot;install.rb&quot;))
+    end
   rescue Exception =&gt; err
     # Catch the error, delete the plugin, and raise an error again
     self.destroy!
@@ -60,17 +67,21 @@ class Plugin &lt; DataMapper::Base
   ##
   # This adds the activity to show a plugin has been installed
   def set_create_activity
-    a = Activity.new
-    a.message = &quot;Plugin \&quot;#{self.name}\&quot; installed&quot;
-    a.save
+    if new_record?
+      a = Activity.new
+      a.message = &quot;Plugin \&quot;#{self.name}\&quot; installed&quot;
+      a.save
+    end
   end
 
   ##
   # This adds the activity to show a plugin has been updated
   def set_update_activity
-    a = Activity.new
-    a.message = &quot;Plugin \&quot;#{self.name}\&quot; #{self.active ? 'activated' : 'de-activated'}&quot;
-    a.save
+    unless new_record?
+      a = Activity.new
+      a.message = &quot;Plugin \&quot;#{self.name}\&quot; #{self.active ? 'activated' : 'de-activated'}&quot;
+      a.save
+    end
   end
 
   ##</diff>
      <filename>app/models/plugin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,10 @@
-class PluginSetting &lt; DataMapper::Base
-  property :handle, :string
-  property :value, :string
-  property :plugin_id, :integer
+class PluginSetting
+  include DataMapper::Resource
+  
+  property :id, Integer, :key =&gt; true
+  property :handle, String
+  property :value, String
+  property :plugin_id, Integer
 
   class &lt;&lt; self
     </diff>
      <filename>app/models/plugin_setting.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,49 +4,57 @@ begin
 rescue 
   nil
 end
-class User &lt; DataMapper::Base
+class User
+
+  include DataMapper::Resource
+  include DataMapper::Validate
   include AuthenticatedSystem::Model
 
   attr_accessor :password, :password_confirmation
 
-  property :login,                      :string
-  property :email,                      :string, :length =&gt; 255
-  property :crypted_password,           :string
-  property :salt,                       :string
-  property :remember_token_expires_at,  :datetime
-  property :remember_token,             :string
-  property :time_zone,                  :string
-  property :created_at,                 :datetime
-  property :updated_at,                 :datetime
-  property :name,                       :string
-  property :default_formatter,          :string
-
-  validates_length_of         :login,                   :within =&gt; 3..40
-  validates_uniqueness_of     :login
-  validates_presence_of       :password,                :if =&gt; proc {password_required?}
-  validates_presence_of       :password_confirmation,   :if =&gt; proc {password_required?}
-  validates_length_of         :password,                :within =&gt; 4..40, :if =&gt; proc {password_required?}
-  validates_confirmation_of   :password,                :groups =&gt; :create
-  validates_presence_of       :email
-
-  before_save :encrypt_password
-
-  after_create :set_create_activity
-  after_update :set_update_activity
+  property :id, Integer, :key =&gt; true
+  property :login,                      String
+  property :email,                      String, :length =&gt; 255
+  property :crypted_password,           String
+  property :salt,                       String
+  property :remember_token_expires_at,  DateTime
+  property :remember_token,             String
+  property :time_zone,                  String
+  property :created_at,                 DateTime
+  property :updated_at,                 DateTime
+  property :name,                       String
+  property :default_formatter,          String
+
+  validates_length            :login,                   :within =&gt; 3..40
+  validates_is_unique         :login
+  validates_present           :password,                :if =&gt; proc {password_required?}
+  validates_present           :password_confirmation,   :if =&gt; proc {password_required?}
+  validates_length            :password,                :within =&gt; 4..40, :if =&gt; proc {password_required?}
+  validates_is_confirmed      :password,                :groups =&gt; :create
+  validates_present           :email
+
+  before :save, :encrypt_password
+
+  after :save, :set_create_activity
+  after :save, :set_update_activity
 
   def set_create_activity
-    a = Activity.new
-    a.message = &quot;User \&quot;#{self.login}\&quot; created&quot;
-    a.save
+    if new_record?
+      a = Activity.new
+      a.message = &quot;User \&quot;#{self.login}\&quot; created&quot;
+      a.save
+    end
   end
 
   def set_update_activity
-    a = Activity.new
-    a.message = &quot;User \&quot;#{self.login}\&quot; updated&quot;
-    a.save
+    unless new_record?
+      a = Activity.new
+      a.message = &quot;User \&quot;#{self.login}\&quot; updated&quot;
+      a.save
+    end
   end
 
-  def login=(value)
-    @login = value.downcase unless value.nil?
+  def login=(value);
+    attribute_set :login, value.downcase unless value.nil?
   end
 end
\ No newline at end of file</diff>
      <filename>app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,7 +40,7 @@ use_orm :datamapper
 ### merb.
 ###
 # use_test :test_unit
-use_test :rspec, 'merb_stories'
+use_test :rspec, &quot;merb_stories&quot;
 
 ### Add your other dependencies here
 
@@ -50,9 +50,16 @@ gem &quot;archive-tar-minitar&quot;
 dependencies &quot;merb_helpers&quot;
 dependencies &quot;merb-assets&quot;
 dependencies &quot;merb-cache&quot;
+dependency &quot;merb_helpers&quot;
+dependency &quot;merb-assets&quot;
+dependency &quot;merb-cache&quot;
 dependency &quot;merb-action-args&quot;
 dependency &quot;merb-mailer&quot;
 dependency 'merb_paginate'
+dependency &quot;dm-aggregates&quot;
+dependency &quot;dm-validations&quot;
+dependency &quot;dm-timestamps&quot;
+
 # OR
 # OR
 # dependencies &quot;RedCloth&quot; =&gt; &quot;&gt; 3.0&quot;, &quot;ruby-aes-cext&quot; =&gt; &quot;= 1.0&quot;
@@ -73,7 +80,7 @@ Merb::BootLoader.after_app_loads do
 
   # This loads the plugins
   begin
-    Plugin.all(:order =&gt; :name).each do |p|
+    Plugin.all(:order =&gt; [:name]).each do |p|
       begin
         p.load
         Merb.logger.info(&quot;\&quot;#{p.name}\&quot; loaded&quot;)</diff>
      <filename>config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,9 @@ require 'merb_paginate/core_ext'
 
 if Object.const_defined? &quot;DataMapper&quot;
   require 'merb_paginate/finders/datamapper'
-  DataMapper::Base.class_eval { include MerbPaginate::Finders::Datamapper }
+  # better than using Gem.loaded_specs as RubyGems is not required
+  target = DataMapper.const_defined?('Base') ? 'Base' : 'Resource'
+  DataMapper::const_get(target).class_eval { include MerbPaginate::Finders::Datamapper }
 end
 
 if Object.const_defined? &quot;Sequel&quot;</diff>
      <filename>gems/gems/merb_paginate-0.0.4/lib/merb_paginate/finders.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ccd75644cde44d4756cd1dc45488999a92cb6904</id>
    </parent>
    <parent>
      <id>83123818442a131fd3fa6b22eda1f9baf0f5f17c</id>
    </parent>
  </parents>
  <author>
    <name>El Draper</name>
    <email>el@eldiablo.co.uk</email>
  </author>
  <url>http://github.com/jf/feather/commit/8de4ce0171b3d973b671e1214fa502bd1fb505ca</url>
  <id>8de4ce0171b3d973b671e1214fa502bd1fb505ca</id>
  <committed-date>2008-06-08T15:05:37-07:00</committed-date>
  <authored-date>2008-06-08T15:05:37-07:00</authored-date>
  <message>Merge branch 'dm-core' of git://github.com/aflatter/feather into aflatter/dm-core

Conflicts:

	app/models/plugin.rb
	config/init.rb</message>
  <tree>04ca5346d84afdd21cf800ea58b6d8eaeb1d6ca9</tree>
  <committer>
    <name>El Draper</name>
    <email>el@eldiablo.co.uk</email>
  </committer>
</commit>
