mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Deprecate generators in Railties. You should use app_generators instead.
This commit is contained in:
parent
757bbd540c
commit
04cbabb0a0
3 changed files with 32 additions and 30 deletions
|
@ -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 @@ module Rails
|
|||
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 @@ module Rails
|
|||
# application overwrites them.
|
||||
def app_generators
|
||||
@@app_generators ||= Rails::Configuration::Generators.new
|
||||
if block_given?
|
||||
yield @@app_generators
|
||||
else
|
||||
yield(@@app_generators) if block_given?
|
||||
@@app_generators
|
||||
end
|
||||
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 @@ module Rails
|
|||
# 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
|
||||
|
|
Loading…
Reference in a new issue