Skip to content

Instantly share code, notes, and snippets.

@rskelley9
Created September 15, 2015 10:05
Show Gist options
  • Save rskelley9/526a0a0a0ca6912235d8 to your computer and use it in GitHub Desktop.
Save rskelley9/526a0a0a0ca6912235d8 to your computer and use it in GitHub Desktop.
Rake Task to Start Sinatra Server
About
-----
This is a rake task for starting a thin server using [shotgun](https://github.com/rtomayko/shotgun).
Notes
-----
* Place `server.rake` in `tasks` directory of your Sinatra project
* Update `config` variable on line 7 if necessary
# Set default port to 6000 if user doesn't specify
ENV['port'] ||= "6000"
namespace :server do
task :start do
config = File.expand_path('../config.ru', File.dirname(__FILE__))
# exec("thin -e development -R #{config} --debug start")
exec("shotgun --server=thin --port=#{ENV['port']} #{config}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment