You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2013/04/30 00:52:21 UTC
[1/3] git commit: Fixed ios spec test to match moving some specific
ios steps into a common module
Updated Branches:
refs/heads/master 858a5c4ae -> 6c4c62e92
Fixed ios spec test to match moving some specific ios steps into a common module
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/6c4c62e9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/6c4c62e9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/6c4c62e9
Branch: refs/heads/master
Commit: 6c4c62e9266bc593df93ce28a0154653f7302e65
Parents: 38531af
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Apr 29 15:50:46 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Apr 29 15:51:59 2013 -0700
----------------------------------------------------------------------
spec/platforms/ios.spec.js | 69 ++++----------------------------------
1 files changed, 8 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/6c4c62e9/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index 187f640..591e217 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -5,6 +5,7 @@ var ios = require('../../src/platforms/ios'),
et = require('elementtree'),
shell = require('shelljs'),
os = require('osenv'),
+ common = require('../../src/platforms/common'),
xcode = require('xcode'),
plist = require('plist'),
bplist = require('bplist-parser'),
@@ -395,78 +396,24 @@ describe('ios project handler', function() {
});
});
- describe('of <plugins-plist> elements', function() {
- it('should only be used in an applicably old cordova-ios project', function(){
- shell.cp('-rf', ios_plist_project, temp);
- var pls = copyArray(plist_els);
- var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
-
- ios.uninstall(pls, dummy_id, temp, dummyplugin);
- expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist'));
- });
- it('should not be used in an applicably old cordova-ios project', function() {
- shell.cp('-rf', ios_config_xml_project, temp);
- var pls = copyArray(plist_els);
- var spy = spyOn(xml_helpers, 'parseElementtreeSync').andCallThrough();
- ios.uninstall(pls, dummy_id, temp, dummyplugin);
- expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'));
- });
- it('should remove the <plugin> element in applicably new cordova-ios projects with old-style plugins using only <plugins-plist> elements', function() {
- shell.cp('-rf', ios_config_xml_project, temp);
- var pls = copyArray(plist_only_els);
- //ios.install(pls, plist_id, temp, plistplugin, {});
- var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
- ios.uninstall(pls, dummy_id, temp, plistplugin);
- expect(fs.readFileSync(path.join(temp, 'SampleApp', 'config.xml'), 'utf-8')).not.toMatch(/<plugin name="OldSkewl"/gi);
- });
- });
-
- describe('of <config-file> elements', function() {
- beforeEach(function() {
- shell.cp('-rf', ios_config_xml_project, temp);
- });
- it('should call xml_helpers\' pruneXML', function(){
- var config = copyArray(dummy_configs);
- // add an extra child element to avoid an if statement in ios.js
- config[0]._children[1] = config[0]._children[0];
-
- var spy = spyOn(xml_helpers, 'pruneXML').andReturn({config_path: ''});
-
- ios.uninstall(config, dummy_id, temp, dummyplugin);
- expect(spy).toHaveBeenCalledWith(jasmine.any(Object), dummy_configs[0]._children, '/widget/plugins');
- });
- it('should write the new config file out after successfully pruning', function(){
- var config = copyArray(dummy_configs);
- // add an extra child element to avoid an if statement in ios.js
- config[0]._children[1] = config[0]._children[0];
-
- var spyPrune = spyOn(xml_helpers, 'pruneXML').andCallThrough();
- var spyWrite = spyOn(fs, 'writeFileSync');
-
- ios.uninstall(config, dummy_id, temp, dummyplugin);
- expect(spyPrune).toHaveBeenCalled();
- expect(spyWrite).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'), jasmine.any(String));
- });
- });
-
describe('of <asset> elements', function() {
beforeEach(function() {
shell.cp('-rf', ios_config_xml_project, temp);
});
it('should call rm on specified asset',function(){
- var config = copyArray(assets);
- var spy = spyOn(shell, 'rm');
+ var config = copyArray(valid_assets);
+ var spy = spyOn(common, 'removeFile');
ios.uninstall(config, dummy_id, temp, dummyplugin);
- expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'dummyplugin.js'));
- expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'dummyplugin'));
+ expect(spy).toHaveBeenCalledWith(path.join(temp, 'www'), 'dummyplugin.js');
+ expect(spy).toHaveBeenCalledWith(path.join(temp, 'www'), 'dummyplugin');
});
it('should call rm on the www/plugins/<plugin_id> folder',function(){
- var config = copyArray(assets);
- var spy = spyOn(shell, 'rm');
+ var config = copyArray(valid_assets);
+ var spy = spyOn(common, 'removeFile');
ios.uninstall(config, dummy_id, temp, dummyplugin);
- expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'plugins', dummy_id));
+ expect(spy).toHaveBeenCalledWith(path.join(temp, 'www', 'plugins'), dummy_id);
});
});
[3/3] git commit: Fixing up ios uninstall tests
Posted by ti...@apache.org.
Fixing up ios uninstall tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/eb4fecc1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/eb4fecc1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/eb4fecc1
Branch: refs/heads/master
Commit: eb4fecc1cf09fd8533ad0caab4748134f6712fcc
Parents: 858a5c4
Author: Tim Kim <ti...@adobe.com>
Authored: Thu Apr 25 17:29:31 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Apr 29 15:51:59 2013 -0700
----------------------------------------------------------------------
spec/platforms/ios.spec.js | 87 ++++++++++++++++++++++++++++++++++-----
src/platforms/ios.js | 9 ++--
2 files changed, 81 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eb4fecc1/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index cb5521f..0b46d1c 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -356,16 +356,83 @@ describe('ios project handler', function() {
});
describe('of <source-file> elements', function() {
- it('should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir');
- it('should call into xcodeproj\'s removeSourceFile appropriately when element a no target-dir');
- it('should rm the file from the right target location when element has a target-dir');
- it('should rm the file from the right target location when element has no target-dir');
+ it('should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function(){
+ var source = copyArray(valid_source).filter(function(s) { return s.attrib['target-dir'] == undefined});
+ shell.cp('-rf', ios_config_xml_project, temp);
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeSourceFile:spy
+ });
+
+ ios.uninstall(source, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(path.join('Plugins', '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});
+ shell.cp('-rf', ios_config_xml_project, temp);
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeSourceFile:function(){}
+ });
+
+ var spy = spyOn(shell, 'rm');
+ ios.uninstall(source, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', '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});
+ shell.cp('-rf', ios_config_xml_project, temp);
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeSourceFile:function(){}
+ });
+
+ var spy = spyOn(shell, 'rm');
+ ios.uninstall(source, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', '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});
+ shell.cp('-rf', ios_config_xml_project, temp);
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeSourceFile:function(){}
+ });
+
+ var spy = spyOn(shell, 'rm');
+ ios.uninstall(source, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.m'));
+ });
});
describe('of <plugins-plist> elements', function() {
- it('should only be used in an applicably old cordova-ios project');
- it('should not be used in an applicably old cordova-ios project');
+ it('should only be used in an applicably old cordova-ios project', function(){
+ shell.cp('-rf', ios_plist_project, temp);
+ var pls = copyArray(plist_els);
+ var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+ ios.uninstall(pls, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist'));
+ });
+ it('should not be used in an applicably old cordova-ios project', function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ var pls = copyArray(plist_els);
+ var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+ ios.uninstall(pls, dummy_id, temp, dummyplugin);
+ expect(spy).not.toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'));
+ });
it('should remove the <plugin> element in applicably new cordova-ios projects with old-style plugins using only <plugins-plist> elements', function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ var pls = copyArray(plist_only_els);
+ ios.uninstall(pls, plist_id, temp, plistplugin);
+ expect(fs.readFileSync(path.join(temp, 'SampleApp', 'config.xml'), 'utf-8')).toMatch(/<plugin name="OldSkewl"/gi);
});
});
@@ -377,12 +444,10 @@ describe('ios project handler', function() {
});
describe('of <asset> elements', function() {
- it('should call rm on specified asset', function() {
-
- });
- it('should call rm on the www/plugins/<plugin_id> folder', function() {
-
+ it('should call rm on specified asset',function(){
+
});
+ it('should call rm on the www/plugins/<plugin_id> folder');
});
describe('of <header-file> elements', function() {
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eb4fecc1/src/platforms/ios.js
----------------------------------------------------------------------
diff --git a/src/platforms/ios.js b/src/platforms/ios.js
index 70bc539..453e87d 100644
--- a/src/platforms/ios.js
+++ b/src/platforms/ios.js
@@ -98,7 +98,6 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables
var srcFile = path.resolve(plugin_dir, src);
var targetDir = path.resolve(pluginsDir, getRelativeDir(mod));
var destFile = path.resolve(targetDir, path.basename(src));
-
if (action == 'install') {
if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <source-file>');
if (fs.existsSync(destFile)) throw new Error('target destination "' + destFile + '" already exists');
@@ -106,10 +105,12 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables
shell.mkdir('-p', targetDir);
shell.cp(srcFile, destFile);
} else {
- xcodeproj.removeSourceFile(path.join('Plugins', path.basename(src)));
+ xcodeproj.removeSourceFile(path.join('Plugins', path.relative(pluginsDir, destFile)));
shell.rm('-rf', destFile);
- // TODO: is this right, should we check if dir is empty?
- shell.rm('-rf', targetDir);
+
+ if(fs.existsSync(targetDir) && fs.readdirSync(targetDir).length>0){
+ shell.rm('-rf', targetDir);
+ }
}
break;
case 'asset':
[2/3] git commit: Added ios uninstall tests and fixed up ios a bit to
get tests passing
Posted by ti...@apache.org.
Added ios uninstall tests and fixed up ios a bit to get tests passing
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/38531aff
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/38531aff
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/38531aff
Branch: refs/heads/master
Commit: 38531aff8ff4629decc62b64867cee3c2b99be66
Parents: eb4fecc
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Apr 29 15:17:54 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Apr 29 15:51:59 2013 -0700
----------------------------------------------------------------------
spec/platforms/ios.spec.js | 163 +++++++++++++++++++++++++++++---------
src/platforms/ios.js | 2 +-
2 files changed, 125 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/38531aff/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index 0b46d1c..187f640 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -195,7 +195,7 @@ describe('ios project handler', function() {
ios.install(headers, dummy_id, temp, dummyplugin, {});
expect(spy).toHaveBeenCalledWith(path.join('Plugins', 'DummyPluginCommand.h'));
});
- it('should call into xcodeproj\'s addHeaderFile appropriately when element a no target-dir', function() {
+ 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 = jasmine.createSpy();
spyOn(xcode, 'project').andReturn({
@@ -372,12 +372,6 @@ describe('ios project handler', function() {
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});
shell.cp('-rf', ios_config_xml_project, temp);
- var spy = jasmine.createSpy();
- spyOn(xcode, 'project').andReturn({
- parseSync:function(){},
- writeSync:function(){},
- removeSourceFile:function(){}
- });
var spy = spyOn(shell, 'rm');
ios.uninstall(source, dummy_id, temp, dummyplugin);
@@ -386,28 +380,16 @@ describe('ios project handler', function() {
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});
shell.cp('-rf', ios_config_xml_project, temp);
- var spy = jasmine.createSpy();
- spyOn(xcode, 'project').andReturn({
- parseSync:function(){},
- writeSync:function(){},
- removeSourceFile:function(){}
- });
-
+
var spy = spyOn(shell, 'rm');
ios.uninstall(source, dummy_id, temp, dummyplugin);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', '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});
- shell.cp('-rf', ios_config_xml_project, temp);
- var spy = jasmine.createSpy();
- spyOn(xcode, 'project').andReturn({
- parseSync:function(){},
- writeSync:function(){},
- removeSourceFile:function(){}
- });
-
+ shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(shell, 'rm');
+
ios.uninstall(source, dummy_id, temp, dummyplugin);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.m'));
});
@@ -418,51 +400,154 @@ describe('ios project handler', function() {
shell.cp('-rf', ios_plist_project, temp);
var pls = copyArray(plist_els);
var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+
ios.uninstall(pls, dummy_id, temp, dummyplugin);
expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist'));
});
it('should not be used in an applicably old cordova-ios project', function() {
shell.cp('-rf', ios_config_xml_project, temp);
var pls = copyArray(plist_els);
- var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+ var spy = spyOn(xml_helpers, 'parseElementtreeSync').andCallThrough();
ios.uninstall(pls, dummy_id, temp, dummyplugin);
- expect(spy).not.toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'));
+ expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'));
});
it('should remove the <plugin> element in applicably new cordova-ios projects with old-style plugins using only <plugins-plist> elements', function() {
shell.cp('-rf', ios_config_xml_project, temp);
var pls = copyArray(plist_only_els);
- ios.uninstall(pls, plist_id, temp, plistplugin);
- expect(fs.readFileSync(path.join(temp, 'SampleApp', 'config.xml'), 'utf-8')).toMatch(/<plugin name="OldSkewl"/gi);
+ //ios.install(pls, plist_id, temp, plistplugin, {});
+ var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+ ios.uninstall(pls, dummy_id, temp, plistplugin);
+ expect(fs.readFileSync(path.join(temp, 'SampleApp', 'config.xml'), 'utf-8')).not.toMatch(/<plugin name="OldSkewl"/gi);
});
});
-
+
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');
+ beforeEach(function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ });
+ it('should call xml_helpers\' pruneXML', function(){
+ var config = copyArray(dummy_configs);
+ // add an extra child element to avoid an if statement in ios.js
+ config[0]._children[1] = config[0]._children[0];
+
+ var spy = spyOn(xml_helpers, 'pruneXML').andReturn({config_path: ''});
+
+ ios.uninstall(config, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(jasmine.any(Object), dummy_configs[0]._children, '/widget/plugins');
+ });
+ it('should write the new config file out after successfully pruning', function(){
+ var config = copyArray(dummy_configs);
+ // add an extra child element to avoid an if statement in ios.js
+ config[0]._children[1] = config[0]._children[0];
+
+ var spyPrune = spyOn(xml_helpers, 'pruneXML').andCallThrough();
+ var spyWrite = spyOn(fs, 'writeFileSync');
+
+ ios.uninstall(config, dummy_id, temp, dummyplugin);
+ expect(spyPrune).toHaveBeenCalled();
+ expect(spyWrite).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'), jasmine.any(String));
+ });
});
describe('of <asset> elements', function() {
+ beforeEach(function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ });
it('should call rm on specified asset',function(){
-
+ var config = copyArray(assets);
+ var spy = spyOn(shell, 'rm');
+
+ ios.uninstall(config, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'dummyplugin.js'));
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'dummyplugin'));
+ });
+ it('should call rm on the www/plugins/<plugin_id> folder',function(){
+ var config = copyArray(assets);
+ var spy = spyOn(shell, 'rm');
+
+ ios.uninstall(config, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'plugins', dummy_id));
});
- it('should call rm on the www/plugins/<plugin_id> folder');
});
describe('of <header-file> elements', function() {
- it('should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir');
- it('should call into xcodeproj\'s removeHeaderFile appropriately when element a no target-dir');
- it('should rm the file from the right target location');
+ beforeEach(function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ });
+ it('should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function(){
+ var headers = copyArray(valid_headers).filter(function(s) { return s.attrib['target-dir'] == undefined});
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeHeaderFile:spy
+ });
+
+ ios.uninstall(headers, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(path.join('Plugins', '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 = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeHeaderFile:spy
+ });
+
+ ios.uninstall(headers, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(path.join('Plugins', '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.uninstall(headers, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', 'targetDir', 'TargetDirTest.h'));
+ });
});
describe('of <resource-file> elements', function() {
- it('should call into xcodeproj\'s removeResourceFile');
- it('should rm the file from the right target location');
+ beforeEach(function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ });
+ it('should call into xcodeproj\'s removeResourceFile', function(){
+ var resources = copyArray(valid_resources);
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeResourceFile:spy
+ });
+
+ ios.uninstall(resources, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
+ });
+ it('should rm the file from the right target location', function(){
+ var resources = copyArray(valid_resources);
+ var spy = spyOn(shell, 'rm');
+
+ ios.uninstall(resources, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Resources', 'DummyPlugin.bundle'));
+ });
});
describe('of <framework> elements', function() {
- it('should call into xcodeproj\'s removeFramework');
+ beforeEach(function() {
+ shell.cp('-rf', ios_config_xml_project, temp);
+ });
+ it('should call into xcodeproj\'s removeFramework' ,function() {
+ var frameworks = copyArray(valid_frameworks).filter(function(f) { return f.attrib.weak == undefined; });
+ var spy = jasmine.createSpy();
+ spyOn(xcode, 'project').andReturn({
+ parseSync:function(){},
+ writeSync:function(){},
+ removeFramework:spy
+ });
+
+ ios.uninstall(frameworks, dummy_id, temp, dummyplugin);
+ expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib'));
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/38531aff/src/platforms/ios.js
----------------------------------------------------------------------
diff --git a/src/platforms/ios.js b/src/platforms/ios.js
index 453e87d..eb655d4 100644
--- a/src/platforms/ios.js
+++ b/src/platforms/ios.js
@@ -136,7 +136,7 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables
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)));
+ xcodeproj.removeHeaderFile(path.join('Plugins', path.relative(pluginsDir, destFile)));
shell.rm('-rf', destFile);
// TODO: again.. is this right? same as source-file
shell.rm('-rf', targetDir);