pulsar/script/update-cefode
probablycorey 915d2e42b7 Store cefode versions in /tmp/atom-cached-cefodes
This will make rake cleaning go faster
2013-04-24 15:19:11 -07:00

44 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
. $(dirname $0)/lib/polite-curl
cd "$(dirname "${BASH_SOURCE[0]}" )/.."
if [[ $1 == '-s' ]]; then
SYMBOLS="true"
shift
fi
TARGET=${1:-cef}
DISTURL="https://gh-contractor-zcbenz.s3.amazonaws.com/cefode3/prebuilt-cef"
CURRENT_VERSION=$(cat cef/version 2>&1)
LATEST_VERSION=$(curl -fsSkL $DISTURL/version)
if [ -z "$LATEST_VERSION" ] ; then
echo "Could determine lastest version of cefode" >&2
exit 1
fi
TEMP_DIR=/tmp/atom-cached-cefodes/$LATEST_VERSION
if [[ $LATEST_VERSION != $CURRENT_VERSION ]]; then
if [ -d $TEMP_DIR ]; then
echo "Using cached version of cefode3 v${LATEST_VERSION} from ${TEMP_DIR}"
else
echo "Downloading/extracting cefode3 v${LATEST_VERSION}..."
mkdir -p $TEMP_DIR
polite_curl "${DISTURL}/cef_binary_latest.zip" > "${TEMP_DIR}/cef.zip"
unzip -q "${TEMP_DIR}/cef.zip" -d "${TEMP_DIR}"
fi
[ -e "${TARGET}" ] && rm -rf "${TARGET}"
cp -r "${TEMP_DIR}"/*_macosx "${TARGET}"
echo ${LATEST_VERSION} > 'cef/version'
fi
if [ -n "$SYMBOLS" ]; then
echo "Downloading/extracting symbols for cefode3 u${LATEST_VERSION}..."
polite_curl "${DISTURL}/cef_binary_latest_symbols.zip" > "${TEMP_DIR}/symbols.zip"
unzip -q "${TEMP_DIR}/symbols.zip" -d "${TEMP_DIR}"
mv "${TEMP_DIR}"/*_macosx_symbols/* "${TARGET}/Release"
fi