urchin root

This commit is contained in:
Thomas Levine 2016-02-27 16:53:27 +00:00
parent e5ba45ae96
commit fdc7129921

11
urchin
View File

@ -26,9 +26,6 @@ urchin_root() {
orig="$1" orig="$1"
fi fi
(
set -e
if ! test -e "$current"; then if ! test -e "$current"; then
echo "$current: No such file or directory">&2 echo "$current: No such file or directory">&2
exit 1 exit 1
@ -45,12 +42,12 @@ urchin_root() {
echo "You need to create the .urchin directory in the root of your tests, echo "You need to create the .urchin directory in the root of your tests,
maybe like this: maybe like this:
mkdir '$origdir/.urchin' mkdir '$(echo "$origdir" | sed s/\\/$//)/.urchin'
" >&2 " >&2
return 1
else else
urchin_root "$current"/.. "$orig" urchin_root "$current"/.. "$orig"
fi fi
)
} }
indent() { indent() {
@ -359,7 +356,9 @@ if [ "$#" != '1' ] || [ ! -d "$1" ]
fi fi
# Run or present the Molly guard. # Run or present the Molly guard.
if dirname "$(readlink -f "$(urchin_root "$1")")" | if ! urchin_root "$1" > /dev/null; then
exit 1
elif basename "$(readlink -f "$(urchin_root "$1")")" |
grep -Fi 'test' > /dev/null || $force; then grep -Fi 'test' > /dev/null || $force; then
logfile="$(readlink -f "$(urchin_root "$1")/.urchin/.log")" logfile="$(readlink -f "$(urchin_root "$1")/.urchin/.log")"
echo > "$logfile" echo > "$logfile"