From c0f6867651b88b97e961331daf3eba90b7dca82b Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Wed, 15 Mar 2017 17:19:19 +0100 Subject: [PATCH] Prepare build for ubuntu x64 + upload to github - #400 --- config.xml | 8 ++-- github.sh | 1 + .../061_prepare_ubuntu_config.js | 38 +++++++++++++++++++ release.sh | 4 ++ www/js/app.js | 2 +- www/js/services/device-services.js | 4 +- 6 files changed, 49 insertions(+), 8 deletions(-) create mode 100755 hooks/after_prepare/061_prepare_ubuntu_config.js diff --git a/config.xml b/config.xml index bf43bc4e7..1548e0f6d 100644 --- a/config.xml +++ b/config.xml @@ -8,7 +8,7 @@ > <name>Cesium</name> <description> - An simple App for Duniter + An simple App for Duniter wallet </description> <author email="contact@e-is.pro"> E-IS PRO @@ -88,10 +88,10 @@ <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> </platform> <platform name="firefoxos"> - <icon height="128" src="resources/firefoxos/img/logo_128px.png" width="128" /> - <icon height="60" src="resources/firefoxos/img/logo_60px.png" width="60" /> + <icon height="128" src="www/img/logo_128px.png" width="128" /> + <icon height="60" src="www/img/logo_60px.png" width="60" /> </platform> <platform name="ubuntu"> - <icon height="57" src="resources/ubuntu/img/logo_57px.png" width="57"/> + <icon height="57" src="www/img/logo_57px.png" width="57"/> </platform> </widget> diff --git a/github.sh b/github.sh index a9655ee9d..e00c96a2f 100755 --- a/github.sh +++ b/github.sh @@ -56,6 +56,7 @@ case "$1" in curl -i -u $2 -H 'Content-Type: application/zip' -T $dirname/platforms/web/build/cesium-web-$current.zip $upload_url?name=cesium-v$current-web.zip curl -i -u $2 -H 'Content-Type: application/zip' -T $dirname/platforms/firefoxos/build/package.zip $upload_url?name=cesium-v$current-firefoxos.zip curl -i -u $2 -H 'Content-Type: application/vnd.android.package-archive' -T $dirname/platforms/android/build/outputs/apk/android-release.apk $upload_url?name=cesium-v$current-android.apk + curl -i -u $2 -H 'Content-Type: application/x-debian-package' -T $dirname/platforms/ubuntu/native/cesium_$current_amd64.deb $upload_url?name=cesium-v$current-ubuntu_x64.deb echo "Successfully uploading files" release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "https://api.github.com/repos/[a-z0-9/.]+"` diff --git a/hooks/after_prepare/061_prepare_ubuntu_config.js b/hooks/after_prepare/061_prepare_ubuntu_config.js new file mode 100755 index 000000000..bfd329d92 --- /dev/null +++ b/hooks/after_prepare/061_prepare_ubuntu_config.js @@ -0,0 +1,38 @@ +#!/usr/bin/env node +"use strict"; +var gulp = require('gulp'); +var path = require("path"); +var replace = require('gulp-replace'); + +var rootdir = process.argv[2]; + +if (rootdir) { + + // go through each of the platform directories that have been prepared + var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); + + for(var x=0; x<platforms.length; x++) { + + var platform = platforms[x].trim().toLowerCase(); + + if(platform == 'ubuntu') { + var platformPath = path.join(rootdir, 'platforms', platform); + var ionicConfigFile = path.join(platformPath, 'config.xml'); + + // Clean unused directories + console.log('-----------------------------------------'); + console.log(' Updating file: ' + ionicConfigFile); + gulp.src(ionicConfigFile) + + // change App ID into 'duniter-cesium' + .pipe(replace(/id="fr.duniter.cesium"/g, 'id="cesium"')) + + .pipe(gulp.dest(platformPath)); + + console.log('-----------------------------------------'); + } + + + } +} + diff --git a/release.sh b/release.sh index 789a81e7c..3b4e16581 100755 --- a/release.sh +++ b/release.sh @@ -8,6 +8,7 @@ then exit fi +DIRNAME=`pwd` ### Releasing current=`grep -P "version\": \"\d+.\d+.\d+(\w*)" package.json | grep -oP "\d+.\d+.\d+(\w*)"` @@ -40,6 +41,9 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ionic build android --release ionic build firefoxos --release gulp build:web --release + ionic build ubuntu --release + cd platforms/ubuntu/native/cesium; debuild + cd $DIRNAME # Commit git reset HEAD diff --git a/www/js/app.js b/www/js/app.js index 2dbd8086f..bbe2e42b4 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -313,7 +313,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht // Compute the root path var hashIndex = $window.location.href.indexOf('#'); $rootScope.rootPath = (hashIndex != -1) ? $window.location.href.substr(0, hashIndex) : $window.location.href; - console.debug('[app] Detecting root path: ' + $rootScope.rootPath); + console.debug('[app] Root path is [' + $rootScope.rootPath + ']'); // removeIf(android) // removeIf(ios) diff --git a/www/js/services/device-services.js b/www/js/services/device-services.js index 573e1ecb9..d3e950365 100644 --- a/www/js/services/device-services.js +++ b/www/js/services/device-services.js @@ -153,9 +153,7 @@ angular.module('cesium.device.services', ['ngResource', 'cesium.utils.services', var started = false; var startPromise = ionicReady().then(function(){ - exports.enable = cordova && cordova.plugins; - - console.info('TODO'); + exports.enable = window.cordova && cordova && cordova.plugins; if (exports.enable){ exports.camera.enable = !!navigator.camera; -- GitLab