Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gokr/evothings-studio
Browse files Browse the repository at this point in the history
  • Loading branch information
gokr committed Jun 13, 2016
2 parents ab18417 + 0f275cc commit bbe03e2
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 44 deletions.
8 changes: 6 additions & 2 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ global.main = {}
main.MAJOR = 2
main.MINOR = 1
main.PATCH = 0
main.BUILD = 'beta9'
// Disabled for a real release:
//main.BUILD = "alpha1"

// This one is burned in by scripts
main.TIMESTAMP = '<timestamp>'

// Don't edit below
main.VERSION = main.MAJOR + '.' + main.MINOR
main.FULLVERSION = main.VERSION + '.' + main.PATCH + '-' + main.BUILD
main.FULLVERSION = main.VERSION + '.' + main.PATCH
if (main.BUILD) {
main.FULLVERSION = main.FULLVERSION + '-' + main.BUILD
}
main.BASE = 'https://evothings.com/' + main.VERSION
main.DOC = main.BASE + "/doc"
main.EXAMPLES = main.BASE + "/examples"
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "evothings-studio",
"productName": "Evothings Studio",
"description": "HTML/JS IoT mobile app development tool",
"version": "2.1.0-beta9",
"version": "2.1.0",
"author": "Evothings <[email protected]>",
"homepage": "https://evothings.com",
"license": "Apache-2.0",
Expand Down
113 changes: 72 additions & 41 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,111 @@
# Simple shell script to build and upload installers.
# This can only be used if you are on OSX and have s3cmd
# installed and configured with access keys.

# Default if not given on command line
VERSION=2.1.0-beta9

# Extract VERSION from app/main.js
MAJOR=$(sed -n '/^main\.MAJOR.*=.*/p' app/main.js | cut -d' ' -f 3)
MINOR=$(sed -n '/^main\.MINOR.*=.*/p' app/main.js | cut -d' ' -f 3)
PATCH=$(sed -n '/^main\.PATCH.*=.*/p' app/main.js | cut -d' ' -f 3)
BUILD=$(sed -n '/^main\.BUILD.*=.*/p' app/main.js | cut -d"\"" -f 2)
if [ ! -z "$BUILD" ] ; then
VER=$MAJOR.$MINOR.$PATCH-$BUILD
else
VER=$MAJOR.$MINOR.$PATCH
fi

export NAME=evothings-studio

# Default is all three, empty
PLATFORM=

function usage {
cat <<ENDOFHELP
Usage: $0 [version] [-ub]
version Default is $VERSION
-b Build
Usage: $0 [-wolauh?]
-w Build Windows
-o Build OSX
-l Build Linux
-a Build all
-u Upload to S3
-h Show this help.
-h -? Show this help.
ENDOFHELP
exit 1;
exit 1;
}

# No arguments
if [ -z "$1" ] ; then
usage
exit 1
fi

# Read global options and shift them away
while getopts "ubh?" o; do
while getopts "wolauh?" o; do
case "$o" in
w)
DOBUILD=true
PLATFORM=win;;
o)
DOBUILD=true
PLATFORM=osx;;
l)
DOBUILD=true
PLATFORM=linux;;
u) DOUPLOAD=true;;
b) DOBUILD=true;;
a) DOBUILD=true;;
h) usage;;
[?]) usage;;
esac
done
shift $(($OPTIND - 1))

# Read arguments
VER=$1
if [ -z "$VER" ] ; then
VER=$VERSION # default
fi
shift
#shift $(($OPTIND - 1))

if [ ! -z "$DOBUILD" ] ; then
echo "Building version $VER ..."
# Burn in build timestamp
NOW=$(date)
sed -i '' -e "s/main\.TIMESTAMP = '<timestamp>'/main\.TIMESTAMP = '$NOW'/g" ./app/main.js

# Nuke old builds
rm -rf dist/*
# Build for all platforms
npm run dist

# Build for one or all platforms
if [ -z "$PLATFORM" ] ; then
npm run dist
else
npm run dist:$PLATFORM
fi

# Remove burn
sed -i '' -e "s/main\.TIMESTAMP = '.*'/main\.TIMESTAMP = '<timestamp>'/g" ./app/main.js
fi

if [ ! -z "$DOUPLOAD" ] ; then
# Upload debs
s3cmd put dist/*.deb s3://evothings-download/
s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER.deb
#s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER-i386.deb

# Upload (rename) Windows installer
cp dist/win/Evothings\ Studio\ Setup\ $VER.exe /tmp/$NAME-$VER.exe
s3cmd put /tmp/$NAME-$VER.exe s3://evothings-download/
s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER.exe
rm /tmp/$NAME-$VER.exe

# Upload (rename) OSX installer
cp dist/osx/Evothings\ Studio-$VER.dmg /tmp/$NAME-$VER.dmg
s3cmd put /tmp/$NAME-$VER.dmg s3://evothings-download/
s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER.dmg
rm /tmp/$NAME-$VER.dmg

# Get nice URLs out of it...
if [ -z "$PLATFORM" ] || [ "$PLATFORM" == "linux" ] ; then
# Upload debs
s3cmd put dist/*.deb s3://evothings-download/
s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER.deb
#s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER-i386.deb
fi

if [ -z "$PLATFORM" ] || [ "$PLATFORM" == "win" ] ; then
# Upload (rename) Windows installer
cp dist/win/Evothings\ Studio\ Setup\ $VER.exe /tmp/$NAME-$VER.exe
s3cmd put /tmp/$NAME-$VER.exe s3://evothings-download/
s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER.exe
rm /tmp/$NAME-$VER.exe
fi

if [ -z "$PLATFORM" ] || [ "$PLATFORM" == "osx" ] ; then
# Upload (rename) OSX installer
cp dist/osx/Evothings\ Studio-$VER.dmg /tmp/$NAME-$VER.dmg
s3cmd put /tmp/$NAME-$VER.dmg s3://evothings-download/
s3cmd setacl --acl-public s3://evothings-download/$NAME-$VER.dmg
rm /tmp/$NAME-$VER.dmg
fi

echo PASTE INTO GITTER:
echo https://s3-eu-west-1.amazonaws.com/evothings-download/$NAME-$VER.deb
#echo https://s3-eu-west-1.amazonaws.com/evothings-download/$NAME-$VER-i386.deb
echo https://s3-eu-west-1.amazonaws.com/evothings-download/$NAME-$VER.exe
echo https://s3-eu-west-1.amazonaws.com/evothings-download/$NAME-$VER.dmg
echo https://s3-eu-west-1.amazonaws.com/evothings-download/$NAME-$VER.exe

fi

echo "DONE"

0 comments on commit bbe03e2

Please sign in to comment.