generators/app/templates/test/app_root/config/boot.rb in newplugin-0.0.2 vs generators/app/templates/test/app_root/config/boot.rb in newplugin-0.0.3

- old
+ new

@@ -1,6 +1,7 @@ -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) +PLUGIN_RAILS_ROOT = "#{File.dirname(__FILE__)}/.." +RAILS_ROOT = PLUGIN_RAILS_ROOT unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? @@ -57,24 +58,24 @@ gem 'rails', version else gem 'rails' end rescue Gem::LoadError => load_error - $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.) + $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`.) exit 1 end class << self def rubygems_version Gem::RubyGemsVersion rescue nil end def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] + if defined? RAILS_VERSION + RAILS_VERSION + elsif ENV.include?('RAILS_VERSION') + ENV['RAILS_VERSION'] else parse_gem_version(read_environment_rb) end end @@ -90,10 +91,10 @@ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) exit 1 end def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ + $1 if text =~ /^[^#]*RAILS_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ end private def read_environment_rb File.read("#{RAILS_ROOT}/config/environment.rb")