Created
July 6, 2011 16:00
-
-
Save paulspringett/1067604 to your computer and use it in GitHub Desktop.
Bash shortcut to create Pow! symlink for current directory
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
# add this to your .bash_profile | |
function pow() { | |
name=`basename $PWD` | |
if [[ $1 && $1 != "-ru" ]]; then | |
name=$1 | |
fi | |
echo "Using name: $name" | |
rm ~/.pow/$name | |
ln -s $PWD ~/.pow/$name | |
# pass -ru to rackup rails 2.3.x apps | |
if [[ $2 == "-ru" ]]; then | |
rm config.ru | |
touch config.ru | |
echo "require File.dirname(__FILE__) + '/config/environment'" >> config.ru | |
echo "run ActionController::Dispatcher.new" >> config.ru | |
echo "Created config.ru file" | |
fi | |
echo "Created pow rails app at: http://$name.dev" | |
# open this in your default browser, perhaps a little OTT! | |
open "http://$name.dev" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Most simple use case
this will create http://myrails3app.dev
You can also customise the domain
this will create http://someothername.dev
For Rails 2 apps pass the
-ru
option to "rackup" the app (by creating a config.ru file)