intelligent thin start with port alias for bash

Posted by seaofclouds on Stack Overflow See other posts from Stack Overflow or by seaofclouds
Published on 2010-04-28T20:34:52Z Indexed on 2010/04/28 20:37 UTC
Read the original article Hit count: 277

Filed under:
|
|

i would like a single alias (ts) which starts my local development server. the script should test for an open port starting at 3000 and use the first available port. additionally, some sites require a rackup file, making -R config.ru necessary. this script should check the current directory for the config.ru file and add that to the alias if present.

currently, to start my local development environment, i run:

alias  ts="thin -R config.ru -p 3000 start"

often, i need to run several servers to test different sites, so i've created additional aliases:

alias  ts1="thin -R config.ru -p 3001 start"

© Stack Overflow or respective owner

Related posts about bash

Related posts about ruby