Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions lib/rack/handler/iodine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ def self.shutdown
end
end

ENV['RACK_HANDLER'] ||= 'iodine'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible that iodine will be included before the rackup gem. In these cases having the ENV set could be beneficial for the later inclusion of rackup...

Let's leave this line outside the if statement.


begin
::Rack::Handler.register('iodine', 'Iodine::Rack') if defined?(::Rack::Handler)
::Rack::Handler.register('Iodine', 'Iodine::Rack') if defined?(::Rack::Handler)
rescue StandardError
# rackup was removed in Rack 3, it is now a separate gem
if Object.const_defined? :Rackup
ENV['RACKUP_HANDLER'] ||= 'iodine'

::Rackup::Handler.register(:iodine, Iodine::Rack) if defined?(::Rackup::Handler)
elsif Object.const_defined?(:Rack) && Rack::RELEASE < '3'
ENV['RACK_HANDLER'] ||= 'iodine'

begin
::Rack::Handler.register('iodine', 'Iodine::Rack') if defined?(::Rack::Handler)
::Rack::Handler.register('Iodine', 'Iodine::Rack') if defined?(::Rack::Handler)
rescue StandardError
end
else
raise "You must install the rackup gem when using Rack 3"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rackup gem is optional, no? why raise an error?

I am quite certain that the iodine CLI can be called without rackup installed.

end