diff --git a/Gemfile b/Gemfile index 03ff03f6..8a8c541d 100644 --- a/Gemfile +++ b/Gemfile @@ -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 ] @@ -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 diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 97c6b2c5..57bf2201 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -1458,7 +1458,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? @@ -1801,6 +1801,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' diff --git a/test/integration_helper.rb b/test/integration_helper.rb index 5bdaa5d3..aed31a69 100644 --- a/test/integration_helper.rb +++ b/test/integration_helper.rb @@ -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 diff --git a/test/integration_test.rb b/test/integration_test.rb index e174af53..f7069d51 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -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 diff --git a/test/settings_test.rb b/test/settings_test.rb index 69fc3d27..10d9796b 100644 --- a/test/settings_test.rb +++ b/test/settings_test.rb @@ -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