Merge pull request #1794 from ioquatix/falcon-integration

Falcon integration
This commit is contained in:
Jordan Owens 2022-07-18 23:37:35 -04:00 committed by GitHub
commit cb7361714a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 3 deletions

View File

@ -24,6 +24,7 @@ gem "activesupport", "~> 6.1"
gem 'redcarpet', platforms: [ :ruby ]
gem 'rdiscount', platforms: [ :ruby ]
gem 'puma'
gem 'falcon', '~> 0.40', platforms: [ :ruby ]
gem 'yajl-ruby', platforms: [ :ruby ]
gem 'nokogiri', '> 1.5.0'
gem 'rainbows', platforms: [ :ruby ]
@ -38,7 +39,6 @@ gem 'rabl'
gem 'builder'
gem 'erubi'
gem 'haml', '~> 5'
gem 'celluloid', '~> 0.16.0'
gem 'commonmarker', '~> 0.20.0', platforms: [ :ruby ]
gem 'pandoc-ruby', '~> 2.0.2'
gem 'simplecov', require: false

View File

@ -1450,7 +1450,7 @@ module Sinatra
alias_method :stop!, :quit!
# Run the Sinatra app as a self-hosted server using
# Puma, Mongrel, or WEBrick (in that order). If given a block, will call
# Puma, Falcon, Mongrel, or WEBrick (in that order). If given a block, will call
# with the constructed handler once we have taken the stage.
def run!(options = {}, &block)
return if running?
@ -1793,6 +1793,7 @@ module Sinatra
ruby_engine = defined?(RUBY_ENGINE) && RUBY_ENGINE
server.unshift 'puma'
server.unshift 'falcon' if ruby_engine != 'jruby'
server.unshift 'mongrel' if ruby_engine.nil?
server.unshift 'thin' if ruby_engine != 'jruby'
server.unshift 'trinidad' if ruby_engine == 'jruby'

View File

@ -81,6 +81,10 @@ module IntegrationHelper
name.to_s == "puma"
end
def falcon?
name.to_s == "falcon"
end
def trinidad?
name.to_s == "trinidad"
end

View File

@ -13,7 +13,7 @@ class IntegrationTest < Minitest::Test
it('only extends main') { assert_equal "true", server.get("/mainonly") }
it 'logs once in development mode' do
next if server.puma? or server.rainbows? or RUBY_ENGINE == 'jruby'
next if server.puma? or server.falcon? or server.rainbows? or RUBY_ENGINE == 'jruby'
random = "%064x" % Kernel.rand(2**256-1)
server.get "/ping?x=#{random}"
count = server.log.scan("GET /ping?x=#{random}").count

View File

@ -488,6 +488,16 @@ class SettingsTest < Minitest::Test
assert @base.server.include?('puma')
assert @application.server.include?('puma')
end
it 'includes falcon on mruby' do
if RUBY_ENGINE == 'ruby'
assert @base.server.include?('falcon')
assert @application.server.include?('falcon')
else
assert !@base.server.include?('falcon')
assert !@application.server.include?('falcon')
end
end
end
describe 'app_file' do