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)
52 self.class.load_rubygems
58 if version = self.class.gem_version
63 rescue Gem::LoadError => load_error
64 $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.)
70 Gem::RubyGemsVersion rescue nil
74 if defined? RAILS_GEM_VERSION
76 elsif ENV.include?('RAILS_GEM_VERSION')
77 ENV['RAILS_GEM_VERSION']
79 parse_gem_version(read_environment_rb)
86 unless rubygems_version >= min_version
87 $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
92 $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
96 def parse_gem_version(text)
97 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
101 def read_environment_rb
102 File.read("#{RAILS_ROOT}/config/environment.rb")