Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added spark updater #2191

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions examples/pxScene2d/src/macstuff/spark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ if [ -e ./version ] && [ -w . ]; then
VERSION=`cat ./version`
if [[ "$VERSION" != "edge"* ]]; then
UPDATE_URL=http://www.sparkui.org/dist/osx/spark/software_update.plist
./EngineRunner run -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL} &
./sparkUpdater.sh -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL}
else
if [[ $updateEdge == "true" ]] || [[ $updateEdge == 1 ]] ; then
UPDATE_URL=http://96.116.56.119/edge/osx/artifacts/software_update.plist
./EngineRunner run -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL} &
./sparkUpdater.sh -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL}
fi
fi
else
Expand Down
89 changes: 89 additions & 0 deletions examples/pxScene2d/src/macstuff/sparkUpdater.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env bash
#./sparkUpdater.sh -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL}
#Get absolute path to this script
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd "$THIS_DIR"

PRODUCT_ID=$2
VERSION=$4
URL=$6
CURRENT_VERSION=0
CURRENT_PRODUCT_ID=0
CURRENT_CODEBASE=""
#echo "GIVEN" $PRODUCT_ID $VERSION $URL

SOFTWARE_UPDATE_PLIST=$URL
DATA=$(curl $SOFTWARE_UPDATE_PLIST)
#echo $DATA

idx=""
regex='<string>([A-za-z0-9.\:/]+)</string>'
while read -r line; do

if [[ $idx == "<key>ProductID</key>" ]]; then
CURRENT_PRODUCT_ID=$line
if [[ $CURRENT_PRODUCT_ID =~ $regex ]]
then
CURRENT_PRODUCT_ID=${BASH_REMATCH[1]}
fi
idx=""
fi
if [[ $line == "<key>ProductID</key>" ]]; then
idx=$line
fi
if [[ $idx == "<key>Version</key>" ]]; then
CURRENT_VERSION=$line
if [[ $CURRENT_VERSION =~ $regex ]]
then
CURRENT_VERSION=${BASH_REMATCH[1]}
fi
idx=""
fi
if [[ $line == "<key>Version</key>" ]]; then
idx=$line
fi
if [[ $idx == "<key>Codebase</key>" ]]; then
CURRENT_CODEBASE=$line
if [[ $CURRENT_CODEBASE =~ $regex ]]
then
CURRENT_CODEBASE=${BASH_REMATCH[1]}
fi
idx=""
fi
if [[ $line == "<key>Codebase</key>" ]]; then
idx=$line
fi



done <<< "$DATA"


#echo "CURRENT" $CURRENT_PRODUCT_ID $CURRENT_VERSION $CURRENT_CODEBASE
if [[ $PRODUCT_ID == $CURRENT_PRODUCT_ID ]]; then

if [[ $CURRENT_VERSION != $VERSION ]]; then
echo "Updating..."
hdiutil attach $CURRENT_CODEBASE
if [ $CURRENT_CODEBASE ?? 'SparkEdge.dmg' ]; then
if [ -d "/Applications/SparkEdge.app" ]
then
cp -av /Volumes/SparkEdge/* ./
else
cp -av /Volumes/SparkEdge/* /Applications/
fi
else
if [ -d "/Applications/Spark.app" ]
then
cp -av /Volumes/Spark/* ./
else
cp -av /Volumes/Spark/* /Applications/
fi
fi

fi

fi

#echo "${BASH_SOURCE[0]}"
2 changes: 2 additions & 0 deletions examples/pxScene2d/src/mkapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ fi

cp macstuff/spark.sh $bundleBin
cp macstuff/EngineRunner $bundleBin
cp macstuff/sparkUpdater.sh $bundleBin


# Minify JS into Bundle...
#
Expand Down