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.exists?(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"
51 self.class.load_rubygems
57 if version = self.class.gem_version
62 rescue Gem::LoadError => load_error
63 $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.)
69 Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
73 if defined? RAILS_GEM_VERSION
75 elsif ENV.include?('RAILS_GEM_VERSION')
76 ENV['RAILS_GEM_VERSION']
78 parse_gem_version(read_environment_rb)
85 unless rubygems_version >= '0.9.4'
86 $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
91 $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
95 def parse_gem_version(text)
96 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/
100 def read_environment_rb
101 File.read("#{RAILS_ROOT}/config/environment.rb")