#!/usr/bin/env bash
# bin/release <build-dir>

BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
BUILD_DIR=$1
NAME=$($BIN_DIR/detect $BUILD_DIR) || exit 1

cat <<EOF
---
config_vars:
  PATH: bin:/usr/local/bin:/usr/bin:/bin
  PYTHONUNBUFFERED: true
EOF

[ "$NAME" = "Python/Django" ] || exit 0

SETTINGS_FILE=$(ls $BUILD_DIR/**/settings.py | head -1)
PROJECT=$(dirname $SETTINGS_FILE)

cat <<EOF

addons:
  shared-database:5mb

default_process_types:
  web:      python $PROJECT/manage.py runserver 0.0.0.0:\$PORT --noreload
EOF
