Skip to content

Commit

Permalink
fix(travis): add install script
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jan 30, 2019
1 parent 2d79b66 commit 15480fb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

OK="OK"
ERROR="ERROR"
yarnRegistry="registry.yarnpkg.com"
npmRegistry="registry.npmjs.org"

npmPingStatus=`ping -c 1 $npmRegistry > /dev/null && echo $OK || echo $ERROR`
yarnPingStatus=`ping -c 1 $yarnRegistry > /dev/null && echo $OK || echo $ERROR`

yarnHttpStatus=`curl "https://"$yarnRegistry -k -s -f -o /dev/null && echo $OK || echo $ERROR`
npmHttpStatus=`curl "https://"$npmRegistry -k -s -f -o /dev/null && echo $OK || echo $ERROR`

echo "yarn ping status: $yarnPingStatus"
echo "yarn http status: $yarnHttpStatus"

echo "npm ping status: $npmPingStatus"
echo "npm http status: $npmHttpStatus"

if [ $yarnHttpStatus = $OK ] ; then
yarn install --cwd ../

else if [ $npmHttpStatus = $OK ] ; then
npm install

else
echo "Network failure"

fi
fi

0 comments on commit 15480fb

Please sign in to comment.