1 # Don't change this file!
2 # Configure your app in config/environment.rb and config/environments/*.rb
4 RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
16 defined? Rails::Initializer
20 (vendor_rails? ? VendorBoot : GemBoot).new
24 File.exist?("#{RAILS_ROOT}/vendor/rails")
28 load(preinitializer_path) if File.exist?(preinitializer_path)
31 def preinitializer_path
32 "#{RAILS_ROOT}/config/preinitializer.rb"
39 Rails::Initializer.run(:set_load_path)
43 class VendorBoot < Boot
45 require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46 Rails::Initializer.run(:install_gem_spec_stubs)
47 Rails::GemDependency.add_frozen_gem_path
53 self.class.load_rubygems
59 if version = self.class.gem_version
64 rescue Gem::LoadError => load_error
65 $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
71 Gem::RubyGemsVersion rescue nil
75 if defined? RAILS_GEM_VERSION
77 elsif ENV.include?('RAILS_GEM_VERSION')
78 ENV['RAILS_GEM_VERSION']
80 parse_gem_version(read_environment_rb)
87 unless rubygems_version >= min_version
88 $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
93 $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
97 def parse_gem_version(text)
98 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
102 def read_environment_rb
103 File.read("#{RAILS_ROOT}/config/environment.rb")