Deprecate generators in Railties. You should use app_generators instead.
This commit is contained in:
parent
757bbd540c
commit
04cbabb0a0
|
@ -4,16 +4,38 @@ module Rails
|
||||||
class Engine
|
class Engine
|
||||||
class Configuration < ::Rails::Railtie::Configuration
|
class Configuration < ::Rails::Railtie::Configuration
|
||||||
attr_reader :root
|
attr_reader :root
|
||||||
attr_writer :eager_load_paths, :autoload_once_paths, :autoload_paths
|
attr_writer :middleware, :eager_load_paths, :autoload_once_paths, :autoload_paths
|
||||||
attr_accessor :middleware, :plugins, :asset_path
|
attr_accessor :plugins, :asset_path
|
||||||
|
|
||||||
def initialize(root=nil)
|
def initialize(root=nil)
|
||||||
super()
|
super()
|
||||||
@root = root
|
@root = root
|
||||||
@middleware = Rails::Configuration::MiddlewareStackProxy.new
|
|
||||||
@helpers_paths = []
|
@helpers_paths = []
|
||||||
end
|
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
|
def paths
|
||||||
@paths ||= begin
|
@paths ||= begin
|
||||||
paths = Rails::Paths::Root.new(@root)
|
paths = Rails::Paths::Root.new(@root)
|
||||||
|
|
|
@ -83,7 +83,7 @@ module Rails
|
||||||
#
|
#
|
||||||
# class MyRailtie < Rails::Railtie
|
# class MyRailtie < Rails::Railtie
|
||||||
# # Customize the ORM
|
# # 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
|
# # Add a to_prepare block which is executed once in production
|
||||||
# # and before each request in development
|
# # and before each request in development
|
||||||
|
|
|
@ -5,7 +5,6 @@ module Rails
|
||||||
class Configuration
|
class Configuration
|
||||||
def initialize
|
def initialize
|
||||||
@@options ||= {}
|
@@options ||= {}
|
||||||
@@static_asset_paths = ActiveSupport::OrderedHash.new
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# This allows you to modify the application's middlewares from Engines.
|
# This allows you to modify the application's middlewares from Engines.
|
||||||
|
@ -23,32 +22,13 @@ module Rails
|
||||||
# application overwrites them.
|
# application overwrites them.
|
||||||
def app_generators
|
def app_generators
|
||||||
@@app_generators ||= Rails::Configuration::Generators.new
|
@@app_generators ||= Rails::Configuration::Generators.new
|
||||||
if block_given?
|
yield(@@app_generators) if block_given?
|
||||||
yield @@app_generators
|
@@app_generators
|
||||||
else
|
|
||||||
@@app_generators
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Holds generators configuration:
|
def generators(&block) #:nodoc
|
||||||
#
|
ActiveSupport::Deprecation.warn "config.generators is deprecated. Please use config.app_generators instead."
|
||||||
# config.generators do |g|
|
app_generators(&block)
|
||||||
# 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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_configuration(&block)
|
def before_configuration(&block)
|
||||||
|
@ -83,7 +63,7 @@ module Rails
|
||||||
# with associated public folders, like:
|
# with associated public folders, like:
|
||||||
# { "/" => "/app/public", "/my_engine" => "app/engines/my_engine/public" }
|
# { "/" => "/app/public", "/my_engine" => "app/engines/my_engine/public" }
|
||||||
def static_asset_paths
|
def static_asset_paths
|
||||||
@@static_asset_paths
|
@@static_asset_paths ||= ActiveSupport::OrderedHash.new
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue