aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/railtie/configuration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/railtie/configuration.rb')
-rw-r--r--railties/lib/rails/railtie/configuration.rb47
1 files changed, 28 insertions, 19 deletions
diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb
index 4e6f94c534..2c7b5bc048 100644
--- a/railties/lib/rails/railtie/configuration.rb
+++ b/railties/lib/rails/railtie/configuration.rb
@@ -16,47 +16,49 @@ module Rails
@@app_middleware ||= Rails::Configuration::MiddlewareStackProxy.new
end
- # Holds generators configuration:
+ # This allows you to modify application's generators from Railties.
#
- # 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
+ # Values set on app_generators will become defaults for application, unless
+ # application overwrites them.
+ def app_generators
+ @@app_generators ||= Rails::Configuration::Generators.new
+ yield(@@app_generators) if block_given?
+ @@app_generators
end
+ def generators(&block) #:nodoc
+ ActiveSupport::Deprecation.warn "config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead."
+ app_generators(&block)
+ end
+
+ # First configurable block to run. Called before any initializers are run.
def before_configuration(&block)
ActiveSupport.on_load(:before_configuration, :yield => true, &block)
end
+ # Third configurable block to run. Does not run if config.cache_classes
+ # set to false.
def before_eager_load(&block)
ActiveSupport.on_load(:before_eager_load, :yield => true, &block)
end
+ # Second configurable block to run. Called before frameworks initialize.
def before_initialize(&block)
ActiveSupport.on_load(:before_initialize, :yield => true, &block)
end
+ # Last configurable block to run. Called after frameworks initialize.
def after_initialize(&block)
ActiveSupport.on_load(:after_initialize, :yield => true, &block)
end
+ # Array of callbacks defined by #to_prepare.
def to_prepare_blocks
@@to_prepare_blocks ||= []
end
+ # Defines generic callbacks to run before #after_initialize. Useful for
+ # Rails::Railtie subclasses.
def to_prepare(&blk)
to_prepare_blocks << blk if blk
end
@@ -65,6 +67,13 @@ module Rails
super || @@options.key?(name.to_sym)
end
+ # static_asset_paths is a Hash containing asset_paths
+ # with associated public folders, like:
+ # { "/" => "/app/public", "/my_engine" => "app/engines/my_engine/public" }
+ def static_asset_paths
+ @@static_asset_paths ||= ActiveSupport::OrderedHash.new
+ end
+
private
def method_missing(name, *args, &blk)
@@ -78,4 +87,4 @@ module Rails
end
end
end
-end \ No newline at end of file
+end