Skip to content
Browse files

add zbatery

  • Loading branch information...
1 parent 4f4fd60 commit 4de82c2502ccaeca6b5c14ed9dddb37f8786f3a7 @rkh committed
View
2 README.md
@@ -2,6 +2,7 @@ Sinatra::MoreServer
=======================
Adds support for more web servers to [Sinatra](http://sinatrarb.com)::Base#run!.
+(Read: The server used when running `ruby yourfile.rb`. This has no effect rackup and akin.)
BigBand
-------
@@ -22,6 +23,7 @@ Currently, this extensions adds support for:
* [Unicorn](http://unicorn.bogomips.org/)
* [Rainbows!](http://rainbows.bogomips.org/)
+* [Zbatery](http://zbatery.bogomip.org/)
* [Ebb](http://ebb.rubyforge.org/)
Usage
View
8 lib/sinatra/more_server.rb
@@ -3,14 +3,16 @@
module Sinatra
# Adds more servers to Sinatra::Base#run! (currently unicorn and rainbows).
module MoreServer
- autoload :Unicorn, "big_band/more_server/unicorn"
- autoload :Rainbows, "big_band/more_server/rainbows"
+ autoload :Unicorn, "sinatra/more_server/unicorn"
+ autoload :Rainbows, "sinatra/more_server/rainbows"
+ autoload :Zbatery, "sinatra/more_server/zbatery"
def self.registered(klass)
::Rack::Handler.register "unicorn", "::Sinatra::MoreServer::Unicorn"
::Rack::Handler.register "rainbows", "::Sinatra::MoreServer::Rainbows"
+ ::Rack::Handler.register "zbatery", "::Sinatra::MoreServer::Zbatery"
::Rack::Handler.register "ebb", "::Rack::Handler::Ebb"
::Rack::Handler.autoload :Ebb, "ebb"
- klass.server += ["ebb", "rainbows", "unicorn"]
+ klass.server += ["ebb", "zbatery", "rainbows", "unicorn"]
end
end
View
2 lib/sinatra/more_server/rainbows.rb
@@ -10,4 +10,4 @@ def self.run(app, options = {})
end
end
end
-end
+end
View
2 lib/sinatra/more_server/unicorn.rb
@@ -24,4 +24,4 @@ def self.run(app, options={})
end
end
end
-end
+end
View
13 lib/sinatra/more_server/zbatery.rb
@@ -0,0 +1,13 @@
+require "sinatra/more_server/unicorn"
+require "zbatery"
+
+class Sinatra
+ module MoreServer
+ # Rack Handler to use Rainbows for Sinatra::Base.run!
+ module Rainbows
+ def self.run(app, options = {})
+ Sinatra::MoreServer::Unicorn.run app, options.merge(:Backend => ::Zbatery)
+ end
+ end
+ end
+end

0 comments on commit 4de82c2

Please sign in to comment.
Something went wrong with that request. Please try again.