cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject [1/2] git commit: [CB-4545] support for merges directory on both wp7 & wp8
Date Fri, 20 Sep 2013 17:20:21 GMT
Updated Branches:
  refs/heads/master 40095904c -> c99bcdf3c


[CB-4545] support for merges directory on both wp7 & wp8


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

Branch: refs/heads/master
Commit: cc7bebb7a08b14e46a0914178adace5a77c87482
Parents: 69479bc
Author: Wolfgang Koller <viras@apache.org>
Authored: Wed Sep 18 10:23:17 2013 +0200
Committer: Wolfgang Koller <viras@apache.org>
Committed: Wed Sep 18 10:23:17 2013 +0200

----------------------------------------------------------------------
 src/metadata/wp7_parser.js | 16 ++++++++++++++--
 src/metadata/wp8_parser.js | 19 ++++++++++++-------
 2 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cc7bebb7/src/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js
index bde8770..e72c1f6 100644
--- a/src/metadata/wp7_parser.js
+++ b/src/metadata/wp7_parser.js
@@ -141,6 +141,14 @@ module.exports.prototype = {
     www_dir:function() {
         return path.join(this.wp7_proj_dir, 'www');
     },
+    // copy files from merges directory to actual www dir
+    copy_merges:function(merges_sub_path) {
+        var merges_path = path.join(util.appDir(util.isCordova(this.wp7_proj_dir)), 'merges',
merges_sub_path);
+        if (fs.existsSync(merges_path)) {
+            var overrides = path.join(merges_path, '*');
+            shell.cp('-rf', overrides, this.www_dir());
+        }
+    },
     // copies the app www folder into the wp7 project's www folder and updates the csproj
file.
     update_www:function() {
         var project_root = util.isCordova(this.wp7_proj_dir);
@@ -150,6 +158,10 @@ module.exports.prototype = {
         // copy over all app www assets
         shell.cp('-rf', project_www, this.wp7_proj_dir);
 
+        // copy all files from merges directories (generic first, then specific)
+        this.copy_merges('wp');
+        this.copy_merges('wp7');
+
         // copy over wp7 lib's cordova.js
         var lib_path = path.join(util.libDirectory, 'wp', 'cordova', require('../../platforms').wp7.version);
         var custom_path = config.has_custom_path(project_root, 'wp7');
@@ -168,7 +180,7 @@ module.exports.prototype = {
             var files = group.findall('Content');
             for (var j = 0, k = files.length; j < k; j++) {
                 var file = files[j];
-                if (file.attrib.Include.substr(0, 3) == 'www' && file.attrib.Include.indexOf('cordova.js')
< 0) {
+                if (file.attrib.Include.substr(0, 3) == 'www') {
                     // remove file reference
                     group.remove(0, file);
                     // remove ItemGroup if empty
@@ -182,7 +194,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);
-        var www_files = this.folder_contents('www', util.projectWww(project_root));
+        var www_files = this.folder_contents('www', this.www_dir());
         for(file in www_files) {
             var item = new et.Element('ItemGroup');
             var content = new et.Element('Content');

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cc7bebb7/src/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp8_parser.js b/src/metadata/wp8_parser.js
index dad5605..bfcb6ef 100644
--- a/src/metadata/wp8_parser.js
+++ b/src/metadata/wp8_parser.js
@@ -144,6 +144,14 @@ module.exports.prototype = {
     },
     config_xml:function() {
     },
+    // copy files from merges directory to actual www dir
+    copy_merges:function(merges_sub_path) {
+        var merges_path = path.join(util.appDir(util.isCordova(this.wp8_proj_dir)), 'merges',
merges_sub_path);
+        if (fs.existsSync(merges_path)) {
+            var overrides = path.join(merges_path, '*');
+            shell.cp('-rf', overrides, this.www_dir());
+        }
+    },
     // copies the app www folder into the wp8 project's www folder and updates the csproj
file.
     update_www:function() {
         var project_root = util.isCordova(this.wp8_proj_dir);
@@ -153,12 +161,9 @@ module.exports.prototype = {
         // copy over all app www assets
         shell.cp('-rf', project_www, this.wp8_proj_dir);
 
-        // copy all files from merges directory
-        var merges_path = path.join(util.appDir(project_root), 'merges', 'wp8');
-        if (fs.existsSync(merges_path)) {
-            var overrides = path.join(merges_path, '*');
-            shell.cp('-rf', overrides, this.www_dir());
-        }
+        // copy all files from merges directories (generic first, then specific)
+        this.copy_merges('wp');
+        this.copy_merges('wp8');
 
         // copy over wp8 lib's cordova.js
         var lib_path = path.join(util.libDirectory, 'wp', 'cordova', require('../../platforms').wp8.version);
@@ -178,7 +183,7 @@ module.exports.prototype = {
             var files = group.findall('Content');
             for (var j = 0, k = files.length; j < k; j++) {
                 var file = files[j];
-                if (file.attrib.Include.substr(0, 3) == 'www' && file.attrib.Include.indexOf('cordova.js')
< 0) {
+                if (file.attrib.Include.substr(0, 3) == 'www') {
                     // remove file reference
                     group.remove(0, file);
                     // remove ItemGroup if empty


Mime
View raw message