Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Commit

Permalink
merge stomita's update (phantomjs updated to 1.9.2)
Browse files Browse the repository at this point in the history
 Changes to be committed:
	modified:   README.md
	modified:   bin/casperjs.sh
	modified:   bin/compile
	modified:   bin/release
  • Loading branch information
leesei committed Oct 3, 2013
1 parent e2a0059 commit 687a395
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
11 changes: 10 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ Alternately, you can cascade with other buildpacks:
$ echo https://github.com/leesei/heroku-buildpack-casperjs.git > .buildpacks

# echo [other buildpack] >> .buildpacks

# `git add` your files

$ git push heroku master

You can also login to the herokuapp and execute `phantomjs` and `casperjs`:

$ heroku run bash
Running `bash` attached to terminal... up, run.2587
Add phantomjs/casperjs paths ...
~ $ casperjs





Empty file modified bin/casperjs.sh
100644 → 100755
Empty file.
39 changes: 20 additions & 19 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,36 @@

set -e

# paths.
# dirs
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
ROOT_DIR=$(dirname ${BIN_DIR})
BUILD_DIR=$1
CACHE_DIR=$2

# config
VERSION="1.8.1"
S3_BUCKET="stomita-buildpack-phantomjs"
VERSION="1.9.2"

# s3 packages
FILE_NAME="buildpack-phantomjs-${VERSION}.tar.gz"
BUILDPACK_PHANTOMJS_PACKAGE="http://${S3_BUCKET}.s3.amazonaws.com/${FILE_NAME}"
# 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}

mkdir -p ${CACHE_DIR}
if ! [ -e ${CACHE_DIR}/${FILE_NAME} ]; then
echo "-----> Fetching PhantomJS buildpack binaries"
curl $BUILDPACK_PHANTOMJS_PACKAGE -s -o $CACHE_DIR/${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 -s -o $CACHE_DIR/$FILE_NAME
fi

echo "-----> Extracting PhantomJS binaries"
mkdir -p ${BUILD_DIR}/vendor/phantomjs
tar zxf ${CACHE_DIR}/${FILE_NAME} -C ${BUILD_DIR}/vendor/phantomjs
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 "-----> Cloning casperjs"
echo "-----> Cloning CasperJS"
cd ${BUILD_DIR}/vendor
git clone git://github.com/n1k0/casperjs.git

echo "-----> Creating .profile.d/casperjs.sh"
cd ${BUILD_DIR}
mkdir -p .profile.d
cp ${BIN_DIR}/casperjs.sh .profile.d/
#echo "-----> Creating .profile.d/casperjs.sh"
#cd ${BUILD_DIR}
#mkdir -p .profile.d
#cp ${BIN_DIR}/casperjs.sh .profile.d/
3 changes: 3 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

cat << EOF
---
config_vars:
PATH: "/usr/local/bin:/usr/bin:/bin:/app/vendor/phantomjs/bin:/app/vendor/casperjs/bin"
LD_LIBRARY_PATH: "/usr/local/lib:/usr/lib:/lib:/app/vendor/phantomjs/lib"
default_process_types:
console: "vendor/phantomjs/bin/phantomjs"
EOF

5 comments on commit 687a395

@cbartlett
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this commit broke casperjs for us on Heroku:

/usr/bin/env: casperjs: No such file or directory

Rolling back this commit did the trick. Maybe a path issue? I wonder if any one else had similar issues.

@leesei
Copy link
Owner Author

@leesei leesei commented on 687a395 Oct 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks for the info.
Haven't deployed this commit on Heroku.

@aarti
Copy link

@aarti aarti commented on 687a395 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to run
heroku config:set PATH="${PATH}:/app/vendor/phantomjs/bin:/app/vendor/casperjs/bin"
heroku config:set LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/app/vendor/phantomjs/lib"

and then it worked.

@leesei
Copy link
Owner Author

@leesei leesei commented on 687a395 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the report, I wonder why the modification in bin/release is not working.

@leesei
Copy link
Owner Author

@leesei leesei commented on 687a395 Oct 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented out the part for using profile.d/casperjs.sh in the update to 1.9.2.
I've updated again to add it back again.
Thanks for the report.

Please sign in to comment.