mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	use rainbows instead of puma in examples
This commit is contained in:
		
							parent
							
								
									4b502e0ec6
								
							
						
					
					
						commit
						2bbbad0289
					
				
					 3 changed files with 24 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -1,7 +1,8 @@
 | 
			
		|||
#!/usr/bin/env ruby -I ../lib -I lib
 | 
			
		||||
# coding: utf-8
 | 
			
		||||
require_relative 'rainbows'
 | 
			
		||||
require 'sinatra'
 | 
			
		||||
set :server, 'puma'
 | 
			
		||||
set :server, :rainbows
 | 
			
		||||
connections = []
 | 
			
		||||
 | 
			
		||||
get '/' do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								examples/rainbows.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								examples/rainbows.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
require 'rainbows'
 | 
			
		||||
 | 
			
		||||
module Rack
 | 
			
		||||
  module Handler
 | 
			
		||||
    class Rainbows
 | 
			
		||||
      def self.run(app, **options)
 | 
			
		||||
        rainbows_options = {
 | 
			
		||||
          listeners: ["#{options[:Host]}:#{options[:Port]}"],
 | 
			
		||||
          worker_processes: 1,
 | 
			
		||||
          timeout: 30,
 | 
			
		||||
          config_file: ::File.expand_path('rainbows.conf', __dir__),
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::Rainbows::HttpServer.new(app, rainbows_options).start.join
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    register :rainbows, ::Rack::Handler::Rainbows
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -8,13 +8,13 @@ module Rack
 | 
			
		|||
          listeners: ["#{options[:Host]}:#{options[:Port]}"],
 | 
			
		||||
          worker_processes: 1,
 | 
			
		||||
          timeout: 30,
 | 
			
		||||
          config_file: ::File.expand_path('../rainbows.conf', __FILE__),
 | 
			
		||||
          config_file: ::File.expand_path('rainbows.conf', __dir__),
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::Rainbows::HttpServer.new(app, rainbows_options).start.join
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    register "rainbows", "Rack::Handler::Rainbows"
 | 
			
		||||
    register :rainbows, ::Rack::Handler::Rainbows
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue