summaryrefslogtreecommitdiff
path: root/mobile.sh
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2014-09-08 11:34:23 +0200
committerGubolin <gubolin@fantasymail.de>2014-09-08 11:34:23 +0200
commit8c4dbc73a29ad4f2b22ee9bc1129b19d9742a5f7 (patch)
tree740c8bea00343904fade43592137928c1c600b25 /mobile.sh
parent6f09aff97549fb9d2a3687781edf5d31dd766195 (diff)
downloadsnap-8c4dbc73a29ad4f2b22ee9bc1129b19d9742a5f7.tar.gz
snap-8c4dbc73a29ad4f2b22ee9bc1129b19d9742a5f7.zip
rewrite scripts
Diffstat (limited to 'mobile.sh')
-rwxr-xr-xmobile.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/mobile.sh b/mobile.sh
index 789925a..15b1c9c 100755
--- a/mobile.sh
+++ b/mobile.sh
@@ -6,19 +6,21 @@ then
exit 0
fi
+scriptdir=$(readlink -e ".")
+
# Requirements:
# git, nodejs, android SDK / other platform(s)
# cordova (https://cordova.apache.org/)
-# binaries are in platform/android/ant-build/Snap-debug.apk
-
if [[ $2 != "" ]]
then
- copyfrom=$(readlink -e "$2")
+ buildsource=$(readlink -e "$2")
fi
-cordova create Snap-Mobile edu.berkeley.snap "Snap\!"
-cd Snap-Mobile
+builddir=$(mktemp -d)
+
+cordova create $builddir edu.berkeley.snap "Snap\!"
+cd $builddir
rm -rf www config.xml
if [[ $2 == "" ]]
@@ -27,14 +29,18 @@ then
cd www/
git checkout mobileapp
else
- cp -R "$copyfrom/" .
- mv "$copyfrom" www
+ mv "$buildsource" www
cd www
fi
+# remove configs for desktop, it is not needed
+rm package.json
+
+# add mobile-specific library; it's made available at runtime
sed -i '/link rel="shortcut icon"/a\
<script type="text/javascript" src="cordova.js"></script>' snap.html
+# add everything needed and build for $device
cordova platform add "$1"
cordova plugin add org.apache.cordova.plugin.softkeyboard
cordova plugin add org.apache.cordova.vibration
@@ -42,3 +48,7 @@ cordova plugin add org.apache.cordova.device-motion
cordova plugin add org.apache.cordova.device-orientation
cordova plugin add org.apache.cordova.geolocation
cordova build "$1"
+
+cd $builddir
+# TODO other platforms
+find -name '*.apk' | xargs -I {} mv {} $scriptdir