1 # Restart a rack app running under pow
4 # Adds a kapow command that will restart an app
8 # Supports command completion.
10 # If you are not already using completion you might need to enable it with
12 # autoload -U compinit compinit
16 # Defaults to the current application, and will walk up the tree to find
17 # a config.ru file and restart the corresponding app
19 # Will Detect if a app does not exist in pow and print a (slightly) helpful
27 while [[ $basedir != '/' ]]; do
28 test -e "$basedir/config.ru" && break
29 builtin cd ".." 2>/dev/null
33 builtin cd "$orgdir" 2>/dev/null
34 [[ ${basedir} == "/" ]] && return 1
40 echo `basename $basedir | sed -E "s/.(com|net|org)//"`
45 [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
46 if [ ! -h ~/.pow/$vhost ]
48 echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
52 [ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
53 touch ~/.pow/$vhost/tmp/restart.txt;
54 [ $? -eq 0 ] && echo "pow: restarting $vhost.dev"
56 compctl -W ~/.pow -/ kapow
61 [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
62 if [ ! -h ~/.pow/$vhost ]
64 echo "pow: Symlinking your app with pow. ${vhost}"
65 [ ! -d ~/.pow/${vhost} ] && ln -s "$basedir" ~/.pow/$vhost
71 local basedir="$(rack_root)"
72 find ~/.pow/ -type l -lname "*$basedir*" -exec basename {}'.dev' \;
76 # taken from https://www.matthewratzloff.com
78 lsof | grep 20560 | awk '{print $2}' | xargs kill -9
79 launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
80 launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist
84 # View the standard out (puts) from any pow app
85 alias kaput="tail -f ~/Library/Logs/Pow/apps/*"