aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-04 12:26:01 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-04 12:26:01 -0300
commit6d72485b6977804a872dcfa5d7ade2cec74c768e (patch)
treeff4e2cf5ab8a010c00ee46ad8e7d26a479e416b5 /railties
parentc7a1fa364012c70e76d19b36881c9bde016091b8 (diff)
parentbf7b8c193ffe2d6a05272a6ed763d87cfe743bb4 (diff)
downloadrails-6d72485b6977804a872dcfa5d7ade2cec74c768e.tar.gz
rails-6d72485b6977804a872dcfa5d7ade2cec74c768e.tar.bz2
rails-6d72485b6977804a872dcfa5d7ade2cec74c768e.zip
Merge pull request #18325 from rafaelfranca/rm-remove-deprecations
Remove all deprecation code
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md14
-rw-r--r--railties/lib/rails/application/bootstrap.rb13
-rw-r--r--railties/lib/rails/application/configuration.rb32
-rw-r--r--railties/lib/rails/deprecation.rb19
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb5
-rw-r--r--railties/lib/rails/rack.rb1
-rw-r--r--railties/lib/rails/rack/log_tailer.rb38
-rw-r--r--railties/lib/rails/test_unit/testing.rake23
-rw-r--r--railties/test/application/configuration_test.rb46
-rw-r--r--railties/test/application/initializers/frameworks_test.rb1
-rw-r--r--railties/test/application/mailer_previews_test.rb52
-rw-r--r--railties/test/generators/generators_test_helper.rb10
-rw-r--r--railties/test/generators/model_generator_test.rb2
-rw-r--r--railties/test/isolation/abstract_unit.rb10
-rw-r--r--railties/test/railties/engine_test.rb4
15 files changed, 38 insertions, 232 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index f67c87d74d..f565b7bd55 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,3 +1,17 @@
+* Remove deprecated `test:all` and `test:all:db` tasks.
+
+* Remove deprecated `Rails::Rack::LogTailer`.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `RAILS_CACHE` constant.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `serve_static_assets` configuration.
+
+ *Rafael Mendonça França*
+
* Use local variables in `_form.html.erb` partial generated by scaffold.
*Andrew Kozlov*
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb
index 71d3febde4..0f4d932749 100644
--- a/railties/lib/rails/application/bootstrap.rb
+++ b/railties/lib/rails/application/bootstrap.rb
@@ -1,6 +1,5 @@
require "active_support/notifications"
require "active_support/dependencies"
-require "active_support/deprecation"
require "active_support/descendants_tracker"
module Rails
@@ -55,18 +54,6 @@ INFO
logger
end
- if Rails.env.production? && !config.has_explicit_log_level?
- ActiveSupport::Deprecation.warn \
- "You did not specify a `log_level` in `production.rb`. Currently, " \
- "the default value for `log_level` is `:info` for the production " \
- "environment and `:debug` in all other environments. In Rails 5 " \
- "the default value will be unified to `:debug` across all " \
- "environments. To preserve the current setting, add the following " \
- "line to your `production.rb`:\n" \
- "\n" \
- " config.log_level = :info\n\n"
- end
-
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
end
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index fdc741dd08..2821c8d757 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -1,7 +1,5 @@
require 'active_support/core_ext/kernel/reporting'
-require 'active_support/core_ext/string/filters'
require 'active_support/file_update_checker'
-require 'active_support/deprecation'
require 'rails/engine/configuration'
require 'rails/source_annotation_extractor'
@@ -17,6 +15,7 @@ module Rails
:time_zone, :reload_classes_only_on_change,
:beginning_of_week, :filter_redirect, :x
+ attr_writer :log_level
attr_reader :encoding
def initialize(*)
@@ -35,7 +34,6 @@ module Rails
@session_options = {}
@time_zone = "UTC"
@beginning_of_week = :monday
- @has_explicit_log_level = false
@log_level = nil
@middleware = app_middleware
@generators = app_generators
@@ -119,15 +117,6 @@ module Rails
raise e, "Cannot load `Rails.application.database_configuration`:\n#{e.message}", e.backtrace
end
- def has_explicit_log_level? # :nodoc:
- @has_explicit_log_level
- end
-
- def log_level=(level)
- @has_explicit_log_level = !!(level)
- @log_level = level
- end
-
def log_level
@log_level ||= (Rails.env.production? ? :info : :debug)
end
@@ -141,25 +130,6 @@ module Rails
self.generators.colorize_logging = val
end
- # :nodoc:
- SERVE_STATIC_ASSETS_DEPRECATION_MESSAGE = <<-MSG.squish
- The configuration option `config.serve_static_assets` has been renamed
- to `config.serve_static_files` to clarify its role (it merely enables
- serving everything in the `public` folder and is unrelated to the asset
- pipeline). The `serve_static_assets` alias will be removed in Rails 5.0.
- Please migrate your configuration files accordingly.
- MSG
-
- def serve_static_assets
- ActiveSupport::Deprecation.warn SERVE_STATIC_ASSETS_DEPRECATION_MESSAGE
- serve_static_files
- end
-
- def serve_static_assets=(value)
- ActiveSupport::Deprecation.warn SERVE_STATIC_ASSETS_DEPRECATION_MESSAGE
- self.serve_static_files = value
- end
-
def session_store(*args)
if args.empty?
case @session_store
diff --git a/railties/lib/rails/deprecation.rb b/railties/lib/rails/deprecation.rb
deleted file mode 100644
index 89f54069e9..0000000000
--- a/railties/lib/rails/deprecation.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'active_support/deprecation/proxy_wrappers'
-
-module Rails
- class DeprecatedConstant < ActiveSupport::Deprecation::DeprecatedConstantProxy
- def self.deprecate(old, current)
- # double assignment is used to avoid "assigned but unused variable" warning
- constant = constant = new(old, current)
- eval "::#{old} = constant"
- end
-
- private
-
- def target
- ::Kernel.eval @new_const.to_s
- end
- end
-
- DeprecatedConstant.deprecate('RAILS_CACHE', '::Rails.cache')
-end
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb
index dc0cc07888..c59ffb3491 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -31,10 +31,5 @@ module <%= app_const_base %>
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- <%- unless options.skip_active_record? -%>
-
- # Do not swallow errors in after_commit/after_rollback callbacks.
- config.active_record.raise_in_transactional_callbacks = true
- <%- end -%>
end
end
diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb
index 886f0e52e1..f34bf2fd41 100644
--- a/railties/lib/rails/rack.rb
+++ b/railties/lib/rails/rack.rb
@@ -2,6 +2,5 @@ module Rails
module Rack
autoload :Debugger, "rails/rack/debugger" if RUBY_VERSION < '2.0.0'
autoload :Logger, "rails/rack/logger"
- autoload :LogTailer, "rails/rack/log_tailer"
end
end
diff --git a/railties/lib/rails/rack/log_tailer.rb b/railties/lib/rails/rack/log_tailer.rb
deleted file mode 100644
index 46517713c9..0000000000
--- a/railties/lib/rails/rack/log_tailer.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-require 'active_support/deprecation'
-
-module Rails
- module Rack
- class LogTailer
- def initialize(app, log = nil)
- ActiveSupport::Deprecation.warn('LogTailer is deprecated and will be removed on Rails 5.')
-
- @app = app
-
- path = Pathname.new(log || "#{::File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath
-
- @cursor = @file = nil
- if ::File.exist?(path)
- @cursor = ::File.size(path)
- @file = ::File.open(path, 'r')
- end
- end
-
- def call(env)
- response = @app.call(env)
- tail!
- response
- end
-
- def tail!
- return unless @cursor
- @file.seek @cursor
-
- unless @file.eof?
- contents = @file.read
- @cursor = @file.tell
- $stdout.print contents
- end
- end
- end
- end
-end
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index 254ea9ecf6..d836c0d6d6 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -21,29 +21,6 @@ namespace :test do
desc "Run tests quickly, but also reset db"
task :db => %w[db:test:prepare test]
- desc "Run tests quickly by merging all types and not resetting db"
- Rails::TestTask.new(:all) do |t|
- t.pattern = "test/**/*_test.rb"
- end
-
- Rake::Task["test:all"].enhance do
- Rake::Task["test:deprecate_all"].invoke
- end
-
- task :deprecate_all do
- ActiveSupport::Deprecation.warn "rake test:all is deprecated and will be removed in Rails 5. " \
- "Use rake test to run all tests in test directory."
- end
-
- namespace :all do
- desc "Run tests quickly, but also reset db"
- task :db => %w[db:test:prepare test:all]
-
- Rake::Task["test:all:db"].enhance do
- Rake::Task["test:deprecate_all"].invoke
- end
- end
-
Rails::TestTask.new(single: "test:prepare")
["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index ad15e30b6a..8f5b2d0d68 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -320,22 +320,6 @@ module ApplicationTests
end
end
- test "config.serve_static_assets is deprecated" do
- require "#{app_path}/config/application"
-
- assert_deprecated(/serve_static_assets/) do
- app.config.serve_static_assets = false
- end
-
- assert_not app.config.serve_static_files
- assert_deprecated(/serve_static_assets/) { assert_not app.config.serve_static_assets }
-
- app.config.serve_static_files = true
-
- assert app.config.serve_static_files
- assert_deprecated(/serve_static_assets/) { assert app.config.serve_static_assets }
- end
-
test "Use key_generator when secret_key_base is set" do
make_basic_app do |application|
application.secrets.secret_key_base = 'b3c631c314c0bbca50c1b2843150fe33'
@@ -1062,36 +1046,6 @@ module ApplicationTests
end
end
- test "Blank config.log_level is not deprecated for non-production environment" do
- with_rails_env "development" do
- assert_not_deprecated do
- make_basic_app do |application|
- application.config.log_level = nil
- end
- end
- end
- end
-
- test "Blank config.log_level is deprecated for the production environment" do
- with_rails_env "production" do
- assert_deprecated(/log_level/) do
- make_basic_app do |application|
- application.config.log_level = nil
- end
- end
- end
- end
-
- test "Not blank config.log_level is not deprecated for the production environment" do
- with_rails_env "production" do
- assert_not_deprecated do
- make_basic_app do |application|
- application.config.log_level = :info
- end
- end
- end
- end
-
test "config.log_level with custom logger" do
make_basic_app do |application|
application.config.logger = Logger.new(STDOUT)
diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb
index 2d45c9b53f..97b51911d9 100644
--- a/railties/test/application/initializers/frameworks_test.rb
+++ b/railties/test/application/initializers/frameworks_test.rb
@@ -65,7 +65,6 @@ module ApplicationTests
RUBY
require "#{app_path}/config/environment"
- assert Foo.method_defined?(:foo_path)
assert Foo.method_defined?(:foo_url)
assert Foo.method_defined?(:main_app)
end
diff --git a/railties/test/application/mailer_previews_test.rb b/railties/test/application/mailer_previews_test.rb
index 9e4f858539..1752a9f3c6 100644
--- a/railties/test/application/mailer_previews_test.rb
+++ b/railties/test/application/mailer_previews_test.rb
@@ -428,58 +428,6 @@ module ApplicationTests
assert_match '<option selected value="?part=text%2Fplain">View as plain-text email</option>', last_response.body
end
- test "*_path helpers emit a deprecation" do
-
- app_file "config/routes.rb", <<-RUBY
- Rails.application.routes.draw do
- get 'foo', to: 'foo#index'
- end
- RUBY
-
- mailer 'notifier', <<-RUBY
- class Notifier < ActionMailer::Base
- default from: "from@example.com"
-
- def path_in_view
- mail to: "to@example.org"
- end
-
- def path_in_mailer
- @url = foo_path
- mail to: "to@example.org"
- end
- end
- RUBY
-
- html_template 'notifier/path_in_view', "<%= link_to 'foo', foo_path %>"
-
- mailer_preview 'notifier', <<-RUBY
- class NotifierPreview < ActionMailer::Preview
- def path_in_view
- Notifier.path_in_view
- end
-
- def path_in_mailer
- Notifier.path_in_mailer
- end
- end
- RUBY
-
- app('development')
-
- assert_deprecated do
- get "/rails/mailers/notifier/path_in_view.html"
- assert_equal 200, last_response.status
- end
-
- html_template 'notifier/path_in_mailer', "No ERB in here"
-
- assert_deprecated do
- get "/rails/mailers/notifier/path_in_mailer.html"
- assert_equal 200, last_response.status
- end
- end
-
private
def build_app
super
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index 6cc91f166b..94099fcd2e 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/railties/test/generators/generators_test_helper.rb
@@ -49,4 +49,14 @@ module GeneratorsTestHelper
end
end
end
+
+ def silence_stream(stream)
+ old_stream = stream.dup
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
+ stream.sync = true
+ yield
+ ensure
+ stream.reopen(old_stream)
+ old_stream.close
+ end
end
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index afee0a655d..f3b699101f 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -223,7 +223,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase
def test_migration_with_timestamps
run_generator
- assert_migration "db/migrate/create_accounts.rb", /t.timestamps null: false/
+ assert_migration "db/migrate/create_accounts.rb", /t.timestamps/
end
def test_migration_timestamps_are_skipped
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 9ad0ec0d34..39e8a5f756 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -338,6 +338,16 @@ class ActiveSupport::TestCase
end
end
end
+
+ def silence_stream(stream)
+ old_stream = stream.dup
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
+ stream.sync = true
+ yield
+ ensure
+ stream.reopen(old_stream)
+ old_stream.close
+ end
end
# Create a scope and build a fixture rails app
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index 4ffcf64275..6185742cc1 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -741,8 +741,8 @@ YAML
assert_equal "bukkits_", Bukkits.table_name_prefix
assert_equal "bukkits", Bukkits::Engine.engine_name
assert_equal Bukkits.railtie_namespace, Bukkits::Engine
- assert ::Bukkits::MyMailer.method_defined?(:foo_path)
- assert !::Bukkits::MyMailer.method_defined?(:bar_path)
+ assert ::Bukkits::MyMailer.method_defined?(:foo_url)
+ assert !::Bukkits::MyMailer.method_defined?(:bar_url)
get("/bukkits/from_app")
assert_equal "false", last_response.body