Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phantomjs #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ source $bp_dir/bin/common.sh
# Install node first, as a dependency, then install meteor & build app
$bp_dir/bin/compile_node "$1" "$2"
$bp_dir/bin/compile_meteor "$1" "$2"

# Install phantomjs
$bp_dir/bin/install_phantomjs "$1" "$2"
1 change: 1 addition & 0 deletions bin/compile_meteor
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fetch_meteor() {
head "Unpacking Meteor $METEOR_VERSION"
tar -xzf "$PACKAGE" -C "$BUILD_DIR"
mv "$BUILD_DIR/.meteor" "$METEOR_HOME"
ln -s "${METEOR_HOME}" "${HOME}/.meteor"
# bomb out if it didn't work, eg no net
[ ! -x "${METEOR_HOME}/meteor" ] && error "Install failed: No meteor bin found."
info "Meteor $METEOR_VERSION is installed"
Expand Down
34 changes: 34 additions & 0 deletions bin/install_phantomjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

# based on https://github.com/stomita/heroku-buildpack-phantomjs/blob/master/bin/compile

set -e

BUILD_DIR=$1
CACHE_DIR=$2

# config
VERSION="1.9.8"

# Buildpack URL
ARCHIVE_NAME=phantomjs-${VERSION}-linux-x86_64
FILE_NAME=${ARCHIVE_NAME}.tar.bz2
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 jxf $CACHE_DIR/$FILE_NAME -C $CACHE_DIR
mv $CACHE_DIR/$ARCHIVE_NAME $BUILD_DIR/vendor/phantomjs

echo "-----> exporting PATH and LIBRARY_PATH"
PROFILE_PATH="$BUILD_DIR/.profile.d/phantomjs.sh"
mkdir -p $(dirname $PROFILE_PATH)
echo 'export PATH="$PATH:$HOME/vendor/phantomjs/bin"' >> $PROFILE_PATH
echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:vendor/phantomjs/lib"' >> $PROFILE_PATH