From ecf5278679f95a87b438584e22e83c719cbd467e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz <me@kennethreitz.com> Date: Mon, 3 Dec 2012 16:00:23 +0100 Subject: [PATCH] extract utils --- bin/compile | 36 +----------------------------------- bin/detect | 2 +- bin/utils | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 36 deletions(-) create mode 100755 bin/utils diff --git a/bin/compile b/bin/compile index 2401ed3e..deb05b56 100755 --- a/bin/compile +++ b/bin/compile @@ -66,41 +66,7 @@ unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH # We'll need to send these statics to other scripts we `source`. export PIP_DOWNLOAD_CACHE BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH -# Syntax sugar. -indent() { - RE="s/^/ /" - [ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE" -} - -# Clean up pip output -cleanup() { - sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id' -} - -# Virtualenv wrapper. -function virtualenv (){ - python "$ROOT_DIR/vendor/virtualenv-1.8.4/virtualenv.py" "$@" -} - -# Buildpack Steps. -function puts-step (){ - echo "-----> $@" -} - -# Buildpack Warnings. -function puts-warn (){ - echo " ! $@" -} - -# Usage: $ set-env key value -function set-env (){ - echo "export $1=$2" >> $PROFILE_PATH -} - -# Usage: $ set-default-env key value -function set-default-env (){ - echo "export $1=\${$1:-$2}" >> $PROFILE_PATH -} +source $BIN_DIR/utils # ## Build Time # diff --git a/bin/detect b/bin/detect index b4c999e3..588e15ed 100755 --- a/bin/detect +++ b/bin/detect @@ -61,4 +61,4 @@ IFS_BAK= SETTINGS_FILE=$(find $BUILD_DIR/. -maxdepth 2 -type f -name 'settings.py' | head -1) -[ -n "$SETTINGS_FILE" ] && ( list_requirements $BUILD_DIR/requirements.txt | grep -Fiq "django" ) && echo Python/Django || echo Python \ No newline at end of file +[ -n "$SETTINGS_FILE" ] && ( list_requirements $BUILD_DIR/requirements.txt | grep -Fiq "django" ) && echo Python/Django || echo Python diff --git a/bin/utils b/bin/utils new file mode 100755 index 00000000..c1737095 --- /dev/null +++ b/bin/utils @@ -0,0 +1,35 @@ +# Syntax sugar. +indent() { + RE="s/^/ /" + [ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE" +} + +# Clean up pip output +cleanup() { + sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id' +} + +# Virtualenv wrapper. +function virtualenv (){ + python "$ROOT_DIR/vendor/virtualenv-1.8.4/virtualenv.py" "$@" +} + +# Buildpack Steps. +function puts-step (){ + echo "-----> $@" +} + +# Buildpack Warnings. +function puts-warn (){ + echo " ! $@" +} + +# Usage: $ set-env key value +function set-env (){ + echo "export $1=$2" >> $PROFILE_PATH +} + +# Usage: $ set-default-env key value +function set-default-env (){ + echo "export $1=\${$1:-$2}" >> $PROFILE_PATH +} -- GitLab