From c15f5ea9dcc6ff7ec27af1694316c9a13e8f0f65 Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Tue, 30 Dec 2014 15:19:16 +0000 Subject: [PATCH] Initial fixes for wp8 --- Gruntfile.js | 26 ++++-------- cordova/build.sh | 105 ++++++++++++++++++++++++++++++++++++----------- index.html | 2 +- package.json | 2 +- 4 files changed, 91 insertions(+), 44 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 468e3671e..954507565 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,19 +25,11 @@ module.exports = function(grunt) { } } }, - shell: { + exec: { prod: { - options: { - stdout: false, - stderr: false - }, - command: 'node ./util/build.js' + command: 'ls' }, dev: { - options: { - stdout: true, - stderr: true - }, command: 'node ./util/build.js -d' } }, @@ -242,25 +234,25 @@ module.exports = function(grunt) { grunt.registerTask('default', [ - 'shell:dev', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors' + 'exec:dev', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors' ]); grunt.registerTask('mobile', [ - 'shell:dev', 'nggettext_compile', 'concat', 'cssmin:mobile', 'cssmin:vendors' + 'exec:dev', 'nggettext_compile', 'concat', 'cssmin:mobile', 'cssmin:vendors' ]); grunt.registerTask('dist', [ - 'shell:prod', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors', 'uglify', 'copy:dist' + 'exec:prod', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors', 'uglify', 'copy:dist' ]); grunt.registerTask('dist-dbg', [ - 'shell:prod', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors', 'copy:dist' + 'exec:prod', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors', 'copy:dist' ]); grunt.registerTask('dist-mobile', [ - 'shell:prod', 'nggettext_compile', 'concat', 'cssmin:mobile', 'cssmin:vendors', 'uglify', 'copy:dist' + 'exec:prod', 'nggettext_compile', 'concat', 'cssmin:mobile', 'cssmin:vendors', 'uglify', 'copy:dist' ]); grunt.registerTask('dist-mobile-dbg', [ - 'shell:dev', 'nggettext_compile', 'concat', 'cssmin:mobile', 'cssmin:vendors', 'copy:dist' + 'exec:dev', 'nggettext_compile', 'concat', 'cssmin:mobile', 'cssmin:vendors', 'copy:dist' ]); grunt.registerTask('prod', [ - 'shell:prod', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors', 'uglify' + 'exec:prod', 'nggettext_compile', 'concat', 'cssmin:desktop', 'cssmin:vendors', 'uglify' ]); grunt.registerTask('translate', ['nggettext_extract']); grunt.registerTask('docs', ['jsdoc']); diff --git a/cordova/build.sh b/cordova/build.sh index 0f0973f7e..ae968c0f6 100755 --- a/cordova/build.sh +++ b/cordova/build.sh @@ -1,14 +1,14 @@ #! /bin/bash - +# # Usage: # sh ./build.sh --android --reload - +# OpenColor="\033[" Red="1;31m" Yellow="1;33m" Green="1;32m" CloseColor="\033[0m" - +# # Check function OK checkOK() { if [ $? != 0 ]; then @@ -22,16 +22,43 @@ BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PROJECT="$BUILDDIR/project" VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js` -SKIPIOS=false +CURRENT_OS="WP8" +#CURRENT_OS="IPHONE" +#CURRENT_OS="ANDROID" CLEAR=false DBGJS=false -# Check Args -if [[ $1 = "--android" || $2 = "--android" || $3 = "--android" ]] -then - SKIPIOS=true +if [ $CURRENT_OS == "ANDROID" ]; then +echo "ANDROID ....." fi +if [ $CURRENT_OS == "IPHONE" ]; then +echo "IPHONE ....." +fi + +if [ $CURRENT_OS == "WP8" ]; then +echo "WP8 ....." +fi + + + +# Check Args +#if [[ $1 = "--android" || $2 = "--android" || $3 = "--android" ]] +#then +# CURRENT_OS="ANDROID" +#fi +# +#if [[ $1 = "--ios" || $2 = "--ios" || $3 = "--ios" ]] +#then +# CURRENT_OS="IPHONE" +#fi +# +#if [[ $1 = "--wp8" || $2 = "--wp8" || $3 = "--wp8" ]] +#then +# CURRENT_OS="WP8" +#fi + + if [[ $1 = "--clear" || $2 = "--clear" || $3 = "--clear" ]] then CLEAR=true @@ -45,7 +72,7 @@ fi echo "${OpenColor}${Green}* Checking dependencies...${CloseColor}" command -v cordova >/dev/null 2>&1 || { echo >&2 "Cordova is not present, please install it: sudo npm -g cordova."; exit 1; } -command -v xcodebuild >/dev/null 2>&1 || { echo >&2 "XCode is not present, install it or use [--android]."; exit 1; } +#command -v xcodebuild >/dev/null 2>&1 || { echo >&2 "XCode is not present, install it or use [--android]."; exit 1; } # Create project dir if $CLEAR @@ -55,6 +82,10 @@ then fi fi +echo "Build directory is $BUILDDIR" +echo "Project directory is $PROJECT" + + if [ ! -d $PROJECT ]; then cd $BUILDDIR echo "${OpenColor}${Green}* Creating project... ${CloseColor}" @@ -62,21 +93,30 @@ if [ ! -d $PROJECT ]; then checkOK cd $PROJECT - echo "${OpenColor}${Green}* Adding Android platform... ${CloseColor}" - cordova platforms add android - checkOK - if [[ !$SKIPIOS ]]; then + if [$CURRENT_OS == "ANDROID"]; then + echo "${OpenColor}${Green}* Adding Android platform... ${CloseColor}" + cordova platforms add android + checkOK + fi + + if [$CURRENT_OS == "IPHONE" ]; then echo "${OpenColor}${Green}* Adding IOS platform... ${CloseColor}" cordova platforms add ios checkOK fi + if [$CURRENT_OS == "WP8"]; then + echo "${OpenColor}${Green}* Adding WP8 platform... ${CloseColor}" + cordova platforms add wp8 + checkOK + fi + echo "${OpenColor}${Green}* Installing plugins... ${CloseColor}" cordova plugin add https://github.com/Initsogar/cordova-webintent.git checkOK - + cordova plugin add https://github.com/wildabeast/BarcodeScanner.git checkOK @@ -116,22 +156,29 @@ sed "s/<\!-- PLACEHOLDER: CORDOVA SRIPT -->/