Permalink
Browse files

Revert "Add config.action_controller.include behavior to plugins."

This reverts commit 7e8b7f4.

Conflicts:

	railties/lib/rails/plugin.rb
  • Loading branch information...
1 parent 10a2638 commit 1fbd02e44618f1f56e1d9d0af85c6a4108a66532 @jeremy jeremy committed Dec 31, 2009
@@ -1,7 +1,6 @@
module ActionController
class Plugin < Rails::Plugin
plugin_name :action_controller
- include_modules_in "ActionController::Base"
initializer "action_controller.set_configs" do |app|
app.config.action_controller.each do |k,v|
@@ -91,4 +90,4 @@ class Plugin < Rails::Plugin
end
end
-end
+end
@@ -7,7 +7,6 @@
module ActiveRecord
class Plugin < Rails::Plugin
plugin_name :active_record
- include_modules_in "ActiveRecord::Base"
rake_tasks do
load "active_record/railties/databases.rake"
@@ -1,24 +1,6 @@
require 'active_support/ordered_options'
module Rails
- # Create a Plugin::Options from ActiveSuppot::OrderedOptions,
- # which support the following syntax:
- #
- # controller.action_controller.include FooBar
- #
- class Plugin::Options < ActiveSupport::OrderedOptions #:nodoc:
- attr_reader :includes
-
- def initialize(*args)
- @includes = []
- super
- end
-
- def include(*args)
- @includes.concat(args)
- end
- end
-
# Temporarily separate the plugin configuration class from the main
# configuration class while this bit is being cleaned up.
class Plugin::Configuration
@@ -34,7 +16,7 @@ def initialize(base = nil)
@options = base.options.dup
@middleware = base.middleware.dup
else
- @options = Hash.new { |h,k| h[k] = Rails::Plugin::Options.new }
+ @options = Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new }
@middleware = ActionDispatch::MiddlewareStack.new
end
end
@@ -40,24 +40,6 @@ def load_tasks
rake_tasks.each { |blk| blk.call }
end
- # Creates an initializer which includes all given modules to the given class.
- #
- # module Rails
- # class ActionController < Rails::Plugin
- # plugin_name :action_controller
- # include_modules_in "ActionController::Base"
- # end
- # end
- #
- def self.include_modules_in(klass, from=plugin_name)
- self.initializer :"#{from}.include_modules" do |app|
- klass = klass.constantize if klass.is_a?(String)
- app.config.send(from).includes.each do |mod|
- klass.send(:include, mod.is_a?(String) ? mod.constantize : mod)
- end
- end
- end
-
class Vendored < Plugin
def self.all(list, paths)
plugins = []
@@ -121,4 +103,4 @@ def load_tasks
end
end
end
-end
+end
@@ -8,10 +8,6 @@ def setup
require "rails"
end
- module Bar; end
- module Baz; end
- module All; end
-
test "config is available to plugins" do
class Foo < Rails::Plugin ; end
assert_nil Foo.config.action_controller.foo
@@ -28,18 +24,6 @@ class Foo < Rails::Plugin ; config.foo.greetings = "hello" ; end
assert_equal "hello", AppTemplate::Application.config.foo.greetings
end
- test "plugin configurations allow modules to be given" do
- class Foo < Rails::Plugin ; config.foo.include(Bar, Baz) ; end
- assert_equal [Bar, Baz], Foo.config.foo.includes
- end
-
- test "plugin includes given modules in given class" do
- class Foo < Rails::Plugin ; config.foo.include(Bar, "PluginsTest::ConfigurationTest::Baz") ; include_modules_in All ; end
- Foo.new.run_initializers(Foo)
- assert All.ancestors.include?(Bar)
- assert All.ancestors.include?(Baz)
- end
-
test "plugin config merges are deep" do
class Foo < Rails::Plugin ; config.foo.greetings = 'hello' ; end
class MyApp < Rails::Application

0 comments on commit 1fbd02e

Please sign in to comment.