Do not suggest adding non-existent gems to Gemfile
While these are valid Rack Handler names, their handler name is not the same as their gem name. | handler | gem | | ------- | ---------- | | fastcgi | fcgi | | lsws | ruby-lsapi |
This commit is contained in:
parent
6db58ed7b6
commit
92b716204e
@ -94,9 +94,10 @@ module Command
|
||||
class ServerCommand < Base # :nodoc:
|
||||
include EnvironmentArgument
|
||||
|
||||
RACK_HANDLER_GEMS = %w(cgi webrick scgi thin puma unicorn falcon)
|
||||
# Hard-coding a bunch of handlers here as we don't have a public way of
|
||||
# querying them from the Rack::Handler registry.
|
||||
RACK_SERVERS = %w(cgi fastcgi webrick lsws scgi thin puma unicorn falcon)
|
||||
RACK_HANDLERS = RACK_HANDLER_GEMS + %w(fastcgi lsws)
|
||||
RECOMMENDED_SERVER = "puma"
|
||||
|
||||
DEFAULT_PORT = 3000
|
||||
@ -259,7 +260,7 @@ def rack_server_suggestion(server)
|
||||
|
||||
Run `#{executable} --help` for more options.
|
||||
MSG
|
||||
elsif server.in?(RACK_SERVERS)
|
||||
elsif server.in?(RACK_HANDLER_GEMS)
|
||||
<<~MSG
|
||||
Could not load server "#{server}". Maybe you need to the add it to the Gemfile?
|
||||
|
||||
@ -268,7 +269,7 @@ def rack_server_suggestion(server)
|
||||
Run `#{executable} --help` for more options.
|
||||
MSG
|
||||
else
|
||||
error = CorrectableNameError.new("Could not find server '#{server}'.", server, RACK_SERVERS)
|
||||
error = CorrectableNameError.new("Could not find server '#{server}'.", server, RACK_HANDLERS)
|
||||
<<~MSG
|
||||
#{error.detailed_message}
|
||||
Run `#{executable} --help` for more options.
|
||||
|
@ -50,6 +50,18 @@ def test_using_known_server_that_isnt_in_the_gemfile
|
||||
assert_match(/Could not load server "unicorn". Maybe you need to the add it to the Gemfile/, run_command("-u", "unicorn"))
|
||||
end
|
||||
|
||||
def test_gem_not_suggested_when_name_not_same_as_handler
|
||||
build_app
|
||||
|
||||
["fastcgi", "lsws"].each do |server|
|
||||
output = rails "server", "-u", server
|
||||
assert_match(/Could not find server '#{server}'./, output)
|
||||
assert_no_match("Gemfile", output)
|
||||
end
|
||||
ensure
|
||||
teardown_app
|
||||
end
|
||||
|
||||
def test_daemon_with_option
|
||||
args = ["-d"]
|
||||
options = parse_arguments(args)
|
||||
|
Loading…
Reference in New Issue
Block a user