mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove deprecated support to old config.ru
that use the application class as argument of run
This commit is contained in:
parent
e20589c9be
commit
553b86fc75
3 changed files with 4 additions and 27 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
* Remove deprecated support to old `config.ru` that use the application class as argument of `run`.
|
||||||
|
|
||||||
|
*Rafael Mendonça França*
|
||||||
|
|
||||||
* Remove deprecated `environment` argument from the rails commands.
|
* Remove deprecated `environment` argument from the rails commands.
|
||||||
|
|
||||||
*Rafael Mendonça França*
|
*Rafael Mendonça França*
|
||||||
|
|
|
@ -21,19 +21,6 @@ module Rails
|
||||||
set_environment
|
set_environment
|
||||||
end
|
end
|
||||||
|
|
||||||
def app
|
|
||||||
@app ||= begin
|
|
||||||
app = super
|
|
||||||
if app.is_a?(Class)
|
|
||||||
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
||||||
Using `Rails::Application` subclass to start the server is deprecated and will be removed in Rails 6.0.
|
|
||||||
Please change `run #{app}` to `run Rails.application` in config.ru.
|
|
||||||
MSG
|
|
||||||
end
|
|
||||||
app.respond_to?(:to_app) ? app.to_app : app
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def opt_parser
|
def opt_parser
|
||||||
Options.new
|
Options.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,20 +18,6 @@ module ApplicationTests
|
||||||
teardown_app
|
teardown_app
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deprecate support of older `config.ru`" do
|
|
||||||
remove_file "config.ru"
|
|
||||||
app_file "config.ru", <<-RUBY
|
|
||||||
require_relative 'config/environment'
|
|
||||||
run AppTemplate::Application
|
|
||||||
RUBY
|
|
||||||
|
|
||||||
server = Rails::Server.new(config: "#{app_path}/config.ru")
|
|
||||||
server.app
|
|
||||||
|
|
||||||
log = File.read(Rails.application.config.paths["log"].first)
|
|
||||||
assert_match(/DEPRECATION WARNING: Using `Rails::Application` subclass to start the server is deprecated/, log)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "restart rails server with custom pid file path" do
|
test "restart rails server with custom pid file path" do
|
||||||
skip "PTY unavailable" unless available_pty?
|
skip "PTY unavailable" unless available_pty?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue