Permalink
Browse files

Add a generator_paths config option

  • Loading branch information...
1 parent 7e6530b commit 8665c754cb61c947cd55f8886c28188050aed78d Yehuda Katz committed Jan 9, 2010
Showing with 13 additions and 5 deletions.
  1. +7 −5 railties/lib/rails/configuration.rb
  2. +6 −0 railties/test/plugins/configuration_test.rb
@@ -22,15 +22,17 @@ def self.default_middleware_stack
end
end
- attr_reader :middleware
+ attr_reader :middleware, :generator_paths
def initialize(base = nil)
if base
- @options = base.options.dup
- @middleware = base.middleware.dup
+ @options = base.options.dup
+ @middleware = base.middleware.dup
+ @generator_paths = base.generator_paths.dup
else
- @options = Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new }
- @middleware = self.class.default_middleware_stack
+ @options = Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new }
+ @middleware = self.class.default_middleware_stack
+ @generator_paths = []
end
end
@@ -24,6 +24,12 @@ class Foo < Rails::Railtie ; config.foo.greetings = "hello" ; end
assert_equal "hello", AppTemplate::Application.config.foo.greetings
end
+ test "plugins can provide generators" do
+ class Foo < Rails::Railtie ; config.generator_paths << "/foo" ; end
+ require "#{app_path}/config/application"
+ assert_eqaul ["/foo"], AppTemplate::Application.config.generator_paths
+ end
+
test "plugin config merges are deep" do
class Foo < Rails::Railtie ; config.foo.greetings = 'hello' ; end
class MyApp < Rails::Application

0 comments on commit 8665c75

Please sign in to comment.