Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 48e7edc31b873c343d3e696fc02af354a74f0683 1 parent 5ff59bf
@seckar seckar authored
View
2  railties/CHANGELOG
@@ -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]
View
19 railties/bin/rails
@@ -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'
View
10 railties/lib/initializer.rb
@@ -74,6 +74,7 @@ def initialize(configuration)
# 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 @@ def process
# 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
View
17 railties/lib/ruby_version_check.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.