Changeset 6447
- Timestamp:
- 03/18/07 13:47:08 (3 years ago)
- Files:
-
- branches/1-2-stable/railties/CHANGELOG (modified) (1 diff)
- branches/1-2-stable/railties/environments/boot.rb (modified) (1 diff)
- branches/1-2-stable/railties/lib/initializer.rb (modified) (7 diffs)
- branches/1-2-stable/railties/lib/railties_path.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1-2-stable/railties/CHANGELOG
r6421 r6447 1 *SVN* 2 3 * Canonicalize RAILS_ROOT by using File.expand_path on Windows, which doesn't have to worry about symlinks, and Pathname#realpath elsewhere, which respects symlinks in relative paths but is incompatible with Windows. #6755 [Jeremy Kemper, trevor] 4 5 1 6 *1.2.3* (March 12th, 2007) 2 7 branches/1-2-stable/railties/environments/boot.rb
r6345 r6447 1 1 # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb 2 2 3 unless defined?(RAILS_ROOT) 4 root_path = File.join(File.dirname(__FILE__), '..') 5 6 unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ 7 require 'pathname' 8 root_path = Pathname.new(root_path).cleanpath(true).to_s 9 end 10 11 RAILS_ROOT = root_path 12 end 3 RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) 13 4 14 5 unless defined?(Rails::Initializer) branches/1-2-stable/railties/lib/initializer.rb
r6041 r6447 1 1 require 'logger' 2 2 require 'set' 3 require File.join(File.dirname(__FILE__), 'railties_path') 4 require File.join(File.dirname(__FILE__), 'rails/version') 3 require 'pathname' 4 5 $LOAD_PATH.unshift File.dirname(__FILE__) 6 require 'railties_path' 7 require 'rails/version' 8 5 9 6 10 RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV) … … 192 196 load_plugin path 193 197 end 194 end 198 end 195 199 $LOAD_PATH.uniq! 196 200 end … … 308 312 def initialize_temporary_directories 309 313 if configuration.frameworks.include?(:action_controller) 310 session_path = "#{ RAILS_ROOT}/tmp/sessions/"314 session_path = "#{configuration.root_path}/tmp/sessions/" 311 315 ActionController::Base.session_options[:tmpdir] = File.exist?(session_path) ? session_path : Dir::tmpdir 312 316 313 cache_path = "#{ RAILS_ROOT}/tmp/cache/"317 cache_path = "#{configuration.root_path}/tmp/cache/" 314 318 if File.exist?(cache_path) 315 319 ActionController::Base.fragment_cache_store = :file_store, cache_path … … 415 419 # Rails::Initializer.run(:process, config) 416 420 class Configuration 421 # The application's base directory. 422 attr_reader :root_path 423 417 424 # A stub for setting options on ActionController::Base 418 425 attr_accessor :action_controller … … 498 505 # values. 499 506 def initialize 507 set_root_path! 508 500 509 self.frameworks = default_frameworks 501 510 self.load_paths = default_load_paths … … 517 526 end 518 527 528 # Set the root_path to RAILS_ROOT and canonicalize it. 529 def set_root_path! 530 raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT) 531 raise 'RAILS_ROOT is not a directory' unless File.directory?(::RAILS_ROOT) 532 533 @root_path = 534 # Pathname is incompatible with Windows, but Windows doesn't have 535 # real symlinks so File.expand_path is safe. 536 if RUBY_PLATFORM =~ /(:?mswin|mingw)/ 537 File.expand_path(::RAILS_ROOT) 538 539 # Otherwise use Pathname#realpath which respects symlinks. 540 else 541 Pathname.new(::RAILS_ROOT).realpath.to_s 542 end 543 end 544 519 545 # Loads and returns the contents of the #database_configuration_file. The 520 546 # contents of the file are processed via ERB before being sent through … … 576 602 577 603 private 578 def root_path579 ::RAILS_ROOT580 end581 582 604 def framework_root_path 583 605 defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root_path}/vendor/rails" branches/1-2-stable/railties/lib/railties_path.rb
r2933 r6447 1 RAILTIES_PATH = File. expand_path(File.join(File.dirname(__FILE__), '..'))1 RAILTIES_PATH = File.join(File.dirname(__FILE__), '..')