2005-12-07 22:54:50 -05:00
|
|
|
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
|
|
|
|
2007-03-18 09:35:16 -04:00
|
|
|
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
2005-09-03 11:13:06 -04:00
|
|
|
|
2006-04-07 14:21:52 -04:00
|
|
|
unless defined?(Rails::Initializer)
|
|
|
|
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
|
|
|
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
|
|
|
else
|
|
|
|
require 'rubygems'
|
2006-04-01 00:55:47 -05:00
|
|
|
|
2006-04-07 14:21:52 -04:00
|
|
|
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
|
|
|
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
|
|
|
rails_gem_version = $1
|
2006-04-01 00:55:47 -05:00
|
|
|
|
2006-04-07 14:21:52 -04:00
|
|
|
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
2006-11-22 23:40:48 -05:00
|
|
|
# Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems
|
|
|
|
rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
|
2006-04-01 00:55:47 -05:00
|
|
|
|
2006-04-07 14:21:52 -04:00
|
|
|
if rails_gem
|
2007-02-04 15:44:45 -05:00
|
|
|
gem "rails", "=#{rails_gem.version.version}"
|
2006-04-07 14:21:52 -04:00
|
|
|
require rails_gem.full_gem_path + '/lib/initializer'
|
|
|
|
else
|
2006-11-22 23:49:07 -05:00
|
|
|
STDERR.puts %(Cannot find gem for Rails ~>#{version}.0:
|
2006-04-07 14:21:52 -04:00
|
|
|
Install the missing gem with 'gem install -v=#{version} rails', or
|
|
|
|
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
|
|
|
)
|
|
|
|
exit 1
|
|
|
|
end
|
2006-04-01 00:55:47 -05:00
|
|
|
else
|
2007-02-04 15:44:45 -05:00
|
|
|
gem "rails"
|
2006-04-07 14:21:52 -04:00
|
|
|
require 'initializer'
|
2006-04-01 00:55:47 -05:00
|
|
|
end
|
2006-03-31 23:58:46 -05:00
|
|
|
end
|
2005-09-30 11:13:44 -04:00
|
|
|
|
2006-04-07 14:21:52 -04:00
|
|
|
Rails::Initializer.run(:set_load_path)
|
2007-03-06 04:22:07 -05:00
|
|
|
end
|