On Nov 27, 2007 2:15 PM, James Adam <[EMAIL PROTECTED]> wrote: > The other thing which happens, is that the plugin's lib directory is > added to the $LOAD_PATH, under the application's lib directory (so > that the app can still override anything). But, as each plugin is > loaded, it's lib directory is "pushed" into this position, forcing the > other plugin lib directories to move below it.
OK. We (me and Kelly Felkins) understand this problem now. It was broken with changeset 8115, in the refactoring of the plugin code. Specifically, the population of the load path was decoupled from the initialization of the plugin, by removing the 'evaluate' from loader [1], and making 'add_plugin_load_paths' a separate, earlier step in initialization [2]. So, James' statement above is now false: 'AS each plugin is loaded, it's lib directory is pushed...' This was the case up until the 2.0 Preview Release, but now, everything is added to the load path, and THEN the plugins are initialized. This breaks the assumption that a 'child' plugin can reopen a class from another 'parent' plugin which it depends on. Since the dependent 'child' plugin is earlier on the load path, it's re-opened class is found first, and if it tries to refer to any methods from the dependency 'parent' plugin, it will fail, because they are not found. This is the specific problem we are having with rspec and rspec_on_rails recent version (which is fixed in rspec trunk now, according to Pascal). The Spec::Matchers::Have class in rspec_on_rails plugin is being found by the rspec plugin's initialization process, because rspec_on_rails is BEFORE rspec on the already-populated load path. This class in rspec_on_rails refers to 'failure_message', which is in the rspec plugin's version of Spec::Matchers::Have, which of course hasn't been required yet, so everything blows up. I think this is a fairly bad regression that will likely break a lot of plugins. We should consider fixing it before the 2.0 release. I can try to give a more detailed failure scenario if you want. [1] http://dev.rubyonrails.org/changeset/8115/trunk/railties/lib/rails/plugin/loader.rb [2] http://dev.rubyonrails.org/changeset/8115/trunk/railties/lib/initializer.rb Thanks, -- Chad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
