Skip to content

Commit 05e9464

Browse files
zzakioquatix
andcommitted
Introduce Rails::Rackup::Server which is used by the bin/rails server command.
``` Failure: Rails::Command::HelpIntegrationTest#test_prints_help_via_`X:help`_command_when_running_`X`_and_`X:X`_command_is_not_defined [/Users/zzak/code/rails/railties/t est/command/help_integration_test.rb:33]: --- expected +++ actual @@ -1,4 +1,5 @@ -"Commands: +"Rack::Server is deprecated and replaced by Rackup::Server +Commands: bin/rails dev:cache # Toggle development mode caching on/off bin/rails dev:help [COMMAND] # Describe available commands or one specific... ``` From @ioquatix: > Yeah you need to load `rackup/server` and if you get `LoadError` fall back to `Rack::Server`. This PR implements that paraphrasing, and resolves this deprecation: ``` Rack::Server is deprecated and replaced by Rackup::Server ``` Example build: https://buildkite.com/rails/rails/builds/95468#0187559d-3190-4e6f-8ac5-65042b2a5412/1334-1342 Co-authored-by: Samuel Williams <[email protected]>
1 parent fcf8c1b commit 05e9464

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

railties/lib/rails/commands/server/server_command.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
require "active_support/core_ext/string/filters"
77
require "rails/dev_caching"
88
require "rails/command/environment_argument"
9-
require "rack/server"
9+
require "rails/rackup/server"
1010

1111
module Rails
12-
class Server < ::Rack::Server
12+
class Server < Rackup::Server
1313
class Options
1414
def parse!(args)
1515
Rails::Command::ServerCommand.new([], args).server_options

railties/lib/rails/rackup/server.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
# :enddoc:
4+
5+
module Rails
6+
module Rackup
7+
begin
8+
require "rackup/server"
9+
Server = ::Rackup::Server
10+
rescue LoadError
11+
require "rack/server"
12+
Server = ::Rack::Server
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)