Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Restore access to 'directory' and 'config' inside the plugin eval env…

…ironment

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2919 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit fa0a5973dbc306651c4d7bb90020b9a92506a8bf 1 parent 3c31062
@jamis jamis authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 railties/lib/initializer.rb
View
15 railties/lib/initializer.rb
@@ -284,20 +284,23 @@ def plugin_path?(path)
# Returns <tt>true</tt> if the plugin is successfully loaded or
# <tt>false</tt> if it is already loaded (similar to Kernel#require).
# Raises <tt>LoadError</tt> if the plugin is not found.
- def load_plugin(path)
- name = File.basename(path)
- return false if loaded_plugins.include?(name)
+ def load_plugin(directory)
+ name = File.basename(directory)
+ return false if loaded_plugins.include?(directory)
# Catch nonexistent and empty plugins.
- raise LoadError, "No such plugin: #{path}" unless plugin_path?(path)
+ raise LoadError, "No such plugin: #{directory}" unless plugin_path?(directory)
- lib_path = File.join(path, 'lib')
- init_path = File.join(path, 'init.rb')
+ lib_path = File.join(directory, 'lib')
+ init_path = File.join(directory, 'init.rb')
has_lib = File.directory?(lib_path)
has_init = File.file?(init_path)
# Add lib to load path.
$LOAD_PATH.unshift(lib_path) if has_lib
+
+ # Allow plugins to reference the current configuration object
+ config = configuration
# Evaluate init.rb.
silence_warnings { eval(IO.read(init_path), binding) } if has_init
Please sign in to comment.
Something went wrong with that request. Please try again.