mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Add gulp buildpack.
This commit is contained in:
parent
378cf0af46
commit
05549ce32a
4 changed files with 64 additions and 1 deletions
|
@ -9,7 +9,7 @@ bp_dir=$(cd $(dirname $0); cd ..; pwd)
|
|||
# Load some convenience functions like status()
|
||||
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
|
||||
status "Detected ${name}"
|
||||
$bp_dir/buildpacks/$pack/bin/compile "$@"
|
||||
|
|
26
buildpack/buildpacks/gulp/bin/common.sh
Normal file
26
buildpack/buildpacks/gulp/bin/common.sh
Normal 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
|
||||
}
|
29
buildpack/buildpacks/gulp/bin/compile
Executable file
29
buildpack/buildpacks/gulp/bin/compile
Executable 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
|
8
buildpack/buildpacks/gulp/bin/detect
Executable file
8
buildpack/buildpacks/gulp/bin/detect
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue