Skip to content

Commit c969c5f

Browse files
authored
Merge pull request #296 from codeship/phantomjs
The Codeship PhantomJS mirror is no longer available
2 parents 834d6e6 + 8fefb5b commit c969c5f

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

packages/phantomjs.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
#!/bin/bash
2-
# Install a custom version of PhantomJS, http://phantomjs.org/
2+
# Install a custom PhantomJS version - https://phantomjs.org/
33
#
4-
# If you run into any rate limiting issues from bitbucket, put the download
5-
# file(s) into your own server and point to the location via the PHANTOMJS_HOST
6-
# environment variable.
4+
# To run this script in Codeship, add the following
5+
# command to your project's test setup command:
6+
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/phantomjs.sh | bash -s
77
#
88
# Add at least the following environment variables to your project configuration
99
# (otherwise the defaults below will be used).
1010
# * PHANTOMJS_VERSION - Specify the version of PhantomJS
1111
# * PHANTOMJS_HOST - Optional, specify the download location for the archive
1212
#
13-
# For versions 1.9.7, 1.9.8 and 2.1.1 you can also use a Codeship provided mirror
14-
# by setting the PHANTOMJS_HOST variable to https://s3.amazonaws.com/codeship-packages
15-
#
16-
# export PHANTOMJS_HOST="https://s3.amazonaws.com/codeship-packages"
13+
# If you run into any rate limiting issues from Bitbucket, put the download
14+
# file(s) into your own server and point to the location via the PHANTOMJS_HOST
15+
# environment variable.
1716
#
18-
# Include in your builds via
19-
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/phantomjs.sh | bash -s
20-
PHANTOMJS_VERSION=${PHANTOMJS_VERSION:="1.9.8"}
17+
PHANTOMJS_VERSION=${PHANTOMJS_VERSION:="2.1.1"}
2118
PHANTOMJS_HOST=${PHANTOMJS_HOST:="https://bitbucket.org/ariya/phantomjs/downloads"}
2219

20+
if [[ "${PHANTOMJS_HOST}" == "https://s3.amazonaws.com/codeship-packages" ]];
21+
then
22+
echo "The Codeship mirror is no longer available, please use an alternative location"
23+
echo "PhantomJS 2.1.1 is installed by default"
24+
exit 1
25+
fi
26+
2327
set -e
2428
CACHED_DOWNLOAD="${HOME}/cache/phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2"
2529

26-
# clean old version and setup directories
30+
# Remove old version and setup directories
2731
rm -rf ~/.phantomjs
2832
mkdir ~/.phantomjs
2933
wget --continue --output-document "${CACHED_DOWNLOAD}" "${PHANTOMJS_HOST}/phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2"

tests/packages/phantomjs.bats

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bats
2+
3+
setup() {
4+
export PHANTOMJS_VERSION="2.1.1"
5+
}
6+
7+
@test "[phantomjs.sh] Script runs" {
8+
./packages/phantomjs.sh
9+
}
10+
11+
@test "[phantomjs.sh] Download cached" {
12+
[ -f "${HOME}/cache/phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2" ]
13+
}
14+
15+
@test "[phantomjs.sh] Verify installed version" {
16+
run phantomjs -v
17+
[[ "$output" == "${PHANTOMJS_VERSION}" ]]
18+
}

0 commit comments

Comments
 (0)