<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/mephisto/plugin_about_patch.rb</filename>
    </added>
    <added>
      <filename>spec/controllers/plugin_routing_spec.rb</filename>
    </added>
    <added>
      <filename>spec/models/plugin_spec.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/CHANGELOG</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/MIT-LICENSE</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/README</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/Rakefile</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/about.yml</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/boot.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/generators/plugin_migration/USAGE</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/init.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/assets.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/plugin.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/plugin/list.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/plugin/loader.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/plugin/locator.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/plugin/migrator.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/rails.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/rails_extensions/routing.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/lib/engines/testing.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines/tasks/engines.rake</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/init.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/lib/engines/configurable.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/db/engines_config_plugin.sqlite3.db</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/plugins/plugin_alpha/about.yml</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/plugins/plugin_alpha/init.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/plugins/plugin_alpha/routes.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/test_engines_configurable.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/test_helper.rb</filename>
    </added>
    <added>
      <filename>vendor/plugins/engines_config/test/test_plugin_about_info.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,10 +1,10 @@
 &lt;tr class=&quot;published&quot; &gt;
   &lt;td class=&quot;published&quot;&gt;
 	&lt;% if plugin.configurable? -%&gt;
-		&lt;%= link_to plugin.path, :action =&gt; 'show', :id =&gt; plugin.path %&gt;
+		&lt;%= link_to plugin.mephisto_name, :action =&gt; 'show', :id =&gt; plugin.name %&gt;
 	&lt;% else -%&gt;
-		&lt;%=h plugin.path %&gt;
+		&lt;%=h plugin.mephisto_name %&gt;
 	&lt;% end -%&gt;
 &lt;/td&gt;
-  &lt;td  class=&quot;published&quot;&gt;&lt;%= plugin.configurable? ? link_to(image_tag('/images/mephisto/icons/8-em-check.png', :style =&gt; 'vertical-align: middle'), :action =&gt; &quot;show&quot;, :id =&gt; plugin.path) : '&amp;nbsp;' %&gt;&lt;/span&gt; &lt;/td&gt;
+  &lt;td  class=&quot;published&quot;&gt;&lt;%= plugin.configurable? ? link_to(image_tag('/images/mephisto/icons/8-em-check.png', :style =&gt; 'vertical-align: middle'), :action =&gt; &quot;show&quot;, :id =&gt; plugin.name) : '&amp;nbsp;' %&gt;&lt;/span&gt; &lt;/td&gt;
  &lt;/tr&gt;</diff>
      <filename>app/views/admin/plugins/_plugin.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,7 @@
 &lt;div id=&quot;page-nav&quot;&gt;
   &lt;ul id=&quot;act-nav&quot; class=&quot;clear&quot;&gt;
 	&lt;li&gt;
- 	 	&lt;%= link_to 'Restore Defaults', :action =&gt; 'destroy', :id =&gt; @plugin.plugin_name %&gt;
+ 	 	&lt;%= link_to 'Restore Defaults', :action =&gt; 'destroy', :id =&gt; @plugin.name %&gt;
 	&lt;/li&gt;
 	&lt;li&gt;
  	 	&lt;%= link_to 'Index', :action =&gt; 'index' %&gt;
@@ -33,7 +33,7 @@
 &lt;% end %&gt;
 
 &lt;% content_for :form  do -%&gt;
-	&lt;%= form_tag({:action =&gt; 'update', :id =&gt; @plugin.plugin_name}, {:id =&gt; 'plugin-config-form'}) %&gt;
+	&lt;%= form_tag({:action =&gt; 'update', :id =&gt; @plugin.name}, {:id =&gt; 'plugin-config-form'}) %&gt;
 &lt;% end -%&gt;
 
 &lt;% if @plugin.default_options.any? -%&gt;</diff>
      <filename>app/views/admin/plugins/show.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,8 @@
 
 # Bootstrap the Rails environment, frameworks, and default configuration
 require File.join(File.dirname(__FILE__), 'boot')
