mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Reject Ruby 1.8.3 when loading Rails; extract version checking code.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3982 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
5ff59bff82
commit
48e7edc31b
4 changed files with 29 additions and 19 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Reject Ruby 1.8.3 when loading Rails; extract version checking code. [Chad Fowler]
|
||||
|
||||
* Remove explicit loading of RailsInfo and RailsInfoController. [Nicholas Seckar]
|
||||
|
||||
* Move RailsInfo and RailsInfoController to Rails::Info and Rails::InfoController. [Nicholas Seckar]
|
||||
|
|
|
@ -1,21 +1,4 @@
|
|||
min_release = "1.8.2 (2004-12-25)"
|
||||
ruby_release = "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE})"
|
||||
if ruby_release =~ /1\.8\.3/
|
||||
abort <<-end_message
|
||||
|
||||
Rails does not work with Ruby version 1.8.3.
|
||||
Please upgrade to version 1.8.4 or downgrade to 1.8.2.
|
||||
|
||||
end_message
|
||||
elsif ruby_release < min_release
|
||||
abort <<-end_message
|
||||
|
||||
Rails requires Ruby version #{min_release} or later.
|
||||
You're running #{ruby_release}; please upgrade to continue.
|
||||
|
||||
end_message
|
||||
end
|
||||
|
||||
require File.dirname(__FILE__) + '/../lib/ruby_version_check'
|
||||
Signal.trap("INT") { puts; exit }
|
||||
|
||||
require File.dirname(__FILE__) + '/../lib/rails_version'
|
||||
|
|
|
@ -74,6 +74,7 @@ module Rails
|
|||
# environment could overwrite the defaults directly, instead of via the
|
||||
# Configuration instance.
|
||||
def process
|
||||
check_ruby_version
|
||||
set_load_path
|
||||
set_connection_adapters
|
||||
|
||||
|
@ -106,7 +107,14 @@ module Rails
|
|||
# the framework is now fully initialized
|
||||
after_initialize
|
||||
end
|
||||
|
||||
|
||||
# Check for valid Ruby version
|
||||
# This is done in an external file, so we can use it
|
||||
# from the `rails` program as well without duplication.
|
||||
def check_ruby_version
|
||||
require 'ruby_version_check'
|
||||
end
|
||||
|
||||
# Set the <tt>$LOAD_PATH</tt> based on the value of
|
||||
# Configuration#load_paths. Duplicates are removed.
|
||||
def set_load_path
|
||||
|
|
17
railties/lib/ruby_version_check.rb
Normal file
17
railties/lib/ruby_version_check.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
min_release = "1.8.2 (2004-12-25)"
|
||||
ruby_release = "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE})"
|
||||
if ruby_release =~ /1\.8\.3/
|
||||
abort <<-end_message
|
||||
|
||||
Rails does not work with Ruby version 1.8.3.
|
||||
Please upgrade to version 1.8.4 or downgrade to 1.8.2.
|
||||
|
||||
end_message
|
||||
elsif ruby_release < min_release
|
||||
abort <<-end_message
|
||||
|
||||
Rails requires Ruby version #{min_release} or later.
|
||||
You're running #{ruby_release}; please upgrade to continue.
|
||||
|
||||
end_message
|
||||
end
|
Loading…
Reference in a new issue