Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@lgierth /Rakefile
Last active Dec 10, 2015

Webmachine and Shotgun
task :shotgun do
require "rack"
require "shotgun"
class Shotgun::Loader
# assemble_app gets called inside the request worker
# after forking, so your_app will be loaded freshly
# for each request.
def assemble_app
require "webmachine/adapters/rack"
require "your_app"
Webmachine::Adapters::Rack.new(YourApp.new.application)
end
end
app = Rack::Builder.new do
use Shotgun::SkipFavicon
run Shotgun::Loader.allocate
end
%w{INT TERM QUIT}.each {|signal| trap(signal) { exit! } }
options = {:Host => "127.0.0.1", :Port => 3000}
Rack::Handler.get(:webrick).run(app, options)
end
@Asmod4n
Asmod4n commented Oct 9, 2014

https://gist.github.com/lgierth/4389220#file-rakefile-L12 should be:

Webmachine::Adapters::Rack.new(YourApp.new.application)
@lgierth
Owner
lgierth commented Oct 14, 2014

Thanks, updated it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.