Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bash shortcut to create Pow! symlink for current directory
# 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"
}
@paulspringett

This comment has been minimized.

Copy link
Owner Author

@paulspringett paulspringett commented Jul 6, 2011

Usage

pow [appname] [-ru]

Most simple use case

# in ~/Sites/myrails3app
pow

this will create http://myrails3app.dev

You can also customise the domain

# in ~/Sites/myrails3app
pow someothername

this will create http://someothername.dev

For Rails 2 apps pass the -ru option to "rackup" the app (by creating a config.ru file)

pow -ru
@chrismytton

This comment has been minimized.

Copy link

@chrismytton chrismytton commented Jul 6, 2011

I love a bit of bash! Have you seen powder?

@paulspringett

This comment has been minimized.

Copy link
Owner Author

@paulspringett paulspringett commented Jul 6, 2011

Haha I think that's what I was looking for!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment