1 # -*- encoding: binary -*-
3 # Don't change this file!
4 # Configure your app in config/environment.rb and config/environments/*.rb
6 RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
18 defined? Rails::Initializer
22 (vendor_rails? ? VendorBoot : GemBoot).new
26 File.exist?("#{RAILS_ROOT}/vendor/rails")
30 load(preinitializer_path) if File.exist?(preinitializer_path)
33 def preinitializer_path
34 "#{RAILS_ROOT}/config/preinitializer.rb"
41 Rails::Initializer.run(:set_load_path)
45 class VendorBoot < Boot
47 require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
48 Rails::Initializer.run(:install_gem_spec_stubs)
54 self.class.load_rubygems
60 if version = self.class.gem_version
65 rescue Gem::LoadError => load_error
66 $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.)
72 Gem::RubyGemsVersion rescue nil
76 if defined? RAILS_GEM_VERSION
78 elsif ENV.include?('RAILS_GEM_VERSION')
79 ENV['RAILS_GEM_VERSION']
81 parse_gem_version(read_environment_rb)
88 unless rubygems_version >= min_version
89 $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
94 $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
98 def parse_gem_version(text)
99 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
103 def read_environment_rb
104 File.read("#{RAILS_ROOT}/config/environment.rb")