aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2006-01-14 09:15:34 +0000
committerMichael Koziarski <michael@koziarski.com>2006-01-14 09:15:34 +0000
commit88dae722022b84bc7b16680f5113959952fb2df2 (patch)
treef6fa07d42a174213dc38456d6b471147544ad4e9
parent32f89dc10b4ec3fe68d65a77d10261373f0d0962 (diff)
downloadrails-88dae722022b84bc7b16680f5113959952fb2df2.tar.gz
rails-88dae722022b84bc7b16680f5113959952fb2df2.tar.bz2
rails-88dae722022b84bc7b16680f5113959952fb2df2.zip
Load plugins in a consistent order. Closes #3429
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/initializer.rb5
2 files changed, 5 insertions, 2 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index fcf7ca6497..bbf4279166 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -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]
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index a7230f5cf7..9876bb60cb 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -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|