mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1215 from wilr/sake
Search parent folders in sake for SilverStripe installation.
This commit is contained in:
commit
6f55948e4e
41
sake
41
sake
@ -9,23 +9,35 @@ Executes a SilverStripe command"
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set $framework and $base
|
# find the silverstripe installation
|
||||||
sakedir=`dirname $0`
|
if [ -f ./cli-script.php ]; then
|
||||||
if [ -f $sakedir/cli-script.php ]; then
|
|
||||||
framework=$sakedir
|
|
||||||
base=`dirname $sakedir`
|
|
||||||
elif [ -d ./framework ]; then
|
|
||||||
framework=./framework
|
|
||||||
base=.
|
|
||||||
elif [ -d ./sapphire ]; then
|
|
||||||
framework=./sapphire
|
|
||||||
base=.
|
|
||||||
elif [ -f ./cli-script.php ]; then
|
|
||||||
framework=.
|
framework=.
|
||||||
base=..
|
base=..
|
||||||
else
|
else
|
||||||
echo "Can't find ./framework/cli-script.php or ./cli-script.php"
|
# look up the tree for the first parent folder that has a framework
|
||||||
exit 1
|
# installation
|
||||||
|
slashes=${PWD//[^\/]/}
|
||||||
|
directory="$PWD"
|
||||||
|
base=.
|
||||||
|
for (( n=${#slashes}; n>0; --n )) do
|
||||||
|
if [ -d "$directory/framework" ]; then
|
||||||
|
framework="$directory/framework"
|
||||||
|
|
||||||
|
break
|
||||||
|
elif [ -d "$directory/sapphire" ]; then
|
||||||
|
framework="$directory/sapphire"
|
||||||
|
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
directory=`dirname $directory`
|
||||||
|
base="$base."
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -f "$framework/cli-script.php" ]; then
|
||||||
|
echo "Can't find cli-script.php in $framework"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find the PHP binary
|
# Find the PHP binary
|
||||||
@ -45,6 +57,7 @@ fi
|
|||||||
|
|
||||||
if [ "$1" = "installsake" ]; then
|
if [ "$1" = "installsake" ]; then
|
||||||
echo "Installing sake to /usr/bin..."
|
echo "Installing sake to /usr/bin..."
|
||||||
|
rm -rf /usr/bin/sake
|
||||||
cp $0 /usr/bin
|
cp $0 /usr/bin
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user