mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Get rid of more 1.8.x dead code
This commit is contained in:
parent
2d5f5c32e6
commit
51095be1b0
10 changed files with 13 additions and 55 deletions
|
@ -12,19 +12,10 @@ require 'rails/version'
|
|||
require 'active_support/railtie'
|
||||
require 'action_dispatch/railtie'
|
||||
|
||||
# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
|
||||
# multibyte safe operations. Plugin authors supporting other encodings
|
||||
# should override this behavior and set the relevant +default_charset+
|
||||
# on ActionController::Base.
|
||||
#
|
||||
# For Ruby 1.9, UTF-8 is the default internal and external encoding.
|
||||
if RUBY_VERSION < '1.9'
|
||||
$KCODE='u'
|
||||
else
|
||||
silence_warnings do
|
||||
Encoding.default_external = Encoding::UTF_8
|
||||
Encoding.default_internal = Encoding::UTF_8
|
||||
end
|
||||
silence_warnings do
|
||||
Encoding.default_external = Encoding::UTF_8
|
||||
Encoding.default_internal = Encoding::UTF_8
|
||||
end
|
||||
|
||||
module Rails
|
||||
|
|
|
@ -478,7 +478,7 @@ class RecursiveHTTPFetcher
|
|||
def initialize(urls_to_fetch, level = 1, cwd = ".")
|
||||
@level = level
|
||||
@cwd = cwd
|
||||
@urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a
|
||||
@urls_to_fetch = urls_to_fetch.lines
|
||||
@quiet = false
|
||||
end
|
||||
|
||||
|
|
|
@ -182,11 +182,7 @@ module Rails
|
|||
end
|
||||
|
||||
def ruby_debugger_gemfile_entry
|
||||
if RUBY_VERSION < "1.9"
|
||||
"gem 'ruby-debug'"
|
||||
else
|
||||
"gem 'ruby-debug19', :require => 'ruby-debug'"
|
||||
end
|
||||
"gem 'ruby-debug19', :require => 'ruby-debug'"
|
||||
end
|
||||
|
||||
def assets_gemfile_entry
|
||||
|
|
|
@ -182,14 +182,9 @@ module Rails
|
|||
end
|
||||
end
|
||||
|
||||
# Returns Ruby 1.9 style key-value pair if current code is running on
|
||||
# Ruby 1.9.x. Returns the old-style (with hash rocket) otherwise.
|
||||
# Returns Ruby 1.9 style key-value pair.
|
||||
def key_value(key, value)
|
||||
if options[:old_style_hash] || RUBY_VERSION < '1.9'
|
||||
":#{key} => #{value}"
|
||||
else
|
||||
"#{key}: #{value}"
|
||||
end
|
||||
"#{key}: #{value}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,6 @@ source 'https://rubygems.org'
|
|||
<%= database_gemfile_entry -%>
|
||||
|
||||
<%= "gem 'jruby-openssl'\n" if defined?(JRUBY_VERSION) -%>
|
||||
<%= "gem 'json'\n" if RUBY_VERSION < "1.9.2" -%>
|
||||
|
||||
<%= assets_gemfile_entry %>
|
||||
<%= javascript_gemfile_entry %>
|
||||
|
|
|
@ -189,12 +189,8 @@ module ApplicationTests
|
|||
end
|
||||
|
||||
def assert_utf8
|
||||
if RUBY_VERSION < '1.9'
|
||||
assert_equal "UTF8", $KCODE
|
||||
else
|
||||
assert_equal Encoding::UTF_8, Encoding.default_external
|
||||
assert_equal Encoding::UTF_8, Encoding.default_internal
|
||||
end
|
||||
assert_equal Encoding::UTF_8, Encoding.default_external
|
||||
assert_equal Encoding::UTF_8, Encoding.default_internal
|
||||
end
|
||||
|
||||
test "skipping config.encoding still results in 'utf-8' as the default" do
|
||||
|
|
|
@ -285,17 +285,10 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_inclusion_of_ruby_debug
|
||||
def test_inclusion_of_ruby_debug19
|
||||
run_generator
|
||||
assert_file "Gemfile" do |contents|
|
||||
assert_match(/gem 'ruby-debug'/, contents) if RUBY_VERSION < '1.9'
|
||||
end
|
||||
end
|
||||
|
||||
def test_inclusion_of_ruby_debug19_if_ruby19
|
||||
run_generator
|
||||
assert_file "Gemfile" do |contents|
|
||||
assert_match(/gem 'ruby-debug19', :require => 'ruby-debug'/, contents) unless RUBY_VERSION < '1.9'
|
||||
assert_match(/gem 'ruby-debug19', :require => 'ruby-debug'/, contents)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,11 +10,7 @@ class MailerGeneratorTest < Rails::Generators::TestCase
|
|||
run_generator
|
||||
assert_file "app/mailers/notifier.rb" do |mailer|
|
||||
assert_match(/class Notifier < ActionMailer::Base/, mailer)
|
||||
if RUBY_VERSION < "1.9"
|
||||
assert_match(/default :from => "from@example.com"/, mailer)
|
||||
else
|
||||
assert_match(/default from: "from@example.com"/, mailer)
|
||||
end
|
||||
assert_match(/default from: "from@example.com"/, mailer)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -155,11 +155,7 @@ class NamespacedMailerGeneratorTest < NamespacedGeneratorTestCase
|
|||
assert_file "app/mailers/test_app/notifier.rb" do |mailer|
|
||||
assert_match(/module TestApp/, mailer)
|
||||
assert_match(/class Notifier < ActionMailer::Base/, mailer)
|
||||
if RUBY_VERSION < "1.9"
|
||||
assert_match(/default :from => "from@example.com"/, mailer)
|
||||
else
|
||||
assert_match(/default from: "from@example.com"/, mailer)
|
||||
end
|
||||
assert_match(/default from: "from@example.com"/, mailer)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,10 +46,6 @@ module RailtiesTests
|
|||
|
||||
gem 'rails', :path => '#{RAILS_FRAMEWORK_ROOT}'
|
||||
gem 'sqlite3'
|
||||
|
||||
if RUBY_VERSION < '1.9'
|
||||
gem "ruby-debug", ">= 0.10.3"
|
||||
end
|
||||
GEMFILE
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue