first stab at a common functions library. include argument parsing and a few definitions wired up. closes #932. closes #945

This commit is contained in:
Michael Hobbs
2015-02-05 11:32:46 -08:00
parent 72a58bbda3
commit 6ad65dd9b4
13 changed files with 140 additions and 62 deletions

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
@@ -17,7 +18,7 @@ if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
fi
if [[ ! -z "$BUILD_ENV" ]]; then
echo "-----> Adding BUILD_ENV to build environment..."
info1 "Adding BUILD_ENV to build environment..."
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
id=$(echo $BUILD_ENV |sed 's@export @@g'| docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")