#!/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
  LIBRARY_PATH: .heroku/vendor/lib
  LD_LIBRARY_PATH: .heroku/vendor/lib
EOF


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

SETTINGS_FILE=$(cd $BUILD_DIR && ls **/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
