1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fully expand relative rails framework paths and make sure we aren't

adding any to the load path more than once.
This commit is contained in:
Joshua Peek 2009-12-16 11:56:51 -06:00
parent 1ab35020c1
commit 7ee5843c3c
15 changed files with 62 additions and 61 deletions

View file

@ -21,8 +21,9 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
$:.unshift(actionpack_path) if File.directory?(actionpack_path)
actionpack_path = File.expand_path('../../../actionpack/lib', __FILE__)
$:.unshift(actionpack_path) if File.directory?(actionpack_path) && !$:.include?(actionpack_path)
require 'action_controller'
require 'action_view'

View file

@ -1,12 +1,9 @@
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
require File.expand_path('../../../vendor/gems/environment', __FILE__)
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
$:.unshift("#{root}/actionpack/lib")
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
require 'rubygems'

View file

@ -1,5 +1,9 @@
require "active_support/core_ext/module/attr_internal"
require "active_support/core_ext/module/delegation"
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require 'active_support'
require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/delegation'
module AbstractController
extend ActiveSupport::Autoload

View file

@ -1,4 +1,6 @@
require "active_support"
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require 'active_support'
module ActionController
extend ActiveSupport::Autoload

View file

@ -21,6 +21,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require 'active_support'
require 'rack'
module Rack
@ -74,7 +78,3 @@ module ActionDispatch
end
autoload :Mime, 'action_dispatch/http/mime_type'
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift activesupport_path if File.directory?(activesupport_path)
require 'active_support'

View file

@ -21,7 +21,12 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
require File.join(File.dirname(__FILE__), "action_pack")
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require 'active_support'
require 'active_support/core_ext/class/attribute_accessors'
require 'action_pack'
module ActionView
extend ActiveSupport::Autoload
@ -51,10 +56,4 @@ end
require 'action_view/erb/util'
I18n.load_path << "#{File.dirname(__FILE__)}/action_view/locale/en.yml"
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift activesupport_path if File.directory?(activesupport_path)
require 'active_support'
require 'active_support/core_ext/class/attribute_accessors'

View file

@ -1,12 +1,9 @@
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
require File.expand_path('../../../vendor/gems/environment', __FILE__)
rescue LoadError
$:.unshift "#{root}/activesupport/lib"
$:.unshift "#{root}/activemodel/lib"
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
$:.unshift(File.dirname(__FILE__) + '/lib')
@ -16,18 +13,20 @@ $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')
ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp')
require 'test/unit'
require 'active_support'
require 'active_support/test_case'
require 'abstract_controller'
require 'action_controller'
require 'action_view'
require 'action_view/base'
require 'action_dispatch'
require 'active_model'
require 'fixture_template'
require 'active_support/test_case'
require 'action_view/test_case'
require 'active_support/dependencies'
activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
require 'active_model'
begin
require 'ruby-debug'
Debugger.settings[:autoeval] = true

View file

@ -21,10 +21,11 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require 'active_support'
module ActiveModel
extend ActiveSupport::Autoload

View file

@ -1,11 +1,9 @@
root = File.expand_path('../../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
require File.expand_path('../../../../vendor/gems/environment', __FILE__)
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
lib = File.expand_path('../../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
require 'config'

View file

@ -21,11 +21,12 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib"
$:.unshift(activemodel_path) if File.directory?(activemodel_path)
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
require 'active_support'
require 'active_model'
@ -91,7 +92,7 @@ module ActiveRecord
module Type
extend ActiveSupport::Autoload
autoload :Number, 'active_record/types/number'
autoload :Object, 'active_record/types/object'
autoload :Serialize, 'active_record/types/serialize'
@ -101,14 +102,14 @@ module ActiveRecord
module Locking
extend ActiveSupport::Autoload
autoload :Optimistic
autoload :Pessimistic
end
module ConnectionAdapters
extend ActiveSupport::Autoload
autoload :AbstractAdapter
end
end

View file

@ -1,11 +1,9 @@
root = File.expand_path('../../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
require File.expand_path('../../../../vendor/gems/environment', __FILE__)
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
lib = File.expand_path('../../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
require 'config'

View file

@ -21,12 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
require 'active_support'
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib"
$:.unshift(activemodel_path) if File.directory?(activemodel_path)
activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
require 'active_support'
require 'active_model'
module ActiveResource

View file

@ -1,18 +1,16 @@
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
require File.expand_path('../../../vendor/gems/environment', __FILE__)
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
require 'rubygems'
require 'test/unit'
require 'active_resource'
require 'active_support'
require 'active_support/test_case'
require 'active_resource'
require 'active_model/test_case'
$:.unshift "#{File.dirname(__FILE__)}/../test"

View file

@ -4,9 +4,10 @@ rescue LoadError
# If people are not using gems, the load path must still
# be correct.
# TODO: Remove the begin / rescue block somehow
$:.unshift File.dirname(__FILE__) + '/../lib'
$:.unshift File.dirname(__FILE__) + '/../../activesupport/lib'
retry
$:.unshift File.expand_path('../../lib', __FILE__)
$:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
require 'rails/ruby_version_check'
end
Signal.trap("INT") { puts; exit }

View file

@ -1,5 +1,6 @@
activesupport_path = "#{File.dirname(__FILE__)}/../../../activesupport/lib"
$LOAD_PATH.unshift(activesupport_path) if File.directory?(activesupport_path)
activesupport_path = File.expand_path('../../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require 'active_support'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/metaclass'