detect script improvements; Django => Python/Django; stderr on no detect

This commit is contained in:
Noah Zoschke
2011-05-18 06:57:49 -07:00
parent 9a69793da6
commit 716aa8b4a1
2 changed files with 10 additions and 4 deletions
+10 -4
View File
@@ -1,8 +1,14 @@
#!/usr/bin/env bash
# bin/name <build-dir>
# bin/detect <build-dir>
BUILD_DIR=$1
[ -f $BUILD_DIR/requirements.txt ] || exit 1 # fail fast if no requirements.txt
# 'Django' if there is a [mysite]/settings.py file present; otherwise 'Python'
ls $BUILD_DIR/**/settings.py &> /dev/null && echo Django || echo Python
function abort() {
echo $1 1>&2
exit 1
}
[ -f $BUILD_DIR/requirements.txt ] || abort "fatal: Not a Python app (no requirements.txt)"
# 'Python/Django' if there is a [mysite]/settings.py file present; otherwise 'Python'
ls $BUILD_DIR/**/settings.py &> /dev/null && echo Python/Django || echo Python
View File