Load plugins in a consistent order. Closes #3429

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Michael Koziarski
2006-01-14 09:15:34 +00:00
parent 32f89dc10b
commit 88dae72202
2 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
*SVN*
* Sort the list of plugins so we load in a consistent order [Rick Olson]
* Show usage when script/plugin is called without arguments [tom@craz8.com]
* Corrected problems with plugin loader where plugins set 'name' incorrectly #3297 [anna@wota.jp]

View File

@@ -141,8 +141,9 @@ module Rails
# * evaluate <tt>init.rb</tt> if present
#
# After all plugins are loaded, duplicates are removed from the load path.
# Plugins are loaded in alphabetical order.
def load_plugins
find_plugins(configuration.plugin_paths).each { |path| load_plugin path }
find_plugins(configuration.plugin_paths).sort.each { |path| load_plugin path }
$LOAD_PATH.uniq!
end
@@ -262,7 +263,7 @@ module Rails
# Return a list of plugin paths within base_path. A plugin path is
# a directory that contains either a lib directory or an init.rb file.
# This recurses into directories which are not plugin paths, so you
# may organize your plugins which the plugin path.
# may organize your plugins within the plugin path.
def find_plugins(*base_paths)
base_paths.flatten.inject([]) do |plugins, base_path|
Dir.glob(File.join(base_path, '*')).each do |path|