File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
lib/rails/commands/server Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -94,9 +94,10 @@ module Command
94
94
class ServerCommand < Base # :nodoc:
95
95
include EnvironmentArgument
96
96
97
+ RACK_HANDLER_GEMS = %w( cgi webrick scgi thin puma unicorn falcon )
97
98
# Hard-coding a bunch of handlers here as we don't have a public way of
98
99
# querying them from the Rack::Handler registry.
99
- RACK_SERVERS = %w( cgi fastcgi webrick lsws scgi thin puma unicorn falcon )
100
+ RACK_HANDLERS = RACK_HANDLER_GEMS + %w( fastcgi lsws )
100
101
RECOMMENDED_SERVER = "puma"
101
102
102
103
DEFAULT_PORT = 3000
@@ -259,7 +260,7 @@ def rack_server_suggestion(server)
259
260
260
261
Run `#{ executable } --help` for more options.
261
262
MSG
262
- elsif server . in? ( RACK_SERVERS )
263
+ elsif server . in? ( RACK_HANDLER_GEMS )
263
264
<<~MSG
264
265
Could not load server "#{ server } ". Maybe you need to the add it to the Gemfile?
265
266
@@ -268,7 +269,7 @@ def rack_server_suggestion(server)
268
269
Run `#{ executable } --help` for more options.
269
270
MSG
270
271
else
271
- error = CorrectableNameError . new ( "Could not find server '#{ server } '." , server , RACK_SERVERS )
272
+ error = CorrectableNameError . new ( "Could not find server '#{ server } '." , server , RACK_HANDLERS )
272
273
<<~MSG
273
274
#{ error . detailed_message }
274
275
Run `#{ executable } --help` for more options.
Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ def test_using_known_server_that_isnt_in_the_gemfile
50
50
assert_match ( /Could not load server "unicorn". Maybe you need to the add it to the Gemfile/ , run_command ( "-u" , "unicorn" ) )
51
51
end
52
52
53
+ def test_gem_not_suggested_when_name_not_same_as_handler
54
+ build_app
55
+
56
+ [ "fastcgi" , "lsws" ] . each do |server |
57
+ output = rails "server" , "-u" , server
58
+ assert_match ( /Could not find server '#{ server } './ , output )
59
+ assert_no_match ( "Gemfile" , output )
60
+ end
61
+ ensure
62
+ teardown_app
63
+ end
64
+
53
65
def test_daemon_with_option
54
66
args = [ "-d" ]
55
67
options = parse_arguments ( args )
You can’t perform that action at this time.
0 commit comments