Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7832

Show
Ignore:
Timestamp:
10/11/07 02:01:37 (1 year ago)
Author:
bitsweat
Message:

Correct RAILS_GEM_VERSION regexp. Use =version gem requirement instead of ~>version so you don't get surprised by a beta gem in production. This change means upgrading to 1.2.5 will require a boot.rb upgrade.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1-2-stable/railties/CHANGELOG

    r7786 r7832  
    11*SVN* 
     2 
     3* Correct RAILS_GEM_VERSION regexp. Use =version gem requirement instead of ~>version so you don't get surprised by a beta gem in production. This change means upgrading to 1.2.5 will require a boot.rb upgrade.  [Jeremy Kemper] 
    24 
    35* Move custom inflections example so available before route generation.  #6829 [dcmanges, Nate, piotrb] 
  • branches/1-2-stable/railties/environments/boot.rb

    r6447 r7832  
    99    require 'rubygems' 
    1010 
    11     environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join 
    12     environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/ 
    13     rails_gem_version = $1 
     11    rails_gem_version = 
     12      if defined? RAILS_GEM_VERSION 
     13        RAILS_GEM_VERSION 
     14      else 
     15        File.read("#{File.dirname(__FILE__)}/environment.rb") =~ /^[^#]*RAILS_GEM_VERSION\s+=\s+'([\d.]+)'/ 
     16        $1 
     17      end 
    1418 
    15     if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version 
    16       # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems 
    17       rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last 
     19    if rails_gem_version 
     20      rails_gem = Gem.cache.search('rails', "=#{rails_gem_version}.0").sort_by { |g| g.version.version }.last 
    1821 
    1922      if rails_gem 
     
    2124        require rails_gem.full_gem_path + '/lib/initializer' 
    2225      else 
    23         STDERR.puts %(Cannot find gem for Rails ~>#{version}.0: 
    24     Install the missing gem with 'gem install -v=#{version} rails', or 
     26        STDERR.puts %(Cannot find gem for Rails =#{rails_gem_version}.0: 
     27    Install the missing gem with 'gem install -v=#{rails_gem_version} rails', or 
    2528    change environment.rb to define RAILS_GEM_VERSION with your desired version. 
    2629  )