You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/05/17 05:21:15 UTC

git commit: 0.7.2. [CB-2717] namespace ios files within the Plugins/ dir by plugin id.

Updated Branches:
  refs/heads/master 09e844ec2 -> 9344102d8


0.7.2. [CB-2717] namespace ios files within the Plugins/ dir by plugin id.


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

Branch: refs/heads/master
Commit: 9344102d8d9be01bb5bcf86b934dbfdbe0622d9e
Parents: 09e844e
Author: Fil Maj <ma...@gmail.com>
Authored: Thu May 16 20:20:58 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu May 16 20:20:58 2013 -0700

----------------------------------------------------------------------
 package.json               |    2 +-
 spec/platforms/ios.spec.js |   52 +++++++++++++++++++-------------------
 src/install.js             |    2 +-
 src/platforms/android.js   |    4 +-
 src/platforms/ios.js       |   12 ++++----
 src/uninstall.js           |    2 +-
 6 files changed, 37 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9344102d/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 3e3b6f6..a01784e 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Andrew Lunny <al...@gmail.com>",
   "name": "plugman",
   "description": "install/uninstall Cordova plugins",
-  "version": "0.7.1",
+  "version": "0.7.2",
   "repository": {
     "type": "git",
     "url": "git://git-wip-us.apache.org/repos/asf/cordova-plugman.git"

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9344102d/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index 9b11654..5084198 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -122,7 +122,7 @@ describe('ios project handler', function() {
             });
             it('should throw if source-file target already exists', function() {
                 var source = copyArray(valid_source);
-                var target = path.join(temp, 'SampleApp', 'Plugins', 'DummyPluginCommand.m');
+                var target = path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m');
                 shell.mkdir('-p', path.dirname(target));
                 fs.writeFileSync(target, 'some bs', 'utf-8');
                 expect(function() {
@@ -133,25 +133,25 @@ describe('ios project handler', function() {
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] == undefined});
                 var spy = spyOn(proj_files.xcode, 'addSourceFile');
                 ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'DummyPluginCommand.m'));
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'DummyPluginCommand.m'));
             });
             it('should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function() {
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] != undefined});
                 var spy = spyOn(proj_files.xcode, 'addSourceFile');
                 ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'targetDir', 'TargetDirTest.m'));
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
             });
             it('should cp the file to the right target location when element has no target-dir', function() {
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] == undefined});
                 var spy = spyOn(shell, 'cp');
                 ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.m'), path.join(temp, 'SampleApp', 'Plugins', 'DummyPluginCommand.m'));
+                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m'));
             });
             it('should cp the file to the right target location when element has a target-dir', function() {
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] != undefined});
                 var spy = spyOn(shell, 'cp');
                 ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.m'), path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.m'));
+                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
             });
         });
 
@@ -163,41 +163,41 @@ describe('ios project handler', function() {
             it('should throw if header-file src cannot be found', function() {
                 var headers = copyArray(invalid_headers);
                 expect(function() {
-                    ios['header-file'].install(headers[1], faultyplugin, temp, proj_files);
+                    ios['header-file'].install(headers[1], faultyplugin, temp, faulty_id, proj_files);
                 }).toThrow('cannot find "' + path.resolve(faultyplugin, 'src/ios/FaultyPluginCommand.h') + '" ios <header-file>');
             });
             it('should throw if header-file target already exists', function() {
                 var headers = copyArray(valid_headers);
-                var target = path.join(temp, 'SampleApp', 'Plugins', 'DummyPluginCommand.h');
+                var target = path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h');
                 shell.mkdir('-p', path.dirname(target));
                 fs.writeFileSync(target, 'some bs', 'utf-8');
                 expect(function() {
-                    ios['header-file'].install(headers[0], dummyplugin, temp, proj_files);
+                    ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, proj_files);
                 }).toThrow('target destination "' + target + '" already exists');
             });
             it('should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function() {
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] == undefined});
                 var spy = spyOn(proj_files.xcode, 'addHeaderFile');
