Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Falcon integration #1794

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
add falcon into server list
  • Loading branch information
horaciob authored and ioquatix committed Jul 17, 2022
commit 280e40b0fd2ec3dcdce68bf18a1d311cea321668
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -40,7 +41,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
Expand Down
3 changes: 2 additions & 1 deletion lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def quit!
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?
Expand Down Expand Up @@ -1801,6 +1801,7 @@ class << self
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'
Expand Down
4 changes: 4 additions & 0 deletions test/integration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def puma?
name.to_s == "puma"
end

def falcon?
name.to_s == "falcon"
end

def trinidad?
name.to_s == "trinidad"
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/settings_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,16 @@ def pub; end
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
Expand Down