You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/05/05 23:50:34 UTC
git commit: Merge xml-helpers from cli and plugman
Repository: cordova-lib
Updated Branches:
refs/heads/master c8910b972 -> b2e017888
Merge xml-helpers from cli and plugman
The files were almost identical. Changed all require() paths to use the
new files. Removed an unused function moveProjFile().
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/b2e01788
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/b2e01788
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/b2e01788
Branch: refs/heads/master
Commit: b2e01788830642cd34770cae60ea8d7b5596090e
Parents: c8910b9
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Mon May 5 17:47:58 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Mon May 5 17:47:58 2014 -0400
----------------------------------------------------------------------
.../metadata/android_parser.spec.js | 2 +-
.../metadata/blackberry_parser.spec.js | 2 +-
.../metadata/windows8_parser.spec.js | 2 +-
.../spec-cordova/metadata/wp7_parser.spec.js | 2 +-
.../spec-cordova/metadata/wp8_parser.spec.js | 2 +-
cordova-lib/spec-cordova/prepare.spec.js | 2 +-
cordova-lib/spec-cordova/xml-helpers.spec.js | 2 +-
cordova-lib/spec-plugman/fetch.spec.js | 2 +-
cordova-lib/spec-plugman/install.spec.js | 2 +-
.../platforms/amazon-fireos.spec.js | 2 +-
.../spec-plugman/platforms/android.spec.js | 2 +-
.../spec-plugman/platforms/blackberry10.spec.js | 2 +-
cordova-lib/spec-plugman/platforms/ios.spec.js | 2 +-
.../spec-plugman/platforms/windows8.spec.js | 2 +-
cordova-lib/spec-plugman/platforms/wp7.spec.js | 2 +-
cordova-lib/spec-plugman/platforms/wp8.spec.js | 2 +-
.../spec-plugman/util/config-changes.spec.js | 2 +-
cordova-lib/spec-plugman/util/csproj.spec.js | 2 +-
.../spec-plugman/util/dependencies.spec.js | 2 +-
cordova-lib/spec-plugman/util/plugins.spec.js | 2 +-
.../spec-plugman/util/xml-helpers.spec.js | 2 +-
cordova-lib/src/PluginInfo.js | 2 +-
cordova-lib/src/cordova/ConfigParser.js | 2 +-
.../cordova/metadata/amazon_fireos_parser.js | 2 +-
.../src/cordova/metadata/android_parser.js | 2 +-
.../src/cordova/metadata/ubuntu_parser.js | 2 +-
.../src/cordova/metadata/windows8_parser.js | 2 +-
cordova-lib/src/cordova/metadata/wp7_parser.js | 2 +-
cordova-lib/src/cordova/metadata/wp8_parser.js | 2 +-
cordova-lib/src/cordova/plugin_parser.js | 2 +-
cordova-lib/src/cordova/xml-helpers.js | 171 ----------------
cordova-lib/src/plugman/fetch.js | 2 +-
cordova-lib/src/plugman/install.js | 2 +-
.../src/plugman/platforms/amazon-fireos.js | 2 +-
cordova-lib/src/plugman/platforms/android.js | 2 +-
.../src/plugman/platforms/blackberry10.js | 2 +-
cordova-lib/src/plugman/platforms/firefoxos.js | 2 +-
cordova-lib/src/plugman/platforms/tizen.js | 2 +-
cordova-lib/src/plugman/platforms/ubuntu.js | 2 +-
cordova-lib/src/plugman/platforms/windows8.js | 2 +-
cordova-lib/src/plugman/platforms/wp7.js | 2 +-
cordova-lib/src/plugman/platforms/wp8.js | 2 +-
cordova-lib/src/plugman/prepare.js | 2 +-
cordova-lib/src/plugman/registry/manifest.js | 2 +-
cordova-lib/src/plugman/uninstall.js | 2 +-
cordova-lib/src/plugman/util/config-changes.js | 2 +-
cordova-lib/src/plugman/util/csproj.js | 2 +-
cordova-lib/src/plugman/util/dependencies.js | 2 +-
cordova-lib/src/plugman/util/plugins.js | 2 +-
cordova-lib/src/plugman/util/w8jsproj.js | 2 +-
cordova-lib/src/plugman/util/xml-helpers.js | 196 -------------------
cordova-lib/src/util/xml-helpers.js | 191 ++++++++++++++++++
52 files changed, 240 insertions(+), 416 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/metadata/android_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/android_parser.spec.js b/cordova-lib/spec-cordova/metadata/android_parser.spec.js
index 7d32dc9..33176de 100644
--- a/cordova-lib/spec-cordova/metadata/android_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/android_parser.spec.js
@@ -22,7 +22,7 @@ var platforms = require('../../src/cordova/platforms'),
shell = require('shelljs'),
fs = require('fs'),
et = require('elementtree'),
- xmlHelpers = require('../../src/cordova/xml-helpers'),
+ xmlHelpers = require('../../src/util/xml-helpers'),
Q = require('q'),
config = require('../../src/cordova/config'),
ConfigParser = require('../../src/cordova/ConfigParser'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js b/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
index bcba57c..37a0f34 100644
--- a/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
@@ -23,7 +23,7 @@ var platforms = require('../../src/cordova/platforms'),
shell = require('shelljs'),
fs = require('fs'),
et = require('elementtree'),
- xmlHelpers = require('../../src/cordova/xml-helpers'),
+ xmlHelpers = require('../../src/util/xml-helpers'),
Q = require('q'),
child_process = require('child_process'),
config = require('../../src/cordova/config'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js b/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js
index c8f4131..800efc7 100644
--- a/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js
@@ -22,7 +22,7 @@ var platforms = require('../../src/cordova/platforms'),
path = require('path'),
shell = require('shelljs'),
child_process = require('child_process'),
- xmlHelpers = require('../../src/cordova/xml-helpers'),
+ xmlHelpers = require('../../src/util/xml-helpers'),
et = require('elementtree'),
Q = require('q'),
fs = require('fs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/metadata/wp7_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/wp7_parser.spec.js b/cordova-lib/spec-cordova/metadata/wp7_parser.spec.js
index 165cd6b..2ba8061 100644
--- a/cordova-lib/spec-cordova/metadata/wp7_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/wp7_parser.spec.js
@@ -23,7 +23,7 @@ var platforms = require('../../src/cordova/platforms'),
shell = require('shelljs'),
fs = require('fs'),
et = require('elementtree'),
- xmlHelpers = require('../../src/cordova/xml-helpers'),
+ xmlHelpers = require('../../src/util/xml-helpers'),
Q = require('q'),
child_process = require('child_process'),
config = require('../../src/cordova/config'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js
index 810bb2c..9c2ddd2 100644
--- a/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js
@@ -23,7 +23,7 @@ var platforms = require('../../src/cordova/platforms'),
shell = require('shelljs'),
fs = require('fs'),
et = require('elementtree'),
- xmlHelpers = require('../../src/cordova/xml-helpers'),
+ xmlHelpers = require('../../src/util/xml-helpers'),
Q = require('q'),
child_process = require('child_process'),
config = require('../../src/cordova/config'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/prepare.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/prepare.spec.js b/cordova-lib/spec-cordova/prepare.spec.js
index a6c1138..18aff59 100644
--- a/cordova-lib/spec-cordova/prepare.spec.js
+++ b/cordova-lib/spec-cordova/prepare.spec.js
@@ -27,7 +27,7 @@ var cordova = require('../src/cordova/cordova'),
ConfigParser = require('../src/cordova/ConfigParser'),
platforms = require('../src/cordova/platforms'),
hooker = require('../src/cordova/hooker'),
- xmlHelpers = require('../src/cordova/xml-helpers'),
+ xmlHelpers = require('../src/util/xml-helpers'),
fixtures = path.join(__dirname, 'fixtures'),
et = require('elementtree'),
Q = require('q'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-cordova/xml-helpers.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/xml-helpers.spec.js b/cordova-lib/spec-cordova/xml-helpers.spec.js
index e7d209c..2f1d7ae 100644
--- a/cordova-lib/spec-cordova/xml-helpers.spec.js
+++ b/cordova-lib/spec-cordova/xml-helpers.spec.js
@@ -18,7 +18,7 @@
*/
var path = require('path')
- , xml_helpers = require('../src/cordova/xml-helpers')
+ , xml_helpers = require('../src/util/xml-helpers')
, et = require('elementtree')
, title = et.XML('<title>HELLO</title>')
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/fetch.spec.js b/cordova-lib/spec-plugman/fetch.spec.js
index 701dec9..3d43863 100644
--- a/cordova-lib/spec-plugman/fetch.spec.js
+++ b/cordova-lib/spec-plugman/fetch.spec.js
@@ -3,7 +3,7 @@ var fetch = require('../src/plugman/fetch'),
os = require('osenv'),
path = require('path'),
shell = require('shelljs'),
- xml_helpers = require('../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../src/util/xml-helpers'),
metadata = require('../src/plugman/util/metadata'),
temp = path.join(os.tmpdir(), 'plugman'),
test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install.spec.js b/cordova-lib/spec-plugman/install.spec.js
index 2c21a7c..97e2ee0 100644
--- a/cordova-lib/spec-plugman/install.spec.js
+++ b/cordova-lib/spec-plugman/install.spec.js
@@ -1,7 +1,7 @@
var install = require('../src/plugman/install'),
actions = require('../src/plugman/util/action-stack'),
config_changes = require('../src/plugman/util/config-changes'),
- xml_helpers = require('../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../src/util/xml-helpers'),
events = require('../src/plugman/events'),
plugman = require('../src/plugman/plugman'),
platforms = require('../src/plugman/platforms/common'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js b/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
index 7260220..c822926 100644
--- a/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
+++ b/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
@@ -8,7 +8,7 @@ var amazon_fireos = require('../../src/plugman/platforms/amazon-fireos'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'DummyPlugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'FaultyPlugin'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/android.spec.js b/cordova-lib/spec-plugman/platforms/android.spec.js
index b38c0f2..1bacc27 100644
--- a/cordova-lib/spec-plugman/platforms/android.spec.js
+++ b/cordova-lib/spec-plugman/platforms/android.spec.js
@@ -8,7 +8,7 @@ var android = require('../../src/plugman/platforms/android'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'DummyPlugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'FaultyPlugin'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/blackberry10.spec.js b/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
index a483abb..46003ff 100644
--- a/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
+++ b/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
@@ -8,7 +8,7 @@ var blackberry10 = require('../../src/plugman/platforms/blackberry10'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
plugins_module = require('../../src/plugman/util/plugins'),
blackberry10_project = path.join(__dirname, '..', 'projects', 'blackberry10', '*'),
plugins = {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/ios.spec.js b/cordova-lib/spec-plugman/platforms/ios.spec.js
index 49f889c..5bb1637 100644
--- a/cordova-lib/spec-plugman/platforms/ios.spec.js
+++ b/cordova-lib/spec-plugman/platforms/ios.spec.js
@@ -14,7 +14,7 @@ var ios = require('../../src/plugman/platforms/ios'),
ios_config_xml_project = path.join(__dirname, '..', 'projects', 'ios-config-xml', '*'),
ios_plist_project = path.join(__dirname, '..', 'projects', 'ios-plist', '*'),
ios_project = path.join(ios_config_xml_project, '..'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
variableplugin = path.join(__dirname, '..', 'plugins', 'VariablePlugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'FaultyPlugin'),
plistplugin = path.join(__dirname, '..', 'plugins', 'PluginsPlistOnly'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/windows8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows8.spec.js b/cordova-lib/spec-plugman/platforms/windows8.spec.js
index a56dcf1..29603c8 100644
--- a/cordova-lib/spec-plugman/platforms/windows8.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows8.spec.js
@@ -8,7 +8,7 @@ var windows8 = require('../../src/plugman/platforms/windows8'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'DummyPlugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'FaultyPlugin'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/wp7.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/wp7.spec.js b/cordova-lib/spec-plugman/platforms/wp7.spec.js
index cdf7cc7..ca57179 100644
--- a/cordova-lib/spec-plugman/platforms/wp7.spec.js
+++ b/cordova-lib/spec-plugman/platforms/wp7.spec.js
@@ -8,7 +8,7 @@ var wp7 = require('../../src/plugman/platforms/wp7'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'DummyPlugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'FaultyPlugin'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/platforms/wp8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/wp8.spec.js b/cordova-lib/spec-plugman/platforms/wp8.spec.js
index e09d7f7..81fb3fb 100644
--- a/cordova-lib/spec-plugman/platforms/wp8.spec.js
+++ b/cordova-lib/spec-plugman/platforms/wp8.spec.js
@@ -8,7 +8,7 @@ var wp8 = require('../../src/plugman/platforms/wp8'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'DummyPlugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'FaultyPlugin'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/config-changes.spec.js b/cordova-lib/spec-plugman/util/config-changes.spec.js
index 9a9aa41..8807163 100644
--- a/cordova-lib/spec-plugman/util/config-changes.spec.js
+++ b/cordova-lib/spec-plugman/util/config-changes.spec.js
@@ -2,7 +2,7 @@
/* global jasmine, describe, beforeEach, afterEach, it, spyOn, expect */
var configChanges = require('../../src/plugman/util/config-changes'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
ios_parser = require('../../src/plugman/platforms/ios'),
fs = require('fs'),
os = require('osenv'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/util/csproj.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/csproj.spec.js b/cordova-lib/spec-plugman/util/csproj.spec.js
index 8fd0006..36f3957 100644
--- a/cordova-lib/spec-plugman/util/csproj.spec.js
+++ b/cordova-lib/spec-plugman/util/csproj.spec.js
@@ -3,7 +3,7 @@ var csproj = require('../../src/plugman/util/csproj'),
os = require('osenv'),
et = require('elementtree'),
fs = require('fs'),
- xml_helpers = require('../../src/plugman/util/xml-helpers');
+ xml_helpers = require('../../src/util/xml-helpers');
var wp7_project = path.join(__dirname, '..', 'projects', 'wp7'),
wp8_project = path.join(__dirname, '..', 'projects', 'wp8'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/util/dependencies.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/dependencies.spec.js b/cordova-lib/spec-plugman/util/dependencies.spec.js
index a227861..ab6132a 100644
--- a/cordova-lib/spec-plugman/util/dependencies.spec.js
+++ b/cordova-lib/spec-plugman/util/dependencies.spec.js
@@ -1,5 +1,5 @@
var dependencies = require('../../src/plugman/util/dependencies'),
- xml_helpers = require('../../src/plugman/util/xml-helpers'),
+ xml_helpers = require('../../src/util/xml-helpers'),
path = require('path'),
config = require('../../src/plugman/util/config-changes');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/util/plugins.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/plugins.spec.js b/cordova-lib/spec-plugman/util/plugins.spec.js
index 4d0f719..98366ed 100644
--- a/cordova-lib/spec-plugman/util/plugins.spec.js
+++ b/cordova-lib/spec-plugman/util/plugins.spec.js
@@ -25,7 +25,7 @@ var http = require('http'),
shell = require('shelljs'),
child_process = require('child_process'),
plugins = require('../../src/plugman/util/plugins'),
- xml_helpers = require('../../src/plugman/util/xml-helpers');
+ xml_helpers = require('../../src/util/xml-helpers');
describe('plugins utility module', function(){
describe('clonePluginGitRepo', function(){
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/spec-plugman/util/xml-helpers.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/xml-helpers.spec.js b/cordova-lib/spec-plugman/util/xml-helpers.spec.js
index c968510..edcdedb 100644
--- a/cordova-lib/spec-plugman/util/xml-helpers.spec.js
+++ b/cordova-lib/spec-plugman/util/xml-helpers.spec.js
@@ -17,7 +17,7 @@
*/
var path = require('path')
- , xml_helpers = require('../../src/plugman/util/xml-helpers')
+ , xml_helpers = require('../../src/util/xml-helpers')
, et = require('elementtree')
, title = et.XML('<title>HELLO</title>')
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/PluginInfo.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/PluginInfo.js b/cordova-lib/src/PluginInfo.js
index 09cc517..4e7ce35 100644
--- a/cordova-lib/src/PluginInfo.js
+++ b/cordova-lib/src/PluginInfo.js
@@ -31,7 +31,7 @@ TODO (kamrik): refactor this to use no fs sync fnctions and return promises.
var path = require('path'),
fs = require('fs'),
_ = require('underscore'),
- xml_helpers = require('./cordova/xml-helpers');
+ xml_helpers = require('./util/xml-helpers');
// Exports
exports.PluginInfo = PluginInfo;
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/ConfigParser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/ConfigParser.js b/cordova-lib/src/cordova/ConfigParser.js
index aef36a3..262e75f 100644
--- a/cordova-lib/src/cordova/ConfigParser.js
+++ b/cordova-lib/src/cordova/ConfigParser.js
@@ -17,7 +17,7 @@
under the License.
*/
var et = require('elementtree'),
- xml= require('./xml-helpers'),
+ xml= require('../util/xml-helpers'),
CordovaError = require('../CordovaError'),
fs = require('fs');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js b/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
index 523c393..107e64e 100644
--- a/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
+++ b/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
@@ -18,7 +18,7 @@
*/
var fs = require('fs'),
path = require('path'),
- xml = require('../xml-helpers'),
+ xml = require('../../util/xml-helpers'),
util = require('../util'),
events = require('../events'),
shell = require('shelljs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/android_parser.js b/cordova-lib/src/cordova/metadata/android_parser.js
index e16c442..2a5e51e 100644
--- a/cordova-lib/src/cordova/metadata/android_parser.js
+++ b/cordova-lib/src/cordova/metadata/android_parser.js
@@ -18,7 +18,7 @@
*/
var fs = require('fs'),
path = require('path'),
- xml = require('../xml-helpers'),
+ xml = require('../../util/xml-helpers'),
util = require('../util'),
events = require('../events'),
shell = require('shelljs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/metadata/ubuntu_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/ubuntu_parser.js b/cordova-lib/src/cordova/metadata/ubuntu_parser.js
index 54612d9..1ced342 100644
--- a/cordova-lib/src/cordova/metadata/ubuntu_parser.js
+++ b/cordova-lib/src/cordova/metadata/ubuntu_parser.js
@@ -20,7 +20,7 @@
var fs = require('fs'),
path = require('path'),
et = require('elementtree'),
- xml = require('../xml-helpers'),
+ xml = require('../../util/xml-helpers'),
util = require('../util'),
events = require('../events'),
shell = require('shelljs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/windows8_parser.js b/cordova-lib/src/cordova/metadata/windows8_parser.js
index e4dde63..ccf1f0e 100644
--- a/cordova-lib/src/cordova/metadata/windows8_parser.js
+++ b/cordova-lib/src/cordova/metadata/windows8_parser.js
@@ -27,7 +27,7 @@ var fs = require('fs'),
child_process = require('child_process'),
ConfigParser = require('../ConfigParser'),
CordovaError = require('../../CordovaError'),
- xml = require('../xml-helpers'),
+ xml = require('../../util/xml-helpers'),
config = require('../config'),
hooker = require('../hooker');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/wp7_parser.js b/cordova-lib/src/cordova/metadata/wp7_parser.js
index dd16973..4b8dae1 100644
--- a/cordova-lib/src/cordova/metadata/wp7_parser.js
+++ b/cordova-lib/src/cordova/metadata/wp7_parser.js
@@ -19,7 +19,7 @@
var fs = require('fs'),
path = require('path'),
et = require('elementtree'),
- xml = require('../xml-helpers'),
+ xml = require('../../util/xml-helpers'),
util = require('../util'),
events = require('../events'),
shell = require('shelljs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/wp8_parser.js b/cordova-lib/src/cordova/metadata/wp8_parser.js
index 2eaf1b9..6e04df9 100644
--- a/cordova-lib/src/cordova/metadata/wp8_parser.js
+++ b/cordova-lib/src/cordova/metadata/wp8_parser.js
@@ -26,7 +26,7 @@ var fs = require('fs'),
Q = require('q'),
ConfigParser = require('../ConfigParser'),
CordovaError = require('../../CordovaError'),
- xml = require('../xml-helpers'),
+ xml = require('../../util/xml-helpers'),
config = require('../config'),
hooker = require('../hooker');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/plugin_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin_parser.js b/cordova-lib/src/cordova/plugin_parser.js
index d3099c0..d86536b 100644
--- a/cordova-lib/src/cordova/plugin_parser.js
+++ b/cordova-lib/src/cordova/plugin_parser.js
@@ -16,7 +16,7 @@
specific language governing permissions and limitations
under the License.
*/
-var xml = require('./xml-helpers'),
+var xml = require('../util/xml-helpers'),
fs = require('fs');
function plugin_parser(xmlPath) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/cordova/xml-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/xml-helpers.js b/cordova-lib/src/cordova/xml-helpers.js
deleted file mode 100644
index 70ec96b..0000000
--- a/cordova-lib/src/cordova/xml-helpers.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *
- * Copyright 2013 Anis Kadri
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/**
- * contains XML utility functions, some of which are specific to elementtree
- */
-
-var fs = require('fs')
- , path = require('path')
- , et = require('elementtree');
-
-module.exports = {
- // Returns a promise.
- moveProjFile: function(origFile, projPath) {
- var src = path.resolve(projPath, origFile)
- , dest = src.replace('.orig', '');
-
- var d = Q.defer();
- fs.createReadStream(src)
- .pipe(fs.createWriteStream(dest))
- .on('close', d.resolve)
- .on('error', d.reject);
- return d.promise;
- },
-
- // compare two et.XML nodes, see if they match
- // compares tagName, text, attributes and children (recursively)
- equalNodes: function(one, two) {
- if (one.tag != two.tag) {
- return false;
- } else if (one.text.trim() != two.text.trim()) {
- return false;
- } else if (one._children.length != two._children.length) {
- return false;
- }
-
- var oneAttribKeys = Object.keys(one.attrib),
- twoAttribKeys = Object.keys(two.attrib),
- i = 0, attribName;
-
- if (oneAttribKeys.length != twoAttribKeys.length) {
- return false;
- }
-
- for (i; i < oneAttribKeys.length; i++) {
- attribName = oneAttribKeys[i];
-
- if (one.attrib[attribName] != two.attrib[attribName]) {
- return false;
- }
- }
-
- for (i; i < one._children.length; i++) {
- if (!module.exports.equalNodes(one._children[i], two._children[i])) {
- return false;
- }
- }
-
- return true;
- },
-
- // adds node to doc at selector
- graftXML: function(doc, nodes, selector) {
- var parent = resolveParent(doc, selector);
- if (!parent) return false;
-
- nodes.forEach(function (node) {
- // check if child is unique first
- if (uniqueChild(node, parent)) {
- parent.append(node);
- }
- });
-
- return true;
- },
-
- // removes node from doc at selector
- pruneXML: function(doc, nodes, selector) {
- var parent = resolveParent(doc, selector);
- if (!parent) return false;
-
- nodes.forEach(function (node) {
- var matchingKid = null;
- if ((matchingKid = findChild(node, parent)) != null) {
- // stupid elementtree takes an index argument it doesn't use
- // and does not conform to the python lib
- parent.remove(0, matchingKid);
- }
- });
-
- return true;
- },
-
- parseElementtreeSync: function (filename) {
- var contents = fs.readFileSync(filename, 'utf-8');
- if(contents) {
- contents = contents.substring(contents.indexOf("<")); //Windows is the BOM
- }
- return new et.ElementTree(et.XML(contents));
- }
-};
-
-function findChild(node, parent) {
- var matchingKids = parent.findall(node.tag)
- , i, j;
-
- for (i = 0, j = matchingKids.length ; i < j ; i++) {
- if (module.exports.equalNodes(node, matchingKids[i])) {
- return matchingKids[i];
- }
- }
- return null;
-}
-
-function uniqueChild(node, parent) {
- var matchingKids = parent.findall(node.tag)
- , i = 0;
-
- if (matchingKids.length == 0) {
- return true;
- } else {
- for (i; i < matchingKids.length; i++) {
- if (module.exports.equalNodes(node, matchingKids[i])) {
- return false;
- }
- }
- return true;
- }
-}
-
-var ROOT = /^\/([^\/]*)/,
- ABSOLUTE = /^\/([^\/]*)\/(.*)/;
-function resolveParent(doc, selector) {
- var parent, tagName, subSelector;
-
- // handle absolute selector (which elementtree doesn't like)
- if (ROOT.test(selector)) {
- tagName = selector.match(ROOT)[1];
- // test for wildcard "any-tag" root selector
- if (tagName == '*' || tagName === doc._root.tag) {
- parent = doc._root;
-
- // could be an absolute path, but not selecting the root
- if (ABSOLUTE.test(selector)) {
- subSelector = selector.match(ABSOLUTE)[2];
- parent = parent.find(subSelector)
- }
- } else {
- return false;
- }
- } else {
- parent = doc.find(selector)
- }
- return parent;
-}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 8878808..318e90e 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -2,7 +2,7 @@ var shell = require('shelljs'),
fs = require('fs'),
url = require('url'),
plugins = require('./util/plugins'),
- xml_helpers = require('./util/xml-helpers'),
+ xml_helpers = require('../util/xml-helpers'),
events = require('./events'),
metadata = require('./util/metadata'),
path = require('path'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index 3ce1929..e91c65c 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -6,7 +6,7 @@ var path = require('path'),
child_process = require('child_process'),
semver = require('semver'),
config_changes = require('./util/config-changes'),
- xml_helpers = require('./util/xml-helpers'),
+ xml_helpers = require('../util/xml-helpers'),
Q = require('q'),
platform_modules = require('./platforms'),
os = require('os'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/amazon-fireos.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/amazon-fireos.js b/cordova-lib/src/plugman/platforms/amazon-fireos.js
index adfc847..444759b 100644
--- a/cordova-lib/src/plugman/platforms/amazon-fireos.js
+++ b/cordova-lib/src/plugman/platforms/amazon-fireos.js
@@ -21,7 +21,7 @@ var fs = require('fs') // use existsSync in 0.6.x
, path = require('path')
, common = require('./common')
, events = require('../events')
- , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
module.exports = {
www_dir:function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/android.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/android.js b/cordova-lib/src/plugman/platforms/android.js
index c323790..0147d08 100644
--- a/cordova-lib/src/plugman/platforms/android.js
+++ b/cordova-lib/src/plugman/platforms/android.js
@@ -21,7 +21,7 @@ var fs = require('fs') // use existsSync in 0.6.x
, path = require('path')
, common = require('./common')
, events = require('../events')
- , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
module.exports = {
www_dir:function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/blackberry10.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/blackberry10.js b/cordova-lib/src/plugman/platforms/blackberry10.js
index 9e370b6..b8a8488 100644
--- a/cordova-lib/src/plugman/platforms/blackberry10.js
+++ b/cordova-lib/src/plugman/platforms/blackberry10.js
@@ -21,7 +21,7 @@ var fs = require('fs') // use existsSync in 0.6.x
, path = require('path')
, common = require('./common')
, events = require('../events')
- , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
var TARGETS = ["device", "simulator"];
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/firefoxos.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/firefoxos.js b/cordova-lib/src/plugman/platforms/firefoxos.js
index efbeba9..9ea314d 100644
--- a/cordova-lib/src/plugman/platforms/firefoxos.js
+++ b/cordova-lib/src/plugman/platforms/firefoxos.js
@@ -2,7 +2,7 @@ var path = require('path')
, fs = require('fs')
, common = require('./common')
, events = require('../events')
- , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
module.exports = {
www_dir: function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/tizen.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/tizen.js b/cordova-lib/src/plugman/platforms/tizen.js
index efbeba9..9ea314d 100644
--- a/cordova-lib/src/plugman/platforms/tizen.js
+++ b/cordova-lib/src/plugman/platforms/tizen.js
@@ -2,7 +2,7 @@ var path = require('path')
, fs = require('fs')
, common = require('./common')
, events = require('../events')
- , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
module.exports = {
www_dir: function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ubuntu.js b/cordova-lib/src/plugman/platforms/ubuntu.js
index d04b774..33fea3b 100644
--- a/cordova-lib/src/plugman/platforms/ubuntu.js
+++ b/cordova-lib/src/plugman/platforms/ubuntu.js
@@ -30,7 +30,7 @@ function toCamelCase(str) {
var fs = require('fs')
, path = require('path')
, events = require('../events')
- , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
module.exports = {
www_dir:function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/windows8.js b/cordova-lib/src/plugman/platforms/windows8.js
index 523dc6e..ed6edaa 100644
--- a/cordova-lib/src/plugman/platforms/windows8.js
+++ b/cordova-lib/src/plugman/platforms/windows8.js
@@ -24,7 +24,7 @@ var common = require('./common'),
fs = require('fs'),
w8jsproj = require('../util/w8jsproj'),
events = require('../events'),
- xml_helpers = require('../util/xml-helpers');
+ xml_helpers = require('../../util/xml-helpers');
module.exports = {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/wp7.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/wp7.js b/cordova-lib/src/plugman/platforms/wp7.js
index e6a76d0..24da900 100644
--- a/cordova-lib/src/plugman/platforms/wp7.js
+++ b/cordova-lib/src/plugman/platforms/wp7.js
@@ -23,7 +23,7 @@ var common = require('./common'),
fs = require('fs'),
csproj = require('../util/csproj'),
events = require('../events'),
- xml_helpers = require('../util/xml-helpers');
+ xml_helpers = require('../../util/xml-helpers');
module.exports = {
www_dir:function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/platforms/wp8.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/wp8.js b/cordova-lib/src/plugman/platforms/wp8.js
index 1163b44..5af840f 100644
--- a/cordova-lib/src/plugman/platforms/wp8.js
+++ b/cordova-lib/src/plugman/platforms/wp8.js
@@ -23,7 +23,7 @@ var common = require('./common'),
fs = require('fs'),
csproj = require('../util/csproj'),
events = require('../events'),
- xml_helpers = require('../util/xml-helpers');
+ xml_helpers = require('../../util/xml-helpers');
module.exports = {
www_dir:function(project_dir) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js
index 504a710..bb7b0f9 100644
--- a/cordova-lib/src/plugman/prepare.js
+++ b/cordova-lib/src/plugman/prepare.js
@@ -22,7 +22,7 @@
var platform_modules = require('./platforms'),
path = require('path'),
config_changes = require('./util/config-changes'),
- xml_helpers = require('./util/xml-helpers'),
+ xml_helpers = require('../util/xml-helpers'),
wp7 = require('./platforms/wp7'),
wp8 = require('./platforms/wp8'),
windows8 = require('./platforms/windows8'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/registry/manifest.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/manifest.js b/cordova-lib/src/plugman/registry/manifest.js
index 54f74b6..09dd264 100644
--- a/cordova-lib/src/plugman/registry/manifest.js
+++ b/cordova-lib/src/plugman/registry/manifest.js
@@ -1,4 +1,4 @@
-var xml_helpers = require('../util/xml-helpers'),
+var xml_helpers = require('../../util/xml-helpers'),
path = require('path'),
Q = require('q'),
fs = require('fs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 49f1b16..fcb4d6b 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -4,7 +4,7 @@ var path = require('path'),
et = require('elementtree'),
shell= require('shelljs'),
config_changes = require('./util/config-changes'),
- xml_helpers = require('./util/xml-helpers'),
+ xml_helpers = require('../util/xml-helpers'),
action_stack = require('./util/action-stack'),
dependencies = require('./util/dependencies'),
underscore = require('underscore'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/util/config-changes.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/config-changes.js b/cordova-lib/src/plugman/util/config-changes.js
index 67adfb6..9ae767b 100644
--- a/cordova-lib/src/plugman/util/config-changes.js
+++ b/cordova-lib/src/plugman/util/config-changes.js
@@ -40,7 +40,7 @@ var fs = require('fs'),
xcode = require('xcode'),
et = require('elementtree'),
_ = require('underscore'),
- xml_helpers = require('./../util/xml-helpers'),
+ xml_helpers = require('../../util/xml-helpers'),
platforms = require('./../platforms'),
events = require('./../events'),
plist_helpers = require('./../util/plist-helpers');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/util/csproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/csproj.js b/cordova-lib/src/plugman/util/csproj.js
index 1024878..f1eeb72 100644
--- a/cordova-lib/src/plugman/util/csproj.js
+++ b/cordova-lib/src/plugman/util/csproj.js
@@ -1,4 +1,4 @@
-var xml_helpers = require('./xml-helpers'),
+var xml_helpers = require('../../util/xml-helpers'),
et = require('elementtree'),
fs = require('fs'),
path = require('path');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/util/dependencies.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/dependencies.js b/cordova-lib/src/plugman/util/dependencies.js
index 4ef7fc9..0829df1 100644
--- a/cordova-lib/src/plugman/util/dependencies.js
+++ b/cordova-lib/src/plugman/util/dependencies.js
@@ -4,7 +4,7 @@ var dep_graph = require('dep-graph'),
plugman = require('../plugman'),
config_changes = require('./config-changes'),
underscore = require('underscore'),
- xml_helpers = require('./xml-helpers'),
+ xml_helpers = require('../../util/xml-helpers'),
package;
module.exports = package = {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/util/plugins.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/plugins.js b/cordova-lib/src/plugman/util/plugins.js
index 5a5d14a..348180d 100644
--- a/cordova-lib/src/plugman/util/plugins.js
+++ b/cordova-lib/src/plugman/util/plugins.js
@@ -25,7 +25,7 @@ var http = require('http'),
shell = require('shelljs'),
child_process = require('child_process'),
Q = require('q'),
- xml_helpers = require('./xml-helpers'),
+ xml_helpers = require('../../util/xml-helpers'),
events = require('../events'),
tmp_dir;
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/util/w8jsproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/w8jsproj.js b/cordova-lib/src/plugman/util/w8jsproj.js
index 903a214..9011f48 100644
--- a/cordova-lib/src/plugman/util/w8jsproj.js
+++ b/cordova-lib/src/plugman/util/w8jsproj.js
@@ -3,7 +3,7 @@
*/
-var xml_helpers = require('./xml-helpers'),
+var xml_helpers = require('../../util/xml-helpers'),
et = require('elementtree'),
fs = require('fs'),
shell = require('shelljs'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/plugman/util/xml-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/xml-helpers.js b/cordova-lib/src/plugman/util/xml-helpers.js
deleted file mode 100644
index 601ed4d..0000000
--- a/cordova-lib/src/plugman/util/xml-helpers.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- * Copyright 2013 Anis Kadri
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/**
- * contains XML utility functions, some of which are specific to elementtree
- */
-
-var fs = require('fs')
- , path = require('path')
- , _ = require('underscore')
- , et = require('elementtree');
-
-module.exports = {
- moveProjFile: function(origFile, projPath, callback) {
- var src = path.resolve(projPath, origFile)
- , dest = src.replace('.orig', '');
-
- fs.createReadStream(src)
- .pipe(fs.createWriteStream(dest))
- .on('close', callback);
- },
-
- // compare two et.XML nodes, see if they match
- // compares tagName, text, attributes and children (recursively)
- equalNodes: function(one, two) {
- if (one.tag != two.tag) {
- return false;
- } else if (one.text.trim() != two.text.trim()) {
- return false;
- } else if (one._children.length != two._children.length) {
- return false;
- }
-
- var oneAttribKeys = Object.keys(one.attrib),
- twoAttribKeys = Object.keys(two.attrib),
- i = 0, attribName;
-
- if (oneAttribKeys.length != twoAttribKeys.length) {
- return false;
- }
-
- for (i; i < oneAttribKeys.length; i++) {
- attribName = oneAttribKeys[i];
-
- if (one.attrib[attribName] != two.attrib[attribName]) {
- return false;
- }
- }
-
- for (i; i < one._children.length; i++) {
- if (!module.exports.equalNodes(one._children[i], two._children[i])) {
- return false;
- }
- }
-
- return true;
- },
-
- // adds node to doc at selector, creating parent if it doesn't exist
- graftXML: function(doc, nodes, selector, after) {
- var parent = resolveParent(doc, selector);
- if (!parent) {
- //Try to create the parent recursively if necessary
- try {
- var parentToCreate = et.XML("<" + path.basename(selector) + ">"),
- parentSelector = path.dirname(selector);
-
- this.graftXML(doc, [parentToCreate], parentSelector);
- } catch (e) {
- return false;
- }
- parent = resolveParent(doc, selector);
- if (!parent) return false;
- }
-
- nodes.forEach(function (node) {
- // check if child is unique first
- if (uniqueChild(node, parent)) {
- var children = parent.getchildren();
- var insertIdx = after ? findInsertIdx(children, after) : children.length;
-
- //TODO: replace with parent.insert after the bug in ElementTree is fixed
- parent.getchildren().splice(insertIdx, 0, node);
- }
- });
-
- return true;
- },
-
- // removes node from doc at selector
- pruneXML: function(doc, nodes, selector) {
- var parent = resolveParent(doc, selector);
- if (!parent) return false;
-
- nodes.forEach(function (node) {
- var matchingKid = null;
- if ((matchingKid = findChild(node, parent)) != null) {
- // stupid elementtree takes an index argument it doesn't use
- // and does not conform to the python lib
- parent.remove(0, matchingKid);
- }
- });
-
- return true;
- },
-
- parseElementtreeSync: function (filename) {
- var contents = fs.readFileSync(filename, 'utf-8').replace("\ufeff", "");;
- return new et.ElementTree(et.XML(contents));
- }
-};
-
-function findChild(node, parent) {
- var matchingKids = parent.findall(node.tag)
- , i, j;
-
- for (i = 0, j = matchingKids.length ; i < j ; i++) {
- if (module.exports.equalNodes(node, matchingKids[i])) {
- return matchingKids[i];
- }
- }
- return null;
-}
-
-function uniqueChild(node, parent) {
- var matchingKids = parent.findall(node.tag)
- , i = 0;
-
- if (matchingKids.length == 0) {
- return true;
- } else {
- for (i; i < matchingKids.length; i++) {
- if (module.exports.equalNodes(node, matchingKids[i])) {
- return false;
- }
- }
- return true;
- }
-}
-
-var ROOT = /^\/([^\/]*)/,
- ABSOLUTE = /^\/([^\/]*)\/(.*)/;
-function resolveParent(doc, selector) {
- var parent, tagName, subSelector;
-
- // handle absolute selector (which elementtree doesn't like)
- if (ROOT.test(selector)) {
- tagName = selector.match(ROOT)[1];
- // test for wildcard "any-tag" root selector
- if (tagName == '*' || tagName === doc._root.tag) {
- parent = doc._root;
-
- // could be an absolute path, but not selecting the root
- if (ABSOLUTE.test(selector)) {
- subSelector = selector.match(ABSOLUTE)[2];
- parent = parent.find(subSelector)
- }
- } else {
- return false;
- }
- } else {
- parent = doc.find(selector)
- }
- return parent;
-}
-
-// Find the index at which to insert an entry. After is a ;-separated priority list
-// of tags after which the insertion should be made. E.g. If we need to
-// insert an element C, and the rule is that the order of children has to be
-// As, Bs, Cs. After will be equal to "C;B;A".
-
-function findInsertIdx(children, after) {
- var childrenTags = children.map(function(child) { return child.tag; });
- var afters = after.split(";");
- var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); });
- var foundIndex = _.find(afterIndexes, function(index) { return index != -1; });
-
- //add to the beginning if no matching nodes are found
- return typeof foundIndex === 'undefined' ? 0 : foundIndex+1;
-}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b2e01788/cordova-lib/src/util/xml-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/xml-helpers.js b/cordova-lib/src/util/xml-helpers.js
new file mode 100644
index 0000000..6371b2a
--- /dev/null
+++ b/cordova-lib/src/util/xml-helpers.js
@@ -0,0 +1,191 @@
+/*
+ *
+ * Copyright 2013 Anis Kadri
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+/**
+ * contains XML utility functions, some of which are specific to elementtree
+ */
+
+var fs = require('fs')
+ , path = require('path')
+ , _ = require('underscore')
+ , et = require('elementtree');
+
+module.exports = {
+ // compare two et.XML nodes, see if they match
+ // compares tagName, text, attributes and children (recursively)
+ equalNodes: function(one, two) {
+ if (one.tag != two.tag) {
+ return false;
+ } else if (one.text.trim() != two.text.trim()) {
+ return false;
+ } else if (one._children.length != two._children.length) {
+ return false;
+ }
+
+ var oneAttribKeys = Object.keys(one.attrib),
+ twoAttribKeys = Object.keys(two.attrib),
+ i = 0, attribName;
+
+ if (oneAttribKeys.length != twoAttribKeys.length) {
+ return false;
+ }
+
+ for (i; i < oneAttribKeys.length; i++) {
+ attribName = oneAttribKeys[i];
+
+ if (one.attrib[attribName] != two.attrib[attribName]) {
+ return false;
+ }
+ }
+
+ for (i; i < one._children.length; i++) {
+ if (!module.exports.equalNodes(one._children[i], two._children[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ // adds node to doc at selector, creating parent if it doesn't exist
+ graftXML: function(doc, nodes, selector, after) {
+ var parent = resolveParent(doc, selector);
+ if (!parent) {
+ //Try to create the parent recursively if necessary
+ try {
+ var parentToCreate = et.XML("<" + path.basename(selector) + ">"),
+ parentSelector = path.dirname(selector);
+
+ this.graftXML(doc, [parentToCreate], parentSelector);
+ } catch (e) {
+ return false;
+ }
+ parent = resolveParent(doc, selector);
+ if (!parent) return false;
+ }
+
+ nodes.forEach(function (node) {
+ // check if child is unique first
+ if (uniqueChild(node, parent)) {
+ var children = parent.getchildren();
+ var insertIdx = after ? findInsertIdx(children, after) : children.length;
+
+ //TODO: replace with parent.insert after the bug in ElementTree is fixed
+ parent.getchildren().splice(insertIdx, 0, node);
+ }
+ });
+
+ return true;
+ },
+
+ // removes node from doc at selector
+ pruneXML: function(doc, nodes, selector) {
+ var parent = resolveParent(doc, selector);
+ if (!parent) return false;
+
+ nodes.forEach(function (node) {
+ var matchingKid = null;
+ if ((matchingKid = findChild(node, parent)) != null) {
+ // stupid elementtree takes an index argument it doesn't use
+ // and does not conform to the python lib
+ parent.remove(0, matchingKid);
+ }
+ });
+
+ return true;
+ },
+
+ parseElementtreeSync: function (filename) {
+ var contents = fs.readFileSync(filename, 'utf-8');
+ if(contents) {
+ //Windows is the BOM. Skip the Byte Order Mark.
+ contents = contents.substring(contents.indexOf("<"));
+ }
+ return new et.ElementTree(et.XML(contents));
+ }
+};
+
+function findChild(node, parent) {
+ var matchingKids = parent.findall(node.tag)
+ , i, j;
+
+ for (i = 0, j = matchingKids.length ; i < j ; i++) {
+ if (module.exports.equalNodes(node, matchingKids[i])) {
+ return matchingKids[i];
+ }
+ }
+ return null;
+}
+
+function uniqueChild(node, parent) {
+ var matchingKids = parent.findall(node.tag)
+ , i = 0;
+
+ if (matchingKids.length == 0) {
+ return true;
+ } else {
+ for (i; i < matchingKids.length; i++) {
+ if (module.exports.equalNodes(node, matchingKids[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+var ROOT = /^\/([^\/]*)/,
+ ABSOLUTE = /^\/([^\/]*)\/(.*)/;
+
+function resolveParent(doc, selector) {
+ var parent, tagName, subSelector;
+
+ // handle absolute selector (which elementtree doesn't like)
+ if (ROOT.test(selector)) {
+ tagName = selector.match(ROOT)[1];
+ // test for wildcard "any-tag" root selector
+ if (tagName == '*' || tagName === doc._root.tag) {
+ parent = doc._root;
+
+ // could be an absolute path, but not selecting the root
+ if (ABSOLUTE.test(selector)) {
+ subSelector = selector.match(ABSOLUTE)[2];
+ parent = parent.find(subSelector)
+ }
+ } else {
+ return false;
+ }
+ } else {
+ parent = doc.find(selector)
+ }
+ return parent;
+}
+
+// Find the index at which to insert an entry. After is a ;-separated priority list
+// of tags after which the insertion should be made. E.g. If we need to
+// insert an element C, and the rule is that the order of children has to be
+// As, Bs, Cs. After will be equal to "C;B;A".
+function findInsertIdx(children, after) {
+ var childrenTags = children.map(function(child) { return child.tag; });
+ var afters = after.split(";");
+ var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); });
+ var foundIndex = _.find(afterIndexes, function(index) { return index != -1; });
+
+ //add to the beginning if no matching nodes are found
+ return typeof foundIndex === 'undefined' ? 0 : foundIndex+1;
+}