cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [01/16] git commit: Fix version and Id in package.appxmanifest
Date Tue, 26 Nov 2013 02:02:13 GMT
Updated Branches:
  refs/heads/master 319631819 -> a54c93027


Fix version and Id in package.appxmanifest


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/f6d4c757
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/f6d4c757
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/f6d4c757

Branch: refs/heads/master
Commit: f6d4c757edf6617d444d83a7cf09e02d481e8b01
Parents: 19513a1
Author: SomaticIT <contact@somatic.fr>
Authored: Fri Nov 15 16:32:12 2013 +0100
Committer: SomaticIT <contact@somatic.fr>
Committed: Fri Nov 15 16:32:12 2013 +0100

----------------------------------------------------------------------
 src/metadata/windows8_parser.js | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f6d4c757/src/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/windows8_parser.js b/src/metadata/windows8_parser.js
index dbddf30..4e331b5 100644
--- a/src/metadata/windows8_parser.js
+++ b/src/metadata/windows8_parser.js
@@ -80,7 +80,7 @@ module.exports.prototype = {
         var manifest = xml.parseElementtreeSync(this.manifest_path);
 
         //Update app version
-        var version = config.version();
+        var version = this.fixConfigVersion(config);
         var identityNode = manifest.find('.//Identity');
         if(identityNode) {
             var appVersion = identityNode['attrib']['Version'];
@@ -90,14 +90,15 @@ module.exports.prototype = {
         }
 
         // update name ( windows8 has it in the Application[@Id] and Application.VisualElements[@DisplayName])
+        var pkgName = config.packageName();
         var name = config.name();
         var app = manifest.find('.//Application');
         if(app) {
 
             var appId = app['attrib']['Id'];
 
-            if(appId != name) {
-                app['attrib']['Id'] = name;
+            if (appId != pkgName) {
+                app['attrib']['Id'] = pkgName;
             }
 
             var visualElems = manifest.find('.//VisualElements');
@@ -254,5 +255,18 @@ module.exports.prototype = {
         this.update_staging();
         util.deleteSvnFolders(this.www_dir());
         return Q();
+    },
+
+    // Cordova default version format is not compatible with Windows 8
+    fixConfigVersion: function (config) {
+        var version = config.version();
+        if (version.match(/^\d+\.\d+\.\d+$/)) {
+            return version.concat(".0");
+        }
+        else if (version.match(/^\d+\.\d+\.\d+\.\d+$/)) {
+            return version;
+        }
+        else
+            throw new Error("This version format is not recognized !");
     }
 };


Mime
View raw message