diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-18 17:28:55 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-18 17:28:55 +0000 |
commit | b98dcdec070c41e49b38766d83cc8c2b6f71516b (patch) | |
tree | 0385a3007d15524ab17e608d820df92c188e2290 /railties/environments/boot.rb | |
parent | d6f49e4af114a28e48e5c36932d35eeef614d7a0 (diff) | |
download | rails-b98dcdec070c41e49b38766d83cc8c2b6f71516b.tar.gz rails-b98dcdec070c41e49b38766d83cc8c2b6f71516b.tar.bz2 rails-b98dcdec070c41e49b38766d83cc8c2b6f71516b.zip |
Merge [7832] from 1-2-stable: Correct RAILS_GEM_VERSION regexp. Use =version gem requirement instead of ~>version so you don't get surprised by a beta gem in production.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7964 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/environments/boot.rb')
-rw-r--r-- | railties/environments/boot.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/railties/environments/boot.rb b/railties/environments/boot.rb index 901deb666d..0f034f07bf 100644 --- a/railties/environments/boot.rb +++ b/railties/environments/boot.rb @@ -8,20 +8,23 @@ unless defined?(Rails::Initializer) else require 'rubygems' - environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join - environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/ - rails_gem_version = $1 + rails_gem_version = + if defined? RAILS_GEM_VERSION + RAILS_GEM_VERSION + else + File.read("#{File.dirname(__FILE__)}/environment.rb") =~ /^[^#]*RAILS_GEM_VERSION\s+=\s+'([\d.]+)'/ + $1 + end - if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version - # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems - rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last + if rails_gem_version + rails_gem = Gem.cache.search('rails', "=#{rails_gem_version}.0").sort_by { |g| g.version.version }.last if rails_gem gem "rails", "=#{rails_gem.version.version}" require rails_gem.full_gem_path + '/lib/initializer' else - STDERR.puts %(Cannot find gem for Rails ~>#{version}.0: - Install the missing gem with 'gem install -v=#{version} rails', or + STDERR.puts %(Cannot find gem for Rails =#{rails_gem_version}.0: + Install the missing gem with 'gem install -v=#{rails_gem_version} rails', or change environment.rb to define RAILS_GEM_VERSION with your desired version. ) exit 1 |