Created
September 15, 2015 10:05
-
-
Save rskelley9/526a0a0a0ca6912235d8 to your computer and use it in GitHub Desktop.
Rake Task to Start Sinatra Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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