mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
7d3092478c
Avoid "Constant already defined" warnings for RAILS_GEM_VERSION. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4196 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
38 lines
No EOL
1.1 KiB
Ruby
38 lines
No EOL
1.1 KiB
Ruby
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
|
|
|
unless defined?(RAILS_ROOT)
|
|
root_path = File.join(File.dirname(__FILE__), '..')
|
|
unless RUBY_PLATFORM =~ /mswin32/
|
|
require 'pathname'
|
|
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
|
end
|
|
RAILS_ROOT = root_path
|
|
end
|
|
|
|
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
|
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
|
else
|
|
require 'rubygems'
|
|
|
|
if !defined?(RAILS_GEM_VERSION) && File.read(File.dirname(__FILE__) + '/environment.rb') =~ /^\s*RAILS_GEM_VERSION = '([\d.]+)'/
|
|
RAILS_GEM_VERSION = $1
|
|
end
|
|
|
|
if defined?(RAILS_GEM_VERSION)
|
|
rails_gem = Gem.cache.search('rails', "=#{RAILS_GEM_VERSION}").first
|
|
|
|
if rails_gem
|
|
require rails_gem.full_gem_path + '/lib/initializer'
|
|
else
|
|
STDERR.puts %(Cannot find gem for Rails =#{RAILS_GEM_VERSION}:
|
|
Install the missing gem with 'gem install -v=#{RAILS_GEM_VERSION} rails', or
|
|
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
|
)
|
|
exit 1
|
|
end
|
|
else
|
|
require 'initializer'
|
|
end
|
|
end
|
|
|
|
Rails::Initializer.run(:set_load_path) |