cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] git commit: CB-5345 Add pre_package event for windows8 parser.
Date Fri, 06 Dec 2013 02:59:47 GMT
CB-5345 Add pre_package event for windows8 parser.

Also:
- Don't call update_jsproj from update_www, instead call it from update_project.
- Fix update_www was called twice for windows8.


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

Branch: refs/heads/master
Commit: 721e290c5bad0217ef64ebe89fefb1c2d11da326
Parents: 4256250
Author: Dick van den Brink <d_vandenbrink@live.com>
Authored: Mon Nov 11 20:34:10 2013 +0100
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Dec 5 21:57:30 2013 -0500

----------------------------------------------------------------------
 spec/metadata/windows8_parser.spec.js | 17 +++++++++++------
 spec/metadata/wp8_parser.spec.js      |  2 +-
 src/metadata/windows8_parser.js       | 27 +++++++++++++++++----------
 3 files changed, 29 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/721e290c/spec/metadata/windows8_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/windows8_parser.spec.js b/spec/metadata/windows8_parser.spec.js
index a9c77d7..5117148 100644
--- a/spec/metadata/windows8_parser.spec.js
+++ b/spec/metadata/windows8_parser.spec.js
@@ -224,8 +224,11 @@ describe('windows8 project parser', function() {
             var config, www, overrides, staging, svn;
             beforeEach(function() {
                 config = spyOn(parser, 'update_from_config');
+                www = spyOn(parser, 'update_www');
+                www = spyOn(parser, 'update_jsproj');
                 staging = spyOn(parser, 'update_staging');
                 svn = spyOn(util, 'deleteSvnFolders');
+                exists.andReturn(false);
             });
             it('should call update_from_config', function() {
                 parser.update_project();
@@ -238,13 +241,15 @@ describe('windows8 project parser', function() {
                     expect(err).toEqual(err);
                 });
             });
-            it('should call update_staging', function() {
-                parser.update_project();
-                expect(staging).toHaveBeenCalled();
+            it('should call update_staging', function(done) {
+                wrapper(parser.update_project(), done, function() {
+                    expect(staging).toHaveBeenCalled();
+                });
             });
-            it('should call deleteSvnFolders', function() {
-                parser.update_project();
-                expect(svn).toHaveBeenCalled();
+            it('should call deleteSvnFolders', function(done) {
+                wrapper(parser.update_project(), done, function() {
+                    expect(svn).toHaveBeenCalled();
+                });
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/721e290c/spec/metadata/wp8_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/wp8_parser.spec.js b/spec/metadata/wp8_parser.spec.js
index 6d62a02..9f50397 100644
--- a/spec/metadata/wp8_parser.spec.js
+++ b/spec/metadata/wp8_parser.spec.js
@@ -204,7 +204,7 @@ describe('wp8 project parser', function() {
             });
         });
         describe('update_project method', function() {
-            var config, www, overrides, staging, svn;
+            var config, www, overrides, staging, svn, csproj;
             beforeEach(function() {
                 config = spyOn(p, 'update_from_config');
                 www = spyOn(p, 'update_www');

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/721e290c/src/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/windows8_parser.js b/src/metadata/windows8_parser.js
index e85b86f..194a654 100644
--- a/src/metadata/windows8_parser.js
+++ b/src/metadata/windows8_parser.js
@@ -27,7 +27,8 @@ var fs            = require('fs'),
     child_process = require('child_process'),
     config_parser = require('../config_parser'),
     xml           = require('../xml-helpers'),
-    config        = require('../config');
+    config        = require('../config'),
+    hooker        = require('../hooker');
 
 module.exports = function windows8_parser(project) {
     try {
@@ -204,7 +205,6 @@ module.exports.prototype = {
 
         // Copy over stock platform www assets (cordova.js)
         shell.cp('-rf', path.join(platform_www, '*'), this.www_dir());
-        this.update_jsproj();
     },
 
     // updates the jsproj file to explicitly list all www content.
@@ -286,15 +286,23 @@ module.exports.prototype = {
         } catch(e) {
             return Q.reject(e);
         }
-        // overrides (merges) are handled in update_www()
-        this.update_staging();
-        //this.add_bom();
 
-        util.deleteSvnFolders(this.www_dir());
-        return Q();
+        var that = this;
+        var projectRoot = util.isCordova(process.cwd());
+
+        var hooks = new hooker(projectRoot);
+        return hooks.fire('pre_package', { wwwPath:this.www_dir() })
+        .then(function() {
+            // overrides (merges) are handled in update_www()
+            that.update_jsproj();
+            that.update_staging();
+            //that.add_bom();
+
+            util.deleteSvnFolders(that.www_dir());
+        });
     },
 
-    // Adjust version number as per CB-5337 Windows8 build fails due to invalid app version
       
+    // Adjust version number as per CB-5337 Windows8 build fails due to invalid app version
     fixConfigVersion: function (version) {
         if(version && version.match(/\.\d/g)) {
             var numVersionComponents = version.match(/\.\d/g).length + 1;
@@ -322,6 +330,5 @@ module.exports.prototype = {
                 fs.writeFileSync(filePath, '\ufeff' + content);
             }
         });
-  	}
-
+    }
 };


Mime
View raw message