-
Notifications
You must be signed in to change notification settings - Fork 323
Expand file tree
/
Copy pathcompile
More file actions
executable file
·46 lines (38 loc) · 1.26 KB
/
Copy pathcompile
File metadata and controls
executable file
·46 lines (38 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir> <env-dir>
# Ensure wildcards in globs match dotfiles too.
shopt -s dotglob
BUILD_DIR=${1:-}
CACHE_DIR=${2:-}
ENV_DIR=${3:-}
if [ -f $ENV_DIR/PROJECT_PATH ]; then
PROJECT_PATH=`cat $ENV_DIR/PROJECT_PATH`
if [ -d $BUILD_DIR/$PROJECT_PATH ]; then
echo "-----> Subdir buildpack in $PROJECT_PATH"
if [ -n "$(ls -A $BUILD_DIR/.profile.d 2>/dev/null)" ]; then
echo " Another buildpack seems to have run"
echo " before the subdir buildpack. This"
echo " may cause unexpected problems."
echo ""
echo " Ensure '$ heroku buildpacks' lists"
echo " the subdir buildpack first and try"
echo " again."
exit 1
fi
echo " creating cache: $CACHE_DIR"
mkdir -p $CACHE_DIR
TMP_DIR=`mktemp -d $CACHE_DIR/subdirXXXXX`
echo " created tmp dir: $TMP_DIR"
echo " moving working dir: $PROJECT_PATH to $TMP_DIR"
cp -R $BUILD_DIR/$PROJECT_PATH/. $TMP_DIR/
echo " cleaning build dir $BUILD_DIR"
rm -rf $BUILD_DIR/*
echo " copying preserved work dir from cache $TMP_DIR to build dir $BUILD_DIR"
cp -R $TMP_DIR/. $BUILD_DIR/
echo " cleaning tmp dir $TMP_DIR"
rm -rf $TMP_DIR
exit 0
fi
fi
echo "PROJECT_PATH is undefined"
exit 1