forked from leesei/heroku-buildpack-casperjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile
executable file
·40 lines (32 loc) · 1.14 KB
/
compile
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
#!/bin/sh
set -e
# dirs
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
BUILD_DIR=$1
CACHE_DIR=$2
# config
VERSION="1.9.8"
CASPER_VERSION="master"
# Buildpack URL
ARCHIVE_NAME=phantomjs-${VERSION}-linux-x86_64
FILE_NAME=${ARCHIVE_NAME}.tar.bz2
#BUILDPACK_PHANTOMJS_PACKAGE=https://phantomjs.googlecode.com/files/${FILE_NAME}
BUILDPACK_PHANTOMJS_PACKAGE=https://bitbucket.org/ariya/phantomjs/downloads/${FILE_NAME}
mkdir -p $CACHE_DIR
if ! [ -e $CACHE_DIR/$FILE_NAME ]; then
echo "-----> Fetching PhantomJS ${VERSION} binaries at ${BUILDPACK_PHANTOMJS_PACKAGE}"
curl $BUILDPACK_PHANTOMJS_PACKAGE -L -s -o $CACHE_DIR/$FILE_NAME
fi
echo "-----> Extracting PhantomJS ${VERSION} binaries to ${BUILD_DIR}/vendor/phantomjs"
mkdir -p $CACHE_DIR/$ARCHIVE_NAME
mkdir -p $BUILD_DIR/vendor
tar -xjf $CACHE_DIR/$FILE_NAME -C $CACHE_DIR
mv $CACHE_DIR/$ARCHIVE_NAME $BUILD_DIR/vendor/phantomjs
echo "-----> Cloning CasperJS"
cd ${BUILD_DIR}/vendor
git clone git://github.com/n1k0/casperjs.git
cd casperjs
git checkout ${CASPER_VERSION}
echo "-----> Installing .profile.d/casperjs.sh"
mkdir -p ${BUILD_DIR}/.profile.d
cp ${BIN_DIR}/casperjs.sh ${BUILD_DIR}/.profile.d/