diff --git a/bin/steps/collectstatic b/bin/steps/collectstatic index bd357326cb65b057a1713ad9cfaad224978d0d4b..ad6fdca290f6a9937369bc51e3775b5b29e1c1b3 100755 --- a/bin/steps/collectstatic +++ b/bin/steps/collectstatic @@ -1,10 +1,6 @@ #!/usr/bin/env bash -# Syntax sugar. -indent() { - RE="s/^/ /" - [ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE" -} +source $BIN_DIR/utils MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1) MANAGE_FILE=${MANAGE_FILE:-fakepath} diff --git a/bin/utils b/bin/utils index a8af9fbfc2baffcb5e2e11a1f277b9e59c2f2c12..9f6ecb0399d5244d4d4acbfefe3eb739d30dac2d 100755 --- a/bin/utils +++ b/bin/utils @@ -1,16 +1,19 @@ shopt -s extglob -[ $(uname) == "Darwin" ] && SED_FLAG='-l' || SED_FLAG='-u' +if [ $(uname) == Darwin ]; then + sed() { command sed -l "$@"; } +else + sed() { command sed -u "$@"; } +fi # Syntax sugar. indent() { - RE="s/^/ /" - sed $SED_FLAG "$RE" + sed "s/^/ /" } # Clean up pip output cleanup() { - sed $SED_FLAG -e 's/\.\.\.\+/.../g' | sed $SED_FLAG '/already satisfied/Id' | sed $SED_FLAG -e '/Overwriting/Id' | sed $SED_FLAG -e '/python executable/Id' | sed $SED_FLAG -e '/no previously-included files/Id' + 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' } # Buildpack Steps. @@ -77,4 +80,4 @@ sub-env() { $1 ) -} \ No newline at end of file +}