You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/09/24 00:47:59 UTC

git commit: reapplied change to add event mid build to allow mods to www folder pre_package aka 775e969f9cc27a580123897d922121d564d4554d

Updated Branches:
  refs/heads/master d215e5f5f -> bd2c667e9


reapplied change to add event mid build to allow mods to www folder pre_package  aka 775e969f9cc27a580123897d922121d564d4554d


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

Branch: refs/heads/master
Commit: bd2c667e947b3fda05541e0d1a124d23df60a132
Parents: d215e5f
Author: purplecabbage <pu...@gmail.com>
Authored: Mon Sep 23 15:36:15 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Mon Sep 23 15:36:15 2013 -0700

----------------------------------------------------------------------
 src/metadata/wp7_parser.js | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/bd2c667e/src/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js
index 7abbda1..cb60d9c 100644
--- a/src/metadata/wp7_parser.js
+++ b/src/metadata/wp7_parser.js
@@ -26,7 +26,8 @@ var fs            = require('fs'),
     child_process = require('child_process'),
     Q             = require('q'),
     config_parser = require('../config_parser'),
-    config        = require('../config');
+    config        = require('../config'),
+    hooker        = require('../hooker');
 
 module.exports = function wp7_parser(project) {
     try {
@@ -88,7 +89,7 @@ module.exports.prototype = {
             manifest.find('.//PrimaryToken').attrib.TokenID = name;
             //update name of sln and csproj.
             name = name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_'); //make it a ligitamate name
-            prev_name = prev_name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_'); 
+            prev_name = prev_name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_');
             var sln_name = fs.readdirSync(this.wp7_proj_dir).filter(function(e) { return e.match(/\.sln$/i); })[0];
             var sln_path = path.join(this.wp7_proj_dir, sln_name);
             var sln_file = fs.readFileSync(sln_path, 'utf-8');
@@ -172,7 +173,7 @@ module.exports.prototype = {
         if (custom_path) lib_path = custom_path;
         var cordovajs_path = path.join(lib_path, 'common', 'www', 'cordova.js');
         fs.writeFileSync(path.join(this.www_dir(), 'cordova.js'), fs.readFileSync(cordovajs_path, 'utf-8'), 'utf-8');
-        this.update_csproj();
+
     },
     // updates the csproj file to explicitly list all www content.
     update_csproj:function() {
@@ -196,8 +197,7 @@ module.exports.prototype = {
             }
         }
 
-        // now add all www references back in from the root www folder
-        var project_root = util.isCordova(this.wp7_proj_dir);
+        // now add all www references back in from the wp www folder
         var www_files = this.folder_contents('www', this.www_dir());
         for(file in www_files) {
             var item = new et.Element('ItemGroup');
@@ -243,7 +243,7 @@ module.exports.prototype = {
         }
     },
 
-    // calls the nessesary functions to update the wp7 project 
+    // calls the nessesary functions to update the wp7 project
     // Returns a promise.
     update_project:function(cfg) {
         try {
@@ -252,6 +252,12 @@ module.exports.prototype = {
             return Q.reject(e);
         }
         this.update_www();
+
+        // trigger an event in case anyone needs to modify the contents of the www folder before we package it.
+        var projectRoot = util.isCordova(process.cwd());
+        var hooks = new hooker(projectRoot);
+        hooks.fire('pre_package', { wwwPath:this.www_dir() }, function(err) { });
+        this.update_csproj();
         // TODO: Add overrides support? Why is this missing?
         this.update_staging();
         util.deleteSvnFolders(this.www_dir());