Skip to content

Commit 7b23f90

Browse files
committed
Parametrize fetch_pear function
1 parent dc6791e commit 7b23f90

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bin/compile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
function fetch_pear() {
44
set +o errexit
55
local tries max_tries
6+
version=$1
67

78
tries=1
89
max_tries=10
@@ -14,15 +15,16 @@ function fetch_pear() {
1415

1516
while [[ $tries -le $max_tries ]]; do
1617
echo "Try $tries of $max_tries"
17-
latest_tag=$(curl -sSfL --retry 20 "${auth_flag}" https://api.github.com/repos/pear/pearweb_phars/releases/latest | jq -r .tag_name)
18-
if [ -n $latest_tag ]; then
19-
curl -sSfL "${auth_flag}" --retry 20 -O https://raw.githubusercontent.com/pear/pearweb_phars/${latest_tag}/go-pear.phar
18+
if [ -z $version ]; then
19+
version=$(curl -sSfL --retry 20 "${auth_flag}" https://api.github.com/repos/pear/pearweb_phars/releases/latest | jq -r .tag_name)
2020
fi
2121

22+
curl -sSfL "${auth_flag}" --retry 20 -O https://raw.githubusercontent.com/pear/pearweb_phars/${version}/go-pear.phar
23+
2224
if [ -f go-pear.phar ]; then
2325
break
2426
fi
25-
27+
2628
let tries=$tries+1
2729
echo "Failed to fetch the latest go-pear.phar. Sleeping for ${sleep_interval} seconds."
2830
sleep $sleep_interval
@@ -64,7 +66,7 @@ sudo wget -O /usr/local/ssl/cert.pem https://curl.haxx.se/ca/cacert.pem
6466
# this could be a temp issue though
6567
if [[ ! $VERSION =~ ^master$ || $VERSION =~ snapshot$ ]]; then
6668
# pear
67-
fetch_pear
69+
fetch_pear 'v1.10.12'
6870

6971
env TZ=UTC $TRAVIS_BUILD_DIR/bin/install-pear
7072
rm go-pear.phar

0 commit comments

Comments
 (0)