Commit 015b7421 authored by Simon Courtois's avatar Simon Courtois
Browse files

Allowing path with spaces in pow plugin

This commit allows for paths with spaces to be symlinked
in Pow.

If an application is located in a folder like `/some path/to the/app`
the powit command would fail when it shouldn't. It's not the case
anymore.
parent ffc17b6b
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
rack_root(){ rack_root(){
setopt chaselinks setopt chaselinks
local orgdir=$(pwd) local orgdir="$(pwd)"
local basedir=$(pwd) local basedir="$(pwd)"
while [[ $basedir != '/' ]]; do while [[ $basedir != '/' ]]; do
test -e "$basedir/config.ru" && break test -e "$basedir/config.ru" && break
...@@ -30,7 +30,7 @@ rack_root(){ ...@@ -30,7 +30,7 @@ rack_root(){
basedir="$(pwd)" basedir="$(pwd)"
done done
builtin cd $orgdir 2>/dev/null builtin cd "$orgdir" 2>/dev/null
[[ ${basedir} == "/" ]] && return 1 [[ ${basedir} == "/" ]] && return 1
echo $basedir echo $basedir
} }
...@@ -56,19 +56,19 @@ kapow(){ ...@@ -56,19 +56,19 @@ kapow(){
compctl -W ~/.pow -/ kapow compctl -W ~/.pow -/ kapow
powit(){ powit(){
local basedir=$(pwd) local basedir="$(pwd)"
local vhost=$1 local vhost=$1
[ ! -n "$vhost" ] && vhost=$(rack_root_detect) [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
if [ ! -h ~/.pow/$vhost ] if [ ! -h ~/.pow/$vhost ]
then then
echo "pow: Symlinking your app with pow. ${vhost}" echo "pow: Symlinking your app with pow. ${vhost}"
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost [ ! -d ~/.pow/${vhost} ] && ln -s "$basedir" ~/.pow/$vhost
return 1 return 1
fi fi
} }
powed(){ powed(){
local basedir=$(rack_root) local basedir="$(rack_root)"
find ~/.pow/ -type l -lname "*$basedir*" -exec basename {}'.dev' \; find ~/.pow/ -type l -lname "*$basedir*" -exec basename {}'.dev' \;
} }
...@@ -82,4 +82,4 @@ repow(){ ...@@ -82,4 +82,4 @@ repow(){
} }
# View the standard out (puts) from any pow app # View the standard out (puts) from any pow app
alias kaput="tail -f ~/Library/Logs/Pow/apps/*" alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment