1 # Don't change this file!
2 # Configure your app in config/environment.rb and config/environments/*.rb
4 RAILS_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..") unless defined?(RAILS_ROOT)
15 defined? Radiant::Initializer
30 File.exist?("#{RAILS_ROOT}/vendor/radiant")
34 File.exist?("#{RAILS_ROOT}/lib/radiant.rb")
38 pick_boot.is_a? GemBoot
45 Radiant::Initializer.run(:set_load_path)
51 require 'radiant/initializer'
53 $stderr.puts %(Radiant could not be initialized. #{load_error_message})
59 class VendorBoot < Boot
61 $LOAD_PATH.unshift "#{RAILS_ROOT}/vendor/radiant/lib"
65 def load_error_message
66 "Please verify that vendor/radiant contains a complete copy of the Radiant sources."
72 $LOAD_PATH.unshift "#{RAILS_ROOT}/lib"
76 def load_error_message
77 "Please verify that you have a complete copy of the Radiant sources."
83 self.class.load_rubygems
88 def load_error_message
89 "Please reinstall the Radiant gem with the command 'gem install radiant'."
93 if version = self.class.gem_version
94 gem 'radiant', version
98 rescue Gem::LoadError => load_error
99 $stderr.puts %(Missing the Radiant #{version} gem. Please `gem install -v=#{version} radiant`, update your RADIANT_GEM_VERSION setting in config/environment.rb for the Radiant version you do have installed, or comment out RADIANT_GEM_VERSION to use the latest version installed.)
105 Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
109 if defined? RADIANT_GEM_VERSION
111 elsif ENV.include?('RADIANT_GEM_VERSION')
112 ENV['RADIANT_GEM_VERSION']
114 parse_gem_version(read_environment_rb)
121 unless rubygems_version >= '0.9.4'
122 $stderr.puts %(Radiant requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
127 $stderr.puts %(Radiant requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
131 def parse_gem_version(text)
132 $1 if text =~ /^[^#]*RADIANT_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/
136 def read_environment_rb
137 File.read("#{RAILS_ROOT}/config/environment.rb")