-                ios['header-file'].install(headers[0], dummyplugin, temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'DummyPluginCommand.h'));
+                ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id,  proj_files);
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'DummyPluginCommand.h'));
             });
             it('should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function() {
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] != undefined});
                 var spy = spyOn(proj_files.xcode, 'addHeaderFile');
-                ios['header-file'].install(headers[0], dummyplugin, temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'targetDir', 'TargetDirTest.h'));
+                ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, proj_files);
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
             });
             it('should cp the file to the right target location when element has no target-dir', function() {
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] == undefined});
                 var spy = spyOn(shell, 'cp');
-                ios['header-file'].install(headers[0], dummyplugin, temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.h'), path.join(temp, 'SampleApp', 'Plugins', 'DummyPluginCommand.h'));
+                ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, proj_files);
+                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h'));
             });
             it('should cp the file to the right target location when element has a target-dir', function() {
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] != undefined});
                 var spy = spyOn(shell, 'cp');
-                ios['header-file'].install(headers[0], dummyplugin, temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.h'), path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.h'));
+                ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, proj_files);
+                expect(spy).toHaveBeenCalledWith(path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
             });
         });
 
@@ -260,7 +260,7 @@ describe('ios project handler', function() {
                 shell.cp('-rf', ios_config_xml_project, temp);
                 var spy = spyOn(proj_files.xcode, 'removeSourceFile');
                 ios['source-file'].uninstall(source[0], temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'DummyPluginCommand.m'));
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'DummyPluginCommand.m'));
             });
             it('should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function(){
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] != undefined});
@@ -268,7 +268,7 @@ describe('ios project handler', function() {
                 
                 var spy = spyOn(shell, 'rm');
                 ios['source-file'].uninstall(source[0], temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.m'));
+                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
             });
             it('should rm the file from the right target location when element has no target-dir', function(){
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] == undefined});
@@ -276,7 +276,7 @@ describe('ios project handler', function() {
             
                 var spy = spyOn(shell, 'rm');
                 ios['source-file'].uninstall(source[0], temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'DummyPluginCommand.m'));
+                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m'));
             });
             it('should rm the file from the right target location when element has a target-dir', function(){
                 var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] != undefined});
@@ -284,7 +284,7 @@ describe('ios project handler', function() {
                 var spy = spyOn(shell, 'rm');
                 
                 ios['source-file'].uninstall(source[0], temp, dummy_id, proj_files);
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.m'));
+                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
             });
         });
 
@@ -296,23 +296,23 @@ describe('ios project handler', function() {
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] == undefined});
                 var spy = spyOn(proj_files.xcode, 'removeHeaderFile');
 
-                ios['header-file'].uninstall(headers[0], temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'DummyPluginCommand.h'));
+                ios['header-file'].uninstall(headers[0], temp, dummy_id, proj_files);
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'DummyPluginCommand.h'));
             });
             it('should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function(){
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] != undefined});
 
                 var spy = spyOn(proj_files.xcode, 'removeHeaderFile');
 
-                ios['header-file'].uninstall(headers[0], temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'targetDir', 'TargetDirTest.h'));
+                ios['header-file'].uninstall(headers[0], temp, dummy_id, proj_files);
+                expect(spy).toHaveBeenCalledWith(path.join('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
             });
             it('should rm the file from the right target location', function(){
                 var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] != undefined});
                 var spy = spyOn(shell, 'rm');
 
