Changeset 8393 for branches/2-1-caching/railties/lib
- Timestamp:
- 12/15/07 01:35:55 (1 year ago)
- Files:
-
- branches/2-1-caching/railties/lib/initializer.rb (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2-1-caching/railties/lib/initializer.rb
r8301 r8393 59 59 60 60 # Sequentially step through all of the available initialization routines, 61 # in order: 62 # 63 # * #check_ruby_version 64 # * #set_load_path 65 # * #require_frameworks 66 # * #set_autoload_paths 67 # * add_plugin_load_paths 68 # * #load_environment 69 # * #initialize_encoding 70 # * #initialize_database 71 # * #initialize_logger 72 # * #initialize_framework_logging 73 # * #initialize_framework_views 74 # * #initialize_dependency_mechanism 75 # * #initialize_whiny_nils 76 # * #initialize_temporary_directories 77 # * #initialize_framework_settings 78 # * #add_support_load_paths 79 # * #load_plugins 80 # * #load_observers 81 # * #initialize_routing 82 # * #after_initialize 83 # * #load_application_initializers 61 # in order (view execution order in source). 84 62 def process 85 63 check_ruby_version … … 93 71 initialize_encoding 94 72 initialize_database 73 74 initialize_cache 75 initialize_framework_caches 76 95 77 initialize_logger 96 78 initialize_framework_logging 79 97 80 initialize_framework_views 98 81 initialize_dependency_mechanism 99 82 initialize_whiny_nils 100 initialize_temporary_ directories83 initialize_temporary_session_directory 101 84 initialize_framework_settings 102 85 … … 236 219 end 237 220 221 def initialize_cache 222 unless defined?(RAILS_CACHE) 223 silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(configuration.cache_store) } 224 end 225 end 226 227 def initialize_framework_caches 228 if configuration.frameworks.include?(:action_controller) 229 ActionController::Base.cache_store ||= RAILS_CACHE 230 end 231 end 232 238 233 # If the +RAILS_DEFAULT_LOGGER+ constant is already set, this initialization 239 234 # routine does nothing. If the constant is not set, and Configuration#logger … … 274 269 framework.to_s.camelize.constantize.const_get("Base").logger ||= RAILS_DEFAULT_LOGGER 275 270 end 271 272 RAILS_CACHE.logger ||= RAILS_DEFAULT_LOGGER 276 273 end 277 274 … … 306 303 end 307 304 308 def initialize_temporary_ directories305 def initialize_temporary_session_directory 309 306 if configuration.frameworks.include?(:action_controller) 310 307 session_path = "#{configuration.root_path}/tmp/sessions/" 311 308 ActionController::Base.session_options[:tmpdir] = File.exist?(session_path) ? session_path : Dir::tmpdir 312 313 cache_path = "#{configuration.root_path}/tmp/cache/"314 if File.exist?(cache_path)315 ActionController::Base.fragment_cache_store = :file_store, cache_path316 end317 309 end 318 310 end … … 414 406 # used directly. 415 407 attr_accessor :logger 408 409 # The specific cache store to use. By default, the ActiveSupport::Cache::Store will be used. 410 attr_accessor :cache_store 416 411 417 412 # The root of the application's views. (Defaults to <tt>app/views</tt>.) … … 644 639 Plugin::Loader 645 640 end 641 642 def default_cache_store 643 if File.exist?("#{root_path}/tmp/cache/") 644 [ :file_store, "#{root_path}/tmp/cache/" ] 645 else 646 :memory_store 647 end 648 end 646 649 end 647 650 end