Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9167

Show
Ignore:
Timestamp:
03/31/08 06:53:44 (5 months ago)
Author:
rick
Message:

Allow files in plugins to be reloaded like the rest of the application. [rick]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r9148 r9167  
    11*SVN* 
     2 
     3* Allow files in plugins to be reloaded like the rest of the application.  [rick] 
     4 
     5  Enables or disables plugin reloading. 
     6   
     7    config.reload_plugins = true 
     8   
     9  You can get around this setting per plugin. 
     10  If #reload_plugins? == false (DEFAULT), add this to your plugin's init.rb to make it reloadable: 
     11   
     12    Dependencies.load_once_paths.delete lib_path 
     13   
     14  If #reload_plugins? == true, add this to your plugin's init.rb to only load it once: 
     15   
     16    Dependencies.load_once_paths << lib_path 
    217 
    318* Small tweak to allow plugins to specify gem dependencies.  [rick] 
  • trunk/railties/lib/initializer.rb

    r9148 r9167  
    517517    # the implementation of Rails::Plugin::Loader for more details. 
    518518    attr_accessor :plugin_loader 
     519     
     520    # Enables or disables plugin reloading.  You can get around this setting per plugin. 
     521    # If #reload_plugins? == false, add this to your plugin's init.rb to make it reloadable: 
     522    # 
     523    #   Dependencies.load_once_paths.delete lib_path 
     524    # 
     525    # If #reload_plugins? == true, add this to your plugin's init.rb to only load it once: 
     526    # 
     527    #   Dependencies.load_once_paths << lib_path 
     528    # 
     529    attr_accessor :reload_plugins 
     530 
     531    # Returns true if plugin reloading is enabled. 
     532    def reload_plugins? 
     533      !!@reload_plugins 
     534    end 
    519535 
    520536    # An array of gems that this rails application depends on.  Rails will automatically load 
  • trunk/railties/lib/rails/plugin/loader.rb

    r8301 r9167  
    4747            $LOAD_PATH.insert(application_lib_index + 1, path) 
    4848            Dependencies.load_paths      << path 
    49             Dependencies.load_once_paths << path 
     49            unless Rails.configuration.reload_plugins? 
     50              Dependencies.load_once_paths << path 
     51            end 
    5052          end 
    5153        end