Skip to content

Commit

Permalink
remove dependency on bootstrap/blueacorn libs
Browse files Browse the repository at this point in the history
closes #19
  • Loading branch information
briceburg committed Nov 24, 2015
1 parent a35ee5d commit 9cb2cc1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
28 changes: 26 additions & 2 deletions bin/.functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,35 @@ error(){
exit 1
}

type greadlink >/dev/null 2>&1 && CWD="$(dirname "$(greadlink -f "$0")")" || \
CWD="$(dirname "$(readlink -f "$0")")"
REPO_ROOT=`git rev-parse --show-toplevel`


# subst_inplace : in place file substitution
############################################
#
# usage: sed_inplace "file" "sed substitution"
# ex: sed_inplace "/tmp/file" "s/CLIENT_CODE/BA/g"
#

sed_inplace(){
# linux
local SED_CMD="sed"

if [[ $OSTYPE == darwin* ]]; then
if $(type gsed >/dev/null 2>&1); then
local SED_CMD="gsed"
elif $(type /usr/local/bin/sed >/dev/null 2>&1); then
local SED_CMD="/usr/local/bin/sed"
else
sed -i '' -E "$2" $1
return
fi
fi

$SED_CMD -r -i "$2" $1
}


env_bootstrap(){

[ ! -z "$BLUEACORN_DIR" ] || error "BLUEACORN_DIR cannot be empty." \
Expand Down
5 changes: 2 additions & 3 deletions bin/env
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ env_make() {
[ -e $ENV_DIR/envars ] || error "repo appears uninitialized"
source $ENV_DIR/envars

source $BLUEACORN_DIR/lib/functions || error \
"could not source BA functions" "run bootstrap or restart your shell"

[ -z "$ENV" ] && read -p "environment name to generate: " ENV

echo "skel environments -->"
Expand Down Expand Up @@ -351,6 +348,8 @@ env_make() {
# runtime
#########

source $CWD/.functions.sh || error "unable to load shared functions"

runstr="display_help"

if [ $# -eq 0 ]; then
Expand Down
4 changes: 3 additions & 1 deletion bin/skel
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ error(){
exit 1
}

. $BLUEACORN_DIR/lib/functions || error "missing BA funcs" "run bootstrap?"

# globals
#########
Expand Down Expand Up @@ -275,6 +274,9 @@ pilot_update(){
# runtime
#########

source $CWD/.functions.sh || error "unable to load shared functions"


runstr="display_help"

if [ $# -eq 0 ]; then
Expand Down

0 comments on commit 9cb2cc1

Please sign in to comment.