Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@ export_env_dir() {
done
fi
}

load_user_config() {
if [ -e $1/.client ]; then
status "Load config from .client"
source $1/.client
fi
CLIENT_DIR=${CLIENT_DIR:-"client"}
DIST_DIR=${DIST_DIR:-"dist"}
}
17 changes: 7 additions & 10 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -e # fail fast
set -o pipefail # don't ignore exit codes when piping output
set -o pipefail # don\'t ignore exit codes when piping output
# set -x # enable debugging

# Enable extended globbing
Expand All @@ -15,22 +15,19 @@ bp_dir=$(cd $(dirname $0); cd ..; pwd)
# Option [nocl] to disable cleanup for testing
cleanup=$4

# Load some convenience functions like status(), echo(), and indent()
# Load some convenience functions like load_user_config(), status(), echo(), and indent()
source $bp_dir/bin/common.sh

# Load user config
if [ -e $1/.client ]; then
status "Load config from .client"
source $1/.client
fi
load_user_config $1

# Client build directory
build_dir=$1/${CLIENT_DIR:-"client"}
build_dir=$1/$CLIENT_DIR

# Grunt / Gulp task name
dist_dir=${DIST_DIR:-dist}
dist_dir=$DIST_DIR

status "Client dir: ${CLIENT_DIR:-client}"
status "Client dir: $CLIENT_DIR"
status "Dist dir: $dist_dir"

# Fix leak
Expand Down Expand Up @@ -243,5 +240,5 @@ echo "export PATH=\"\$HOME/.gem/$RUBY_VERSION/bin:\$PATH\"" > $build_dir/.profil
# Cleanup
if [ "$cleanup" != "nocl" ]; then
status "Cleanup"
rm -rf !(${dist_dir})
rm -rf !${dist_dir}
fi
10 changes: 9 additions & 1 deletion bin/detect
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/usr/bin/env bash
# bin/detect <build-dir>

if [ -f $1/client/grunt.js ] || [ -f $1/client/Gruntfile.js ] || [ -f $1/client/Gruntfile.coffee ]; then
bp_dir=$(cd $(dirname $0); cd ..; pwd)
source $bp_dir/bin/common.sh

# Load user config
load_user_config $1

if [ -f $1/$CLIENT_DIR/grunt.js ] || [ -f $1/$CLIENT_DIR/Gruntfile.js ] || [ -f $1/$CLIENT_DIR/Gruntfile.coffee ]; then
echo "Found web application in client directory" && exit 0
else
exit 1
fi