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

[16/30] git commit: ios handler spec stubs. removed library-file handling from ios handler.

ios handler spec stubs. removed library-file handling from ios handler.


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

Branch: refs/heads/future
Commit: ee696a804052be43d68c8aa93b6959f7356252a3
Parents: 09c2537
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Apr 23 23:45:19 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Apr 23 23:45:19 2013 -0700

----------------------------------------------------------------------
 spec/platforms/ios.spec.js |  101 +++++++++++++++++++++++++++++++++++++++
 src/platforms/ios.js       |   11 +----
 2 files changed, 103 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ee696a80/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index e69de29..08c2103 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -0,0 +1,101 @@
+var ios = require('../../src/platforms/ios');
+
+describe('ios project handler', function() {
+    it('should have an install function', function() {
+        expect(typeof ios.install).toEqual('function');
+    });
+    it('should have an uninstall function', function() {
+        expect(typeof ios.uninstall).toEqual('function');
+    });
+    it('should return cordova-ios project www location using www_dir', function() {
+        expect(ios.www_dir('/')).toEqual('/www');
+    });
+
+    describe('installation', function() {
+        it('should throw if project is not an xcode project');
+        it('should throw if project does not contain an appropriate PhoneGap/Cordova.plist file or config.xml file');
+        it('should interpolate any variables correctly into pbx, plist and config files');
+
+        describe('of <source-file> elements', function() {
+            it('should throw if source-file src cannot be found');
+            it('should throw if source-file target already exists');
+            it('should use appropriate paths based on preserve-dirs attribute');
+            it('should call into xcodeproj\'s addSourceFile');
+            it('should cp the file to the right target location');
+        });
+
+        describe('of <plugins-plist> elements', function() {
+            it('should only be used in an applicably old cordova-ios projects');
+        });
+
+        describe('of <config-file> elements', function() {
+            it('should only be used in applicably new cordova-ios projects');
+            it('should add a <plugin> element in applicably new cordova-ios projects with old-style plugins using only <plugins-plist> elements');
+            it('should call xml_helpers\' graftXML');
+            it('should write the new config file out after successfully grafting');
+        });
+
+        describe('of <header-file> elements', function() {
+            it('should throw if header-file src cannot be found');
+            it('should throw if header-file target already exists');
+            it('should use appropriate paths based on preserve-dirs attribute');
+            it('should call into xcodeproj\'s addHeaderFile');
+            it('should cp the file to the right target location');
+        });
+
+        describe('of <resource-file> elements', function() {
+            it('should throw if resource-file src cannot be found');
+            it('should throw if resource-file target already exists');
+            it('should call into xcodeproj\'s addResourceFile');
+            it('should cp the file to the right target location');
+        });
+
+        describe('of <framework> elements', function() {
+            it('should throw if framework src cannot be found');
+            it('should call into xcodeproj\'s addFramework');
+            it('should pass in whether the framework is weak or not into xcodeproj');
+        });
+    });
+
+    describe('uninstallation', function() {
+        it('should throw if project is not an xcode project');
+        it('should throw if project does not contain an appropriate PhoneGap/Cordova.plist file or config.xml file');
+
+        describe('of <source-file> elements', function() {
+            it('should use appropriate paths based on preserve-dirs attribute');
+            it('should call into xcodeproj\'s removeSourceFile');
+            it('should rm the file from the right target location');
+        });
+
+        describe('of <plugins-plist> elements', function() {
+            it('should only be used in an applicably old cordova-ios project');
+        });
+
+        describe('of <config-file> elements', function() {
+            it('should only be used in applicably new cordova-ios projects');
+            it('should remove any applicable <plugin> elements in applicably new cordova-ios projects with old-style plugins using only <plugins-plist> elements');
+            it('should call xml_helpers\' pruneXML');
+            it('should write the new config file out after successfully pruning');
+        });
+
+        describe('of <asset> elements', function() {
+            it('should call rm on specified asset');
+            it('should call rm on the www/plugins/<plugin_id> folder');
+        });
+
+        describe('of <header-file> elements', function() {
+            it('should use appropriate paths based on preserve-dirs attribute');
+            it('should call into xcodeproj\'s removeHeaderFile');
+            it('should rm the file from the right target location');
+        });
+
+        describe('of <resource-file> elements', function() {
+            it('should call into xcodeproj\'s removeResourceFile');
+            it('should rm the file from the right target location');
+        });
+
+        describe('of <framework> elements', function() {
+            it('should call into xcodeproj\'s removeFramework');
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ee696a80/src/platforms/ios.js
----------------------------------------------------------------------
diff --git a/src/platforms/ios.js b/src/platforms/ios.js
index 62de7d0..9268fb1 100644
--- a/src/platforms/ios.js
+++ b/src/platforms/ios.js
@@ -106,21 +106,13 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables
                         shell.mkdir('-p', targetDir);
                         shell.cp(srcFile, destFile);
                     } else {
+                        // TODO: doesnt preserve-dirs affect what the originally-added path to xcodeproj (see above) affect how we should call remove too?
                         xcodeproj.removeSourceFile(path.join('Plugins', path.basename(src)));
                         shell.rm('-rf', destFile);
                         // TODO: is this right, should we check if dir is empty?
                         shell.rm('-rf', targetDir);    
                     }
                     break;
-                case 'library-file':
-                    var destFile = path.join(mod.attrib['target-dir'], path.basename(mod.attrib['src']));
-
-                    if (action == 'install') {
-                        common.straightCopy(plugin_dir, mod.attrib['src'], project_dir, destFile);
-                    } else {
-                        fs.unlinkSync(path.resolve(project_dir, destFile));
-                    }
-                    break;
                 case 'plugins-plist':
                     // Only handle this if the config file is cordova/phonegap plist.
                     if (path.extname(config_file) == '.plist') {
@@ -208,6 +200,7 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables
                         shell.mkdir('-p', targetDir);
                         shell.cp(srcFile, destFile);
                     } else {
+                        // TODO: doesnt preserve-dirs affect what the originally-added path to xcodeproj (see above) affect how we should call remove too?
                         xcodeproj.removeHeaderFile(path.join('Plugins', path.basename(src)));
                         shell.rm('-rf', destFile);
                         // TODO: again.. is this right? same as source-file