Skip to content

Commit eeab7f0

Browse files
authored
Merge pull request #136 from marocchino/puma6
Update puma registration for puma 6
2 parents 50dbbf9 + 54ecbc5 commit eeab7f0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/cypress-rails/server/puma.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ def self.create(app, port, host)
1212

1313
conf = Rack::Handler::Puma.config(app, options)
1414
conf.clamp
15-
events = ::Puma::Events.stdio
15+
logger = (defined?(::Puma::LogWriter) ? ::Puma::LogWriter : ::Puma::Events).stdio
1616

1717
puma_ver = Gem::Version.new(::Puma::Const::PUMA_VERSION)
1818
require_relative "patches/puma_ssl" if (Gem::Version.new("4.0.0")...Gem::Version.new("4.1.0")).cover? puma_ver
1919

20-
events.log "Starting Puma..."
21-
events.log "* Version #{::Puma::Const::PUMA_VERSION} , codename: #{::Puma::Const::CODE_NAME}"
22-
events.log "* Min threads: #{conf.options[:min_threads]}, max threads: #{conf.options[:max_threads]}"
20+
logger.log "Starting Puma..."
21+
logger.log "* Version #{::Puma::Const::PUMA_VERSION} , codename: #{::Puma::Const::CODE_NAME}"
22+
logger.log "* Min threads: #{conf.options[:min_threads]}, max threads: #{conf.options[:max_threads]}"
2323

24-
::Puma::Server.new(conf.app, events, conf.options).tap do |s|
25-
s.binder.parse conf.options[:binds], s.events
26-
s.min_threads, s.max_threads = conf.options[:min_threads], conf.options[:max_threads]
24+
::Puma::Server.new(conf.app, defined?(::Puma::LogWriter) ? nil : logger, conf.options).tap do |s|
25+
s.binder.parse conf.options[:binds], s.respond_to?(:log_writer) ? s.log_writer : s.events
26+
s.min_threads, s.max_threads = conf.options[:min_threads], conf.options[:max_threads] if s.respond_to?(:min_threads=)
2727
end.run.join
2828
end
2929
end

0 commit comments

Comments
 (0)