Skip to content

Commit ee641c3

Browse files
committed
Use Rackup::Server with Rack v3
1 parent 0555c2c commit ee641c3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ group :development do
88
end
99

1010
group :test do
11-
gem 'rack', "~> #{ENV["RACK_VERSION"] || "3"}"
11+
rack_version = ENV.fetch('RACK_VERSION', '3')
12+
gem 'rack', "~> #{rack_version}"
13+
gem 'rackup' if rack_version == '3'
1214
gem 'rack-test', '~> 2'
1315
gem 'rspec', '~> 3.0', '>= 3.6.0'
1416
gem 'rspec-its', '~> 1.2'

lib/webmachine/adapters/rack.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ def run
5252
Host: application.configuration.ip
5353
}).merge(application.configuration.adapter_options)
5454

55-
@server = ::Rack::Server.new(options)
55+
if ::Rack::RELEASE.start_with?('3.')
56+
require 'rackup'
57+
@server = ::Rackup::Server.new(options)
58+
else
59+
@server = ::Rack::Server.new(options)
60+
end
5661
@server.start
5762
end
5863

0 commit comments

Comments
 (0)