From c5e2311c9915a526b1600b5f0a41ed5b287b1e3f Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Mon, 17 Jun 2024 15:35:44 +0100 Subject: [PATCH] fix: rack 2.x dont load Rack::Handler::WEBrick class to avoid warnings use webbrick.rb custom handler in cli.rb --- lib/pact/mock_service/cli.rb | 6 +----- lib/pact/stub_service/cli.rb | 6 +----- lib/rack/handler/webbrick.rb | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/pact/mock_service/cli.rb b/lib/pact/mock_service/cli.rb index 7c91988..9ecd704 100755 --- a/lib/pact/mock_service/cli.rb +++ b/lib/pact/mock_service/cli.rb @@ -171,11 +171,7 @@ def version def require_common_dependencies require 'webrick/https' - begin - require 'rack/handler/webrick' - rescue LoadError - require 'rackup/handler/webrick' - end + require 'rack/handler/webbrick' require 'fileutils' require 'pact/mock_service/server/wait_for_server_up' require 'pact/mock_service/cli/pidfile' diff --git a/lib/pact/stub_service/cli.rb b/lib/pact/stub_service/cli.rb index 386e5b6..c1ea47d 100755 --- a/lib/pact/stub_service/cli.rb +++ b/lib/pact/stub_service/cli.rb @@ -1,10 +1,6 @@ require 'pact/mock_service/cli/custom_thor' require 'webrick/https' -begin - require 'rack/handler/webrick' -rescue LoadError - require 'rackup/handler/webrick' -end +require 'rack/handler/webbrick' require 'fileutils' require 'pact/mock_service/server/wait_for_server_up' require 'pact/mock_service/cli/pidfile' diff --git a/lib/rack/handler/webbrick.rb b/lib/rack/handler/webbrick.rb index 6b5acc0..b2ff8bc 100644 --- a/lib/rack/handler/webbrick.rb +++ b/lib/rack/handler/webbrick.rb @@ -2,7 +2,6 @@ module Rack module Handler begin require 'rack/handler/webrick' - WEBrick = Class.new(Rack::Handler::WEBrick) rescue LoadError require 'rackup/handler/webrick' WEBrick = Class.new(Rackup::Handler::WEBrick)