From f8bcfa6e042e7f953f1e7bd16195b2200a6dfc45 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 30 Jan 2006 04:08:05 +0000 Subject: [PATCH] Added check for RAILS_FRAMEWORK_ROOT constant that allows the Rails framework to be found in a different place than vendor/rails. Should be set in boot.rb. [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3496 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 ++ railties/lib/initializer.rb | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/railties/CHANGELOG b/railties/CHANGELOG index f4b78a5927..76de230e28 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added check for RAILS_FRAMEWORK_ROOT constant that allows the Rails framework to be found in a different place than vendor/rails. Should be set in boot.rb. [DHH] + * Fixed that static requests could unlock the mutex guarding dynamic requests in the WEBrick servlet #3433 [tom@craz8.com] * Fixed documentation tasks to work with Rake 0.7.0 #3563 [kazuhiko@fdiary.net] diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 9876bb60cb..68b14b9fe0 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -447,6 +447,10 @@ module Rails ::RAILS_ROOT end + def framework_root_path + defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root_path}/vendor/rails" + end + def default_frameworks [ :active_record, :action_controller, :action_view, :action_mailer, :action_web_service ] end @@ -460,7 +464,6 @@ module Rails paths.concat(Dir["#{root_path}/components/[_a-z]*"]) # Followed by the standard includes. - # TODO: Don't include dirs for frameworks that are not used paths.concat %w( app app/models @@ -472,14 +475,18 @@ module Rails config lib vendor - vendor/rails/railties - vendor/rails/railties/lib - vendor/rails/actionpack/lib - vendor/rails/activesupport/lib - vendor/rails/activerecord/lib - vendor/rails/actionmailer/lib - vendor/rails/actionwebservice/lib ).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) } + + # TODO: Don't include dirs for frameworks that are not used + paths.concat %w( + railties + railties/lib + actionpack/lib + activesupport/lib + activerecord/lib + actionmailer/lib + actionwebservice/lib + ).map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) } end def default_log_path