From 716aa8b4a18ed2eafbfc557dc203a04b17631b2c Mon Sep 17 00:00:00 2001 From: Noah Zoschke <noah@heroku.com> Date: Wed, 18 May 2011 06:57:49 -0700 Subject: [PATCH] detect script improvements; Django => Python/Django; stderr on no detect --- bin/detect | 14 ++++++++++---- test/canary_python/requirements.txt | 0 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 test/canary_python/requirements.txt diff --git a/bin/detect b/bin/detect index e3a553c7..17597c05 100755 --- a/bin/detect +++ b/bin/detect @@ -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 \ No newline at end of file +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 diff --git a/test/canary_python/requirements.txt b/test/canary_python/requirements.txt new file mode 100644 index 00000000..e69de29b -- GitLab