| Class | Rails::GemBoot |
| In: |
config/boot.rb
|
| Parent: | Boot |
# File config/boot.rb, line 73
73: def gem_version
74: if defined? RAILS_GEM_VERSION
75: RAILS_GEM_VERSION
76: elsif ENV.include?('RAILS_GEM_VERSION')
77: ENV['RAILS_GEM_VERSION']
78: else
79: parse_gem_version(read_environment_rb)
80: end
81: end
# File config/boot.rb, line 83
83: def load_rubygems
84: require 'rubygems'
85:
86: unless rubygems_version >= '0.9.4'
87: $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
88: exit 1
89: end
90:
91: rescue LoadError
92: $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
93: exit 1
94: end
# File config/boot.rb, line 96
96: def parse_gem_version(text)
97: $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
98: end
# File config/boot.rb, line 69
69: def rubygems_version
70: Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
71: end
# File config/boot.rb, line 101
101: def read_environment_rb
102: File.read("#{RAILS_ROOT}/config/environment.rb")
103: end
# File config/boot.rb, line 51
51: def load_initializer
52: self.class.load_rubygems
53: load_rails_gem
54: require 'initializer'
55: end
# File config/boot.rb, line 57
57: def load_rails_gem
58: if version = self.class.gem_version
59: gem 'rails', version
60: else
61: gem 'rails'
62: end
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.)
65: exit 1
66: end