Permalink
Browse files

Deprecate generators in Railties. You should use app_generators instead.

  • Loading branch information...
1 parent 757bbd5 commit 04cbabb0a0206553d7b474ee7a191d19957048fe @josevalim josevalim committed Oct 2, 2010
@@ -4,16 +4,38 @@ module Rails
class Engine
class Configuration < ::Rails::Railtie::Configuration
attr_reader :root
- attr_writer :eager_load_paths, :autoload_once_paths, :autoload_paths
- attr_accessor :middleware, :plugins, :asset_path
+ attr_writer :middleware, :eager_load_paths, :autoload_once_paths, :autoload_paths
+ attr_accessor :plugins, :asset_path
def initialize(root=nil)
super()
@root = root
- @middleware = Rails::Configuration::MiddlewareStackProxy.new
@helpers_paths = []
end
+ # Returns the middleware stack for the engine.
+ def middleware
+ @middleware ||= Rails::Configuration::MiddlewareStackProxy.new
+ end
+
+ # Holds generators configuration:
+ #
+ # config.generators do |g|
+ # g.orm :datamapper, :migration => true
+ # g.template_engine :haml
+ # g.test_framework :rspec
+ # end
+ #
+ # If you want to disable color in console, do:
+ #
+ # config.generators.colorize_logging = false
+ #
+ def generators #:nodoc
+ @generators ||= Rails::Configuration::Generators.new
+ yield(@generators) if block_given?
+ @generators
+ end
+
def paths
@paths ||= begin
paths = Rails::Paths::Root.new(@root)
@@ -83,7 +83,7 @@ module Rails
#
# class MyRailtie < Rails::Railtie
# # Customize the ORM
- # config.generators.orm :my_railtie_orm
+ # config.app_generators.orm :my_railtie_orm
#
# # Add a to_prepare block which is executed once in production
# # and before each request in development
@@ -5,7 +5,6 @@ class Railtie
class Configuration
def initialize
@@options ||= {}
- @@static_asset_paths = ActiveSupport::OrderedHash.new
end
# This allows you to modify the application's middlewares from Engines.
@@ -23,32 +22,13 @@ def app_middleware
# application overwrites them.
def app_generators
@@app_generators ||= Rails::Configuration::Generators.new
- if block_given?
- yield @@app_generators
- else
- @@app_generators
- end
+ yield(@@app_generators) if block_given?
+ @@app_generators
end
- # Holds generators configuration:
- #
- # config.generators do |g|
- # g.orm :datamapper, :migration => true
- # g.template_engine :haml
- # g.test_framework :rspec
- # end
- #
- # If you want to disable color in console, do:
- #
- # config.generators.colorize_logging = false
- #
- def generators
- @generators ||= Rails::Configuration::Generators.new
- if block_given?
- yield @generators
- else
- @generators
- end
+ def generators(&block) #:nodoc
+ ActiveSupport::Deprecation.warn "config.generators is deprecated. Please use config.app_generators instead."
+ app_generators(&block)
end
def before_configuration(&block)
@@ -83,7 +63,7 @@ def respond_to?(name)
# with associated public folders, like:
# { "/" => "/app/public", "/my_engine" => "app/engines/my_engine/public" }
def static_asset_paths
- @@static_asset_paths
+ @@static_asset_paths ||= ActiveSupport::OrderedHash.new
end
private

0 comments on commit 04cbabb

Please sign in to comment.