1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Add gulp buildpack.

This commit is contained in:
Simo Kinnunen 2014-07-30 17:48:51 +09:00
parent 378cf0af46
commit 05549ce32a
4 changed files with 64 additions and 1 deletions

View file

@ -9,7 +9,7 @@ bp_dir=$(cd $(dirname $0); cd ..; pwd)
# Load some convenience functions like status() # Load some convenience functions like status()
source $bp_dir/bin/common.sh source $bp_dir/bin/common.sh
for pack in node bower; do for pack in node bower gulp; do
if name=$($bp_dir/buildpacks/$pack/bin/detect "$@"); then if name=$($bp_dir/buildpacks/$pack/bin/detect "$@"); then
status "Detected ${name}" status "Detected ${name}"
$bp_dir/buildpacks/$pack/bin/compile "$@" $bp_dir/buildpacks/$pack/bin/compile "$@"

View file

@ -0,0 +1,26 @@
error() {
echo " ! $*" >&2
exit 1
}
status() {
echo "-----> $*"
}
protip() {
echo
echo "PRO TIP: $*" | indent
echo "See https://devcenter.heroku.com/articles/nodejs-support" | indent
echo
}
# sed -l basically makes sed replace and buffer through stdin to stdout
# so you get updates while the command runs and dont wait for the end
# e.g. npm install | indent
indent() {
c='s/^/ /'
case $(uname) in
Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
*) sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
esac
}

View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e # fail fast
set -o pipefail # don't ignore exit codes when piping output
# set -x # enable debugging
# Configure directories
build_dir=$1
cache_dir=$2
env_dir=$3
bp_dir=$(cd $(dirname $0); cd ..; pwd)
# Load some convenience functions like status() and indent()
source $bp_dir/bin/common.sh
# Expose user-installed bower
export PATH=$build_dir/node_modules/.bin:$PATH
# Get gulp version
gulp_bin=$(which gulp)
status "Using Gulp from ${gulp_bin#$build_dir/}"
gulp -v 2>&1 | indent
# Run subsequent node/gulp commands from the build path
cd $build_dir
status "Building"
gulp build 2>&1 | indent

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# bin/detect <build-dir>
if [ -f $1/gulpfile.js ]; then
echo "Gulp" && exit 0
else
echo "no" && exit 1
fi