-                ios['header-file'].uninstall(headers[0], temp, proj_files);
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.h'));
+                ios['header-file'].uninstall(headers[0], temp, dummy_id, proj_files);
+                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
             });
         });
 

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9344102d/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 49d2189..9a1ea36 100644
--- a/src/install.js
+++ b/src/install.js
@@ -132,7 +132,7 @@ function handleInstall(actions, plugin_id, plugin_et, platform, project_dir, plu
         });
 
         headerFiles && headerFiles.forEach(function(header) {
-            actions.push(actions.createAction(handler["header-file"].install, [header, plugin_dir, project_dir], handler["header-file"].uninstall, [header, project_dir]));
+            actions.push(actions.createAction(handler["header-file"].install, [header, plugin_dir, project_dir, plugin_id], handler["header-file"].uninstall, [header, project_dir, plugin_id]));
         });
 
         resourceFiles && resourceFiles.forEach(function(resource) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9344102d/src/platforms/android.js
----------------------------------------------------------------------
diff --git a/src/platforms/android.js b/src/platforms/android.js
index cda9e72..7e64d9f 100644
--- a/src/platforms/android.js
+++ b/src/platforms/android.js
@@ -35,11 +35,11 @@ module.exports = {
         return mDoc._root.attrib['package'];
     },
     "source-file":{
-        install:function(source_el, plugin_dir, project_dir) {
+        install:function(source_el, plugin_dir, project_dir, plugin_id) {
             var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
             common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
         },
-        uninstall:function(source_el, project_dir) {
+        uninstall:function(source_el, project_dir, plugin_id) {
             var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
             common.deleteJava(project_dir, dest);
         }

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9344102d/src/platforms/ios.js
----------------------------------------------------------------------
diff --git a/src/platforms/ios.js b/src/platforms/ios.js
index c33cbf8..745db78 100644
--- a/src/platforms/ios.js
+++ b/src/platforms/ios.js
@@ -36,7 +36,7 @@ module.exports = {
         install:function(source_el, plugin_dir, project_dir, plugin_id, project) {
             var src = source_el.attrib['src'];
             var srcFile = path.resolve(plugin_dir, src);
-            var targetDir = path.resolve(project.plugins_dir, getRelativeDir(source_el));
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(source_el));
             var destFile = path.resolve(targetDir, path.basename(src));
 
             if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <source-file>');
@@ -47,7 +47,7 @@ module.exports = {
         },
         uninstall:function(source_el, project_dir, plugin_id, project) {
             var src = source_el.attrib['src'];
-            var targetDir = path.resolve(project.plugins_dir, getRelativeDir(source_el));
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(source_el));
             var destFile = path.resolve(targetDir, path.basename(src));
 
             project.xcode.removeSourceFile(path.join('Plugins', path.relative(project.plugins_dir, destFile)));
@@ -59,10 +59,10 @@ module.exports = {
         }
     },
     "header-file":{
-        install:function(header_el, plugin_dir, project_dir, project) {
+        install:function(header_el, plugin_dir, project_dir, plugin_id, project) {
             var src = header_el.attrib['src'];
             var srcFile = path.resolve(plugin_dir, src);
-            var targetDir = path.resolve(project.plugins_dir, getRelativeDir(header_el));
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(header_el));
             var destFile = path.resolve(targetDir, path.basename(src));
             if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <header-file>');
             if (fs.existsSync(destFile)) throw new Error('target destination "' + destFile + '" already exists');
@@ -70,9 +70,9 @@ module.exports = {
             shell.mkdir('-p', targetDir);
             shell.cp(srcFile, destFile);
         },
-        uninstall:function(header_el, project_dir, project) {
+        uninstall:function(header_el, project_dir, plugin_id, project) {
             var src = header_el.attrib['src'];
-            var targetDir = path.resolve(project.plugins_dir, getRelativeDir(header_el));
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(header_el));
             var destFile = path.resolve(targetDir, path.basename(src));
             project.xcode.removeHeaderFile(path.join('Plugins', path.relative(project.plugins_dir, destFile)));
             shell.rm('-rf', destFile);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9344102d/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index dd991d0..947426f 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -94,7 +94,7 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
         });
 
         headerFiles && headerFiles.forEach(function(header) {
-            actions.push(actions.createAction(handler["header-file"].uninstall, [header, project_dir], handler["header-file"].install, [header, plugin_dir, project_dir]));
+            actions.push(actions.createAction(handler["header-file"].uninstall, [header, project_dir, plugin_id], handler["header-file"].install, [header, plugin_dir, project_dir, plugin_id]));
         });
 
         resourceFiles && resourceFiles.forEach(function(resource) {