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?
Here's an example:
require 'sinatra'
require 'launchy'
class MyServer < Sinatra::Base
get '/' do
"My server"
end
# This is the bit I'm not sure how to do
after_server_running do
# Launches a browser with this webapp in it upon server start
Launchy.open("http://#{settings.host}:#{settings.port}/")
end
end
Any ideas?