Include bundled env in toplevel require, if present

This commit is contained in:
Jeremy Kemper 2009-10-14 19:15:33 -07:00
parent df55781458
commit 9c52f96acb
2 changed files with 10 additions and 11 deletions

View File

@ -21,17 +21,19 @@
# 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" bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment"
$:.unshift(activesupport_path) if File.directory?(activesupport_path) if File.exist?("#{bundled}.rb")
require 'active_support' require bundled
else
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
begin activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib"
require 'active_model' $:.unshift(activemodel_path) if File.directory?(activemodel_path)
rescue LoadError
$:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib"
require 'active_model'
end end
require 'active_support'
require 'active_model'
require 'arel' require 'arel'
module ActiveRecord module ActiveRecord

View File

@ -1,9 +1,6 @@
$:.unshift(File.dirname(__FILE__) + '/../../lib') $:.unshift(File.dirname(__FILE__) + '/../../lib')
$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib') $:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
bundler = "#{File.dirname(__FILE__)}/../../vendor/gems/environment"
require bundler if File.exist?("#{bundler}.rb")
require 'config' require 'config'
require 'rubygems' require 'rubygems'