I have a Sinatra Application enclosed in Sinatra::Base and I\'d like to run some code once the server has started, how should I go about doing this?
Her
If you're using Rack (which you probably are) I just found out there's a function you can call in config.ru (it's technically an instance method of Rack::Builder) that lets you run a block of code after the server has been started. It's called warmup, and here's the documented usage example:
warmup do |app|
client = Rack::MockRequest.new(app)
client.get('/')
end
use SomeMiddleware
run MyApp