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. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++ #++
actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib" actionpack_path = File.expand_path('../../../actionpack/lib', __FILE__)
$:.unshift(actionpack_path) if File.directory?(actionpack_path) $:.unshift(actionpack_path) if File.directory?(actionpack_path) && !$:.include?(actionpack_path)
require 'action_controller' require 'action_controller'
require 'action_view' require 'action_view'

View file

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

View file

@ -1,5 +1,9 @@
require "active_support/core_ext/module/attr_internal" activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
require "active_support/core_ext/module/delegation" $:.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 module AbstractController
extend ActiveSupport::Autoload 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 module ActionController
extend ActiveSupport::Autoload extend ActiveSupport::Autoload

View file

@ -21,6 +21,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # 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' require 'rack'
module Rack module Rack
@ -74,7 +78,3 @@ module ActionDispatch
end end
autoload :Mime, 'action_dispatch/http/mime_type' 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. # 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 module ActionView
extend ActiveSupport::Autoload extend ActiveSupport::Autoload
@ -51,10 +56,4 @@ end
require 'action_view/erb/util' require 'action_view/erb/util'
I18n.load_path << "#{File.dirname(__FILE__)}/action_view/locale/en.yml" 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 begin
require "#{root}/vendor/gems/environment" require File.expand_path('../../../vendor/gems/environment', __FILE__)
rescue LoadError rescue LoadError
$:.unshift "#{root}/activesupport/lib"
$:.unshift "#{root}/activemodel/lib"
end end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
$:.unshift(File.dirname(__FILE__) + '/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') ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp')
require 'test/unit' require 'test/unit'
require 'active_support'
require 'active_support/test_case'
require 'abstract_controller' require 'abstract_controller'
require 'action_controller' require 'action_controller'
require 'action_view' require 'action_view'
require 'action_view/base' require 'action_view/base'
require 'action_dispatch' require 'action_dispatch'
require 'active_model'
require 'fixture_template' require 'fixture_template'
require 'active_support/test_case'
require 'action_view/test_case' require 'action_view/test_case'
require 'active_support/dependencies' 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 begin
require 'ruby-debug' require 'ruby-debug'
Debugger.settings[:autoeval] = true Debugger.settings[:autoeval] = true

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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