From dcfd6aa3bd91c93adf6ed47453a084327f018000 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 15 Feb 2005 16:21:56 +0000 Subject: Move Controllers wrapper module away from environment.rb and into dependencies.rb git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@627 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/dependencies.rb | 4 +++- activesupport/lib/active_support.rb | 29 ++++++++++++++++++++++++ railties/environments/shared.rb | 2 -- railties/environments/shared_for_gem.rb | 2 -- railties/lib/rails_generator.rb | 7 +++++- 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 activesupport/lib/active_support.rb diff --git a/actionpack/lib/action_controller/dependencies.rb b/actionpack/lib/action_controller/dependencies.rb index 8bc013db66..abf6ca7417 100644 --- a/actionpack/lib/action_controller/dependencies.rb +++ b/actionpack/lib/action_controller/dependencies.rb @@ -85,4 +85,6 @@ module ActionController #:nodoc: end end end -end \ No newline at end of file +end + +Controllers = Dependencies::LoadingModule.new(File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers'))) if defined?(RAILS_ROOT) \ No newline at end of file diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb new file mode 100644 index 0000000000..30034a316e --- /dev/null +++ b/activesupport/lib/active_support.rb @@ -0,0 +1,29 @@ +#-- +# Copyright (c) 2005 David Heinemeier Hansson +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +#++ + +$:.unshift(File.dirname(__FILE__)) + +require 'active_support/core_ext' +require 'active_support/clean_logger' +require 'active_support/misc' +require 'active_support/dependencies' diff --git a/railties/environments/shared.rb b/railties/environments/shared.rb index bccc9c3e21..2d37714831 100644 --- a/railties/environments/shared.rb +++ b/railties/environments/shared.rb @@ -41,8 +41,6 @@ require_dependency "environments/#{RAILS_ENV}" ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml")) ActiveRecord::Base.establish_connection -Controllers = Dependencies::LoadingModule.new(File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers'))) - # Configure defaults if the included environment did not. begin diff --git a/railties/environments/shared_for_gem.rb b/railties/environments/shared_for_gem.rb index f58d974cc1..057f664396 100644 --- a/railties/environments/shared_for_gem.rb +++ b/railties/environments/shared_for_gem.rb @@ -37,8 +37,6 @@ require_dependency "environments/#{RAILS_ENV}" ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml")) ActiveRecord::Base.establish_connection -Controllers = Dependencies::LoadingModule.new(File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers'))) - # Configure defaults if the included environment did not. begin diff --git a/railties/lib/rails_generator.rb b/railties/lib/rails_generator.rb index 3e7f459345..8268f3f5f0 100644 --- a/railties/lib/rails_generator.rb +++ b/railties/lib/rails_generator.rb @@ -23,7 +23,12 @@ $:.unshift(File.dirname(__FILE__)) -require 'active_support' +begin + require 'active_support' +rescue LoadError + require 'rubygems' + require_gem 'activesupport' +end require 'rails_generator/base' require 'rails_generator/lookup' -- cgit v1.2.3