+require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
+require File.join(File.dirname(__FILE__), '../lib/mephisto/plugin')
 
 # requires vendor-loaded redcloth
 require 'RedCloth-3.0.4/lib/redcloth' unless Object.const_defined?(:RedCloth)</diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,8 @@ ActiveRecord::Base.observers = [:article_observer, :comment_observer]
 # it's loaded before all other plugins
 # Object::RAILS_PATH = Pathname.new(File.expand_path(RAILS_ROOT))
 
+require 'mephisto'
+
 class ActionController::Dispatcher
   def self.register_liquid_tags
     Mephisto.liquid_filters.each { |mod| Liquid::Template.register_filter mod }
@@ -36,5 +38,7 @@ Inflector.inflections do |inflect|
   inflect.uncountable %w( audio )
 end
 
+Engines::Plugin::Config.set_table_name 'mephisto_plugins'
+
 Dependencies.autoloaded_constants.delete &quot;Mephisto&quot;
 Dependencies.autoloaded_constants.delete &quot;Mephisto::Plugin&quot;
\ No newline at end of file</diff>
      <filename>config/initializers/mephisto_init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,187 +1,49 @@
-module Mephisto
-  # This module assists with general Mephisto plugins.
-  class Plugin &lt; ActiveRecord::Base
-    set_table_name 'mephisto_plugins'
-    serialize :options, Hash
-  
-    @@custom_routes = []
-    @@view_paths    = {}
-    @@tabs          = []
-    @@admin_tabs    = []
-    cattr_reader :custom_routes, :view_paths, :tabs, :admin_tabs
-  
-    class &lt;&lt; self
-      expiring_attr_reader :plugin_name, 'name.demodulize.underscore'
-      expiring_attr_reader :plugin_path, &quot;RAILS_PATH + 'vendor/plugins' + ('mephisto_' + plugin_name)&quot;
-  
-      plugin_property_source = %w(author version homepage notes).collect! do |property|
-        &lt;&lt;-END
-          def #{property}(value = nil)
-            @#{property} = value if value
-            @#{property}
-          end
-        END
-      end
-      eval plugin_property_source * &quot;\n&quot;
-  
-      # Finds or initializes a new plugin record from the database by the plugin name
-      def find_or_initialize
-        find_or_initialize_by_name(plugin_name)
-      end
-  
-      #
-      # Matches key to sub classes of Mephisto::Plugin in the namespace Mephisto::Plugins.
-      # In other words, your plugin needs to subclass the former and be within the latter.
-      #
-      def find_class(key)
-        klass_name = key.to_s.camelize
-        klass = Mephisto::Plugins.const_get klass_name
-        if klass &lt; Mephisto::Plugin
-          klass
-        else
-          raise NameError, &quot;Plugin class must subclass Mephisto::Plugin&quot;
-        end
-      end
-      
-      def [](key)
-        find_class(key).find_or_initialize
-      end
-      
-      def load(plugin_list)
-        returning find_all_by_name(plugin_list).index_by(&amp;:name) do |plugins|
-          plugin_list.each do |name|
-            if plugin_class = plugins[name].nil? &amp;&amp; self[name]
-              plugins[name] ||= plugin_class.new(:name =&gt; name)
-            end
-          end
-        end
-      end
-      
-      def default_options
-        @default_options ||= {}
-      end
-      
-      def option(property, default, field_type = :text_field)
-        class_eval &lt;&lt;-END, __FILE__, __LINE__
-            def #{property}
-              write_attribute(:options, {}) if read_attribute(:options).nil?
-              options[#{property.inspect}].blank? ? #{default.inspect} : options[#{property.inspect}]
-            end
-            
-            def #{property}=(value)
-              write_attribute(:options, {}) if read_attribute(:options).nil?
-              options[#{property.inspect}] = value
-            end
-          END
-        default_options[property] = field_type
-      end
-  
-      # Installs the plugin's tables using the schema file in lib/#{plugin_name}/schema.rb
-      #
-      #   script/runner -e production 'Mephisto::Plugins::Foo.install'
-      #   =&gt; installs the mephisto_foo plugin.
-      #
-      def install
-        self::Schema.install
-      end
-      
-      # Uninstalls the plugin's tables using the schema file in lib/#{plugin_name}/schema.rb
-      def uninstall
-        self::Schema.uninstall
-      end
-      
-      # Adds a custom route to Mephisto from a plugin.  These routes are created in the order they are added.  
-      # They will be the last routes before the Mephisto Dispatcher catch-all route.
-      def add_route(*args)
-        custom_routes &lt;&lt; args
-      end
-  
-      # Keeps track of custom adminstration tabs.  Each item is an array of arguments to be passed to link_to.
-      #
-      #   module Mephisto
-      #     module Plugins
-      #       class Foo &lt; Mephisto::Plugin
-      #         add_tab 'Foo', :controller =&gt; 'foo'
-      #       end
-      #     end
-      #   end
-      def add_tab(*args)
-        tabs &lt;&lt; args
-      end
-  
-      # Keeps track of custom adminstration tabs for ADMIN users only.  Each item is an array of arguments to be passed to link_to.
-      #
-      #   module Mephisto
-      #     module Plugins
-      #       class Foo &lt; Mephisto::Plugin
-      #         add_admin_tab 'Foo', :controller =&gt; 'foo'
-      #       end
-      #     end
-      #   end
-      def add_admin_tab(*args)
-        admin_tabs &lt;&lt; args
-      end
-  
-      # Sets up a custom public controller for this plugin.  It adds the plugin's lib directory to the controller paths directory and
-      # saves the view path.  Call this from your plugin's init.rb file.
-      #
-      #   # #underscore will be called on the title parameter, so the 4th parameter 'foo' is unnecessary here.
-      #   module Mephisto
-      #     module Plugins
-      #       class Foo &lt; Mephisto::Plugin
-      #         public_controller 'Foo', 'foo'
-      #       end
-      #     end
-      #   end
-      #
-      # Once set, create your controller in #{YOUR_PLUGIN}/lib/foo_controller.rb.
-      #
-      #   class FooController &lt; ApplicationController
-      #     self.template_root = Mephisto::Plugin.view_paths[:foo]
-      #     ...
-      #   end
-      #
-      # Your views will then be stored in #{YOUR_PLUGIN}/views/foo/*.rhtml.
-      def public_controller(title, name = nil)
-        returning((name || title.underscore).to_sym) do |controller_name|
-          view_paths[controller_name] = (plugin_path + 'views').to_s
-        end
-      end
+require File.join(File.dirname(__FILE__), 'plugin_about_patch')
+
+# needs to be loaded before or at beginning of plugin init stage because it
+# allows to use add_tab and add_admin_tab from plugin init.rb
+
+module Mephisto 
+  def self.plugins
+    @@plugins ||= Engines::Plugin::List.new Engines.plugins.select{ |plugin| plugin.mephisto_plugin? }
+  end
   
-      # Sets up a custom admin controller.  Mephisto::Plugin.public_controller is used for the basic setup.  This also automatically
-      # adds a tab for you, and symlinks Mephisto's core app/views/layouts path.  Like Mephisto::Plugin.public_controller, this should be
-      # called from your plugin's init.rb file.
-      #
-      #   module Mephisto
-      #     module Plugins
-      #       class Foo &lt; Mephisto::Plugin
-      #         admin_controller 'Foo', 'foo'
-      #       end
-      #     end
-      #   end
-      #
-      #   module Admin
-      #     class FooController &lt; Admin::BaseController
-      #       self.template_root = Mephisto::Plugin.view_paths[:foo]
-      #       ...
-      #     end
-      #   end
-      #
-      # Your views will then be stored in #{YOUR_PLUGIN}/views/admin/foo/*.rhtml.
-      def admin_controller(title, name = nil, options = {})
-        returning public_controller(title, name) do |controller_name|
-          add_tab title, {:controller =&gt; &quot;admin/#{controller_name}&quot;}.update(options)
-          unless File.exists?(File.join(view_paths[controller_name], 'layouts'))
-            FileUtils.mkdir_p view_paths[controller_name]
-            FileUtils.symlink(RAILS_PATH + 'app/views/layouts', File.join(view_paths[controller_name], 'layouts'))
-          end
-        end
-      end
+  module Plugin
+    @@tabs       = []
+    @@admin_tabs = []
+    mattr_reader :tabs, :admin_tabs
+    
+    # delegate read access to about info
+    %w(author homepage version notes).each do |property|
+      module_eval &quot;def #{property}; about['#{property}'] end&quot;, __FILE__, __LINE__
     end
-  
-    plugin_property_source = %w(author version homepage notes plugin_name plugin_path default_options).collect! do |property|
-      &quot;def #{property}() self.class.#{property} end&quot;
+
+    # Keeps track of custom adminstration tabs. Each item is an array of arguments to be passed to link_to.
+    def add_tab(*args)
+      args.push(:controller =&gt; args.first.to_s.downcase) if (args.size == 1)
+      Mephisto::Plugin.tabs &lt;&lt; args
+    end
+
+    # Keeps track of custom adminstration tabs for ADMIN users only.  Each item is an array of arguments to be passed to link_to.
+    def add_admin_tab(*args)
+      args.push(:controller =&gt; args.first.to_s.downcase) if (args.size == 1)
+      Mephisto::Plugin.admin_tabs &lt;&lt; args
+    end
+    
+    def mephisto_plugin?
+      name =~ /^mephisto_(\w+)$/
+    end
+    
+    def configurable?
+      not default_options.empty?
+    end
+    
+    def mephisto_name
+      name.sub /^mephisto_/, ''
     end
-    eval plugin_property_source * &quot;\n&quot;
+    alias :conf_name :mephisto_name
   end
-end
\ No newline at end of file
+end
+
+Engines::Plugin.send :include, Mephisto::Plugin
+</diff>
      <filename>lib/mephisto/plugin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -33,9 +33,8 @@ module Mephisto
       map.connect ':controller/:action/:id/:version', :version =&gt; nil, :controller =&gt; /routing_navigator|account|(admin\/\w+)/, :id =&gt; /[^\/]*/
 
       yield if block_given?
-      Mephisto::Plugin.custom_routes.each do |path, options|
-        map.connect path, options
-      end
+      
+      map_from_plugins(map)
       
       map.dispatch '*path', :controller =&gt; 'mephisto', :action =&gt; 'dispatch'
       map.home '', :controller =&gt; 'mephisto', :action =&gt; 'dispatch'
@@ -45,6 +44,10 @@ module Mephisto
       expiring_attr_reader :redirections,  '{}'
     end
     
+    def self.map_from_plugins(map)      
+      Engines.plugins.each { |plugin| map.from_plugin(plugin.name) }
+    end
+    
     def self.deny(*paths)
       paths.each do |path|
         redirections[convert_redirection_to_regex(path)] = :deny</diff>
      <filename>lib/mephisto/routing.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 ENV[&quot;RAILS_ENV&quot;] = &quot;test&quot;
+
 require File.expand_path(File.dirname(__FILE__) + &quot;/../config/environment&quot;)
 require 'spec'
 require 'spec/rails'</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -63,4 +63,7 @@ Class.class_eval do
   end
   
   alias_method_chain :inherited, :mixins
-end
\ No newline at end of file
+end
+
+require 'mephisto/plugin'
+</diff>
      <filename>vendor/plugins/aaa/init.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>90337f19a39555e9689bafee78cffd81ae0cdcc9</id>
    </parent>
    <parent>
      <id>1ad1b56b4a6c9284534b0afbb9d5d87715ae4312</id>
    </parent>
  </parents>
  <author>
    <name>Isaac Kearse</name>
    <email>isaackearse@gmail.com</email>
  </author>
  <url>http://github.com/reddavis/mephisto/commit/41a870e17ae5e574d65c512affa441c70ad411f2</url>
  <id>41a870e17ae5e574d65c512affa441c70ad411f2</id>
  <committed-date>2008-03-28T22:53:25-07:00</committed-date>
  <authored-date>2008-03-28T22:53:25-07:00</authored-date>
  <message>Merge commit 'activereload/engines'</message>
  <tree>1c96affcd41848cb4e3cb2985970676030e0eaec</tree>
  <committer>
    <name>Isaac Kearse</name>
    <email>isaackearse@gmail.com</email>
  </committer>
</commit>
