cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [04/13] git commit: Separate out adding a dependent project from adding a .winmd reference in windows8
Date Thu, 06 Mar 2014 00:13:31 GMT
Separate out adding a dependent project from adding a .winmd reference in windows8


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

Branch: refs/heads/master
Commit: 0eb0364890509e3a9c8f15027e002bcd8c248767
Parents: fe56a5d
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Thu Feb 27 16:36:04 2014 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Thu Feb 27 16:36:04 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js | 61 +++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0eb03648/src/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/src/platforms/windows8.js b/src/platforms/windows8.js
index 151dfee..491c6f0 100644
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@ -117,48 +117,41 @@ module.exports = {
             project_file.removeReference(src);
         }
     },
-    "framework":{ // CB-5238 custom frameworks only
-        install:function(framework_el, plugin_dir, project_dir, plugin_id, project) {
-            // console.log("framework install called with framework_el:: " + framework_el);
-            // console.log("framework install called with plugin_dir:: " + plugin_dir );
-            // console.log("framework install called with project_dir:: " + project_dir);
-            // console.log("framework install called with plugin_id:: " + plugin_id);
-            // console.log("framework install called with project::" + project);
-
-            // console.log("project.plugins_dir " + project.plugins_dir);
+    "framework": {
+        install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
+            require('../../plugman').emit('verbose', 'windows8 framework install :: ' + plugin_id);
 
-            // framework_el attributes : src, custom
-            var src = framework_el.attrib['src'];
-            console.log("src = " + src);
+            var src = el.attrib['src'];
+            var dest = src; // if !isCustom, we will just add a reference to the file in
place
+            var isCustom = el.attrib.custom == "true";
+            var type = el.attrib["type"];
 
-            var custom = framework_el.attrib['custom'];
+            if(isCustom) {
+                dest = path.join('plugins', plugin_id, path.basename(src));
+                common.copyFile(plugin_dir, src, project_dir, dest);
+            }
 
-            var srcFile = path.resolve(plugin_dir, src);
+            if(type == "projectReference") {
 
-            console.log("path.basename(src) = " + path.basename(src));
+            }
+            else {
+                project_file.addReference(dest,src);
+            }
 
-            console.log("srcFile = " + srcFile);
+        },
+        uninstall:function(el, project_dir, plugin_id, project_file) {
+            require('../../plugman').emit('verbose', 'windows8 framework uninstall :: ' +
plugin_id  );
 
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
+            var src = el.attrib['src'];
+            var isCustom = el.attrib.custom == "true";
 
-            if (!custom) throw new Error('cannot add non custom frameworks.');
-            if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios
<framework>');
-            if (fs.existsSync(targetDir)) throw new Error('target destination "' + targetDir
+ '" already exists');
-            shell.mkdir('-p', path.dirname(targetDir));
-            shell.cp('-R', srcFile, path.dirname(targetDir)); // frameworks are directories
-            var project_relative = path.relative(project_dir, targetDir);
-            
-            console.log("project_relative = " + project_relative);
-            project.addProjectReference(project_relative);
-            //project.xcode.addFramework(project_relative, {customFramework: true});
-        },
-        uninstall:function(framework_el, project_dir, plugin_id, project) {
-            var src = framework_el.attrib['src'],
-                baseDir = path.resolve(project.plugins_dir, plugin_id),
-                targetDir = path.resolve(baseDir, path.basename(src));
-            project.removeProjectReference(targetDir);
-            shell.rm('-rf', baseDir);
+            if(isCustom) {
+                var dest = path.join('plugins', plugin_id);//, path.basename(src));
+                common.removeFile(project_dir, dest);
+            }
 
+            project_file.removeReference(src);
         }
+
     }
 };


Mime
View raw message