Skip to content

Instantly share code, notes, and snippets.

@paulspringett
Created July 6, 2011 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulspringett/1067604 to your computer and use it in GitHub Desktop.
Save paulspringett/1067604 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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
Copy link

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

@paulspringett
Copy link
Author

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