cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [14/14] git commit: Configurable target version for store and phone targets.
Date Fri, 08 Aug 2014 23:04:39 GMT
Configurable target version for store and phone targets.

<preference name="windows-target-version" value="8.0" />
<preference name="windows-phone-target-version" value="8.1" />


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

Branch: refs/heads/master
Commit: 94dec04aa37578ced49feeaf169479e37e4ed057
Parents: f6cc125
Author: sgrebnov <v-segreb@microsoft.com>
Authored: Fri Aug 8 19:35:27 2014 +0400
Committer: sgrebnov <v-segreb@microsoft.com>
Committed: Fri Aug 8 19:35:27 2014 +0400

----------------------------------------------------------------------
 windows/bin/check_reqs                          |   16 +-
 windows/bin/create                              |   11 +-
 windows/bin/lib/check_reqs.js                   |   22 +-
 windows/bin/lib/create.js                       |    8 +-
 windows/bin/lib/update.js                       |   41 +-
 windows/bin/update                              |    4 +-
 windows/template/CordovaApp.Store80.jsproj      |    1 -
 windows/template/MyTemplate.vstemplate          |   62 --
 windows/template/config.xml                     |    2 +
 windows/template/cordova/build                  |   10 +-
 windows/template/cordova/clean                  |   13 +-
 .../cordova/lib/ApplyPlatformConfig.ps1         |    2 +-
 windows/template/cordova/lib/ConfigParser.js    |  206 ++++
 windows/template/cordova/lib/MSBuildTools.js    |   49 +
 windows/template/cordova/lib/build.js           |  181 +++-
 windows/template/cordova/lib/clean.js           |    7 +-
 windows/template/cordova/lib/run.js             |   32 +-
 windows/template/cordova/lib/utils.js           |   18 +-
 windows/template/cordova/log.bat                |    2 +-
 .../cordova/node_modules/elementtree/.npmignore |    1 +
 .../node_modules/elementtree/.travis.yml        |   10 +
 .../cordova/node_modules/elementtree/CHANGES.md |   34 +
 .../node_modules/elementtree/LICENSE.txt        |  203 ++++
 .../cordova/node_modules/elementtree/Makefile   |   21 +
 .../cordova/node_modules/elementtree/NOTICE     |    5 +
 .../cordova/node_modules/elementtree/README.md  |   27 +
 .../node_modules/elementtree/lib/constants.js   |   20 +
 .../node_modules/elementtree/lib/elementpath.js |  343 ++++++
 .../node_modules/elementtree/lib/elementtree.js |  598 +++++++++++
 .../node_modules/elementtree/lib/errors.js      |   31 +
 .../node_modules/elementtree/lib/parser.js      |   33 +
 .../elementtree/lib/parsers/index.js            |    1 +
 .../node_modules/elementtree/lib/parsers/sax.js |   56 +
 .../node_modules/elementtree/lib/sprintf.js     |   86 ++
 .../node_modules/elementtree/lib/treebuilder.js |   60 ++
 .../node_modules/elementtree/lib/utils.js       |   72 ++
 .../elementtree/node_modules/sax/AUTHORS        |    9 +
 .../elementtree/node_modules/sax/LICENSE        |   23 +
 .../elementtree/node_modules/sax/README.md      |  213 ++++
 .../elementtree/node_modules/sax/lib/sax.js     | 1006 ++++++++++++++++++
 .../elementtree/node_modules/sax/package.json   |   64 ++
 .../node_modules/elementtree/package.json       |   59 +
 .../node_modules/shelljs/.documentup.json       |    6 +
 .../cordova/node_modules/shelljs/.jshintrc      |    7 +
 .../cordova/node_modules/shelljs/.npmignore     |    2 +
 .../cordova/node_modules/shelljs/.travis.yml    |    5 +
 .../cordova/node_modules/shelljs/LICENSE        |   26 +
 .../cordova/node_modules/shelljs/README.md      |  569 ++++++++++
 .../cordova/node_modules/shelljs/bin/shjs       |   51 +
 .../cordova/node_modules/shelljs/global.js      |    3 +
 .../cordova/node_modules/shelljs/make.js        |   47 +
 .../cordova/node_modules/shelljs/package.json   |   47 +
 .../shelljs/scripts/generate-docs.js            |   21 +
 .../node_modules/shelljs/scripts/run-tests.js   |   50 +
 .../cordova/node_modules/shelljs/shell.js       |  157 +++
 .../cordova/node_modules/shelljs/src/cat.js     |   43 +
 .../cordova/node_modules/shelljs/src/cd.js      |   19 +
 .../cordova/node_modules/shelljs/src/chmod.js   |  208 ++++
 .../cordova/node_modules/shelljs/src/common.js  |  203 ++++
 .../cordova/node_modules/shelljs/src/cp.js      |  201 ++++
 .../cordova/node_modules/shelljs/src/dirs.js    |  191 ++++
 .../cordova/node_modules/shelljs/src/echo.js    |   20 +
 .../cordova/node_modules/shelljs/src/error.js   |   10 +
 .../cordova/node_modules/shelljs/src/exec.js    |  181 ++++
 .../cordova/node_modules/shelljs/src/find.js    |   51 +
 .../cordova/node_modules/shelljs/src/grep.js    |   52 +
 .../cordova/node_modules/shelljs/src/ln.js      |   53 +
 .../cordova/node_modules/shelljs/src/ls.js      |  126 +++
 .../cordova/node_modules/shelljs/src/mkdir.js   |   68 ++
 .../cordova/node_modules/shelljs/src/mv.js      |   80 ++
 .../cordova/node_modules/shelljs/src/popd.js    |    1 +
 .../cordova/node_modules/shelljs/src/pushd.js   |    1 +
 .../cordova/node_modules/shelljs/src/pwd.js     |   11 +
 .../cordova/node_modules/shelljs/src/rm.js      |  145 +++
 .../cordova/node_modules/shelljs/src/sed.js     |   43 +
 .../cordova/node_modules/shelljs/src/tempdir.js |   56 +
 .../cordova/node_modules/shelljs/src/test.js    |   85 ++
 .../cordova/node_modules/shelljs/src/to.js      |   29 +
 .../cordova/node_modules/shelljs/src/toEnd.js   |   29 +
 .../cordova/node_modules/shelljs/src/which.js   |   83 ++
 windows/template/cordova/run                    |    6 +-
 81 files changed, 6460 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/bin/check_reqs
----------------------------------------------------------------------
diff --git a/windows/bin/check_reqs b/windows/bin/check_reqs
index 19b5c80..93e29bb 100644
--- a/windows/bin/check_reqs
+++ b/windows/bin/check_reqs
@@ -22,13 +22,13 @@
 var check_reqs = require('./lib/check_reqs');
 
 // check for help flag
-if (process.argv[2] == '--help' || process.argv[2] == '/?' || process.argv[2] == '-h' ||
-            process.argv[2] == 'help' || process.argv[2] == '-help' || process.argv[2] == '/help') {
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
     check_reqs.help();
 } else {
-    check_reqs.run().done(function success(msbuild) {
-        console.log('Found msbuild ver.', msbuild.version, 'at', msbuild.path);
-    }, function (err) {
-        console.error('Failed to check requirements due to', err);
-    });
-}
+  check_reqs.run().done(function success(msbuild) {
+      console.log('Environment is supported; found MSBuild Tools version ' + msbuild.version + ' at ' + msbuild.path);
+  }, function (err) {
+      console.error('Failed to check requirements due to', err);
+      process.exit(2);
+  });
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/bin/create
----------------------------------------------------------------------
diff --git a/windows/bin/create b/windows/bin/create
index 3869d8b..a687b3b 100644
--- a/windows/bin/create
+++ b/windows/bin/create
@@ -28,12 +28,11 @@
 
 var create = require('./lib/create');
 
-// check for help flag
-if (process.argv[2] == '--help' || process.argv[2] == '/?' || process.argv[2] == '-h' ||
-            process.argv[2] == 'help' || process.argv[2] == '-help' || process.argv[2] == '/help') {
-    check_reqs.help();
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
+    create.help();
 } else {
     create.run(process.argv).done(null, function (err) {
-        console.error('Failed to check requirements due to', err);
+        console.error('Failed to create project due to', err);
+        process.exit(2);
     });
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/windows/bin/lib/check_reqs.js b/windows/bin/lib/check_reqs.js
index 1335b20..0ce0f1f 100644
--- a/windows/bin/lib/check_reqs.js
+++ b/windows/bin/lib/check_reqs.js
@@ -19,23 +19,17 @@
 
 var Q     = require('Q'),
     os    = require('os'),
-    utils = require('../../template/cordova/lib/utils');
-
-module.exports.help = function () {
-    Log("Usage: [ check_reqs | node check_reqs ]");
-    Log("examples:");
-    Log("    cscript C:\\Users\\anonymous\\cordova-windows\\windows8\\bin\\check_reqs.bat");
-    Log("    CordovaWindowsPhone\\bin\\check_reqs");
-};
+    MSBuildTools = require('../../template/cordova/lib/MSBuildTools');
 
 module.exports.run = function () {
     if (os.platform() != 'win32'){
       // Build Universal windows apps available for windows platform only, so we reject on others platforms
-        return Q.reject(
-            "ERROR: Cordova tooling for Windows 8 requires Windows 8 Professional with the 'msbuild' command\n" +
-            "in the PATH environment variable as well as having .NET Framework 4.0 (from WP SDK's)"
-        );
+        return Q.reject("ERROR: Cordova tooling for Windows requires Windows OS");
     }
-    // Check for MSBuild available
-    return utils.getMSBuild();
+    // Check whther MSBuild Tools are available
+    return MSBuildTools.findAvailableVersion();
+};
+
+module.exports.help = function () {
+    console.log("Usage: check_reqs or node check_reqs");
 };

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/windows/bin/lib/create.js b/windows/bin/lib/create.js
index 8e00eff..31941b8 100644
--- a/windows/bin/lib/create.js
+++ b/windows/bin/lib/create.js
@@ -38,7 +38,8 @@ module.exports.run = function (argv) {
     var packageName = args.argv.remain[1] || "Cordova.Example",
         appName     = args.argv.remain[2] || "CordovaAppProj",
         safeAppName = appName.replace(/(\.\s|\s\.|\s+|\.+)/g, '_'),
-        guid        = args['guid'] || uuid.v1();
+        guid        = args['guid'] || uuid.v1(),
+        root        = path.join(__dirname, '..', '..');
 
     console.log("Creating Cordova Windows Project:");
     console.log("\tApp Name  : " + appName);
@@ -47,7 +48,10 @@ module.exports.run = function (argv) {
 
     // Copy the template source files to the new destination
     console.log('Copying template to ' + projectPath);
-    shell.cp("-rf", path.join(__dirname, '..', '..', 'template', '*'), projectPath);
+    shell.cp("-rf", path.join(root, 'template', '*'), projectPath);
+
+    // Copy our unique VERSION file, so peeps can tell what version this project was created from.
+    shell.cp("-rf", path.join(root, 'VERSION'), projectPath);
 
     // replace specific values in manifests' templates
     ["package.store.appxmanifest", "package.store80.appxmanifest", "package.phone.appxmanifest"].forEach(function (file) {

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/bin/lib/update.js
----------------------------------------------------------------------
diff --git a/windows/bin/lib/update.js b/windows/bin/lib/update.js
index 09ae004..cb1a26a 100644
--- a/windows/bin/lib/update.js
+++ b/windows/bin/lib/update.js
@@ -19,11 +19,13 @@
 
 var Q      = require('Q'),
     fs     = require('fs'),
+    path   = require('path'),
+    shell   = require('shelljs'),
     create = require('./create');
 
 // returns package metadata from config.xml with fields 'namespace' and 'name'
-function extractMetadata(path) {
-    if (fs.existsSync(path.join(path, 'config.xml'))){
+function extractMetadata(projectPath) {
+    if (!fs.existsSync(path.join(projectPath, 'config.xml'))){
         return Q.reject('config.xml does not exist');
     }
 
@@ -33,40 +35,35 @@ function extractMetadata(path) {
     };
 
     // TODO: read real values from config.xml
-    //var config = read(path + '/config.xml').split('\n');
-    //for (line in config) {
-        // in case of cli all values will be updated by cli for you
-        // but the script could be used w/o cli so we should correctly populate meta
-    //}
+
+    // in case of Cordova CLI all values will be automatically updated by cli for you
+    // but the script could be used w/o CLI so we should correctly populate meta
 
     return Q.resolve(meta);
 }
 
 module.exports.help = function () {
-    Log("WARNING : Make sure to back up your project before updating!");
-    Log("Usage: update Path-To-Project ");
-    Log("    Path-To-Old-Project : The path the project you would like to update.");
-    Log("examples:");
-    Log("    update C:\\Users\\anonymous\\Desktop\\MyProject");
+    console.log("WARNING : Make sure to back up your project before updating!");
+    console.log("Usage: update PathToProject ");
+    console.log("    PathToProject : The path the project you would like to update.");
+    console.log("examples:");
+    console.log("    update C:\\Users\\anonymous\\Desktop\\MyProject");
 };
 
 // updates the cordova.js in project along with the cordova tooling.
 module.exports.run = function (argv) {
-    var projectpath = argv[2];
-    if (!fs.existsSync(projectpath)){
+    var projectPath = argv[2];
+    if (!fs.existsSync(projectPath)){
         // if specified project path is not valid then reject promise
         Q.reject("The given path to the project does not exist." +
             " Please provide a path to the project you would like to update.");
     }
 
-    return extractMetadata(projectpath).then(function (metadata) {
-        // this could be used to automatically produce correct folder name under cli
-        // var projectpath = path.replace(/platforms\\windows8$/, 'platforms\\windows')
-        shell.rm('-rf', projectpath);
+    return extractMetadata(projectPath).then(function (metadata) {
+        shell.rm('-rf', projectPath);
+
         // setup args for create.run which requires process.argv-like array
-        [metadata.namespace, metadata.name].forEach(function (arg) {
-            argv.push(arg);
-        });
-        return create.run(argv);
+        var createArgs = argv.concat([metadata.namespace, metadata.name]);
+        return create.run(createArgs);
     });
 };
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/bin/update
----------------------------------------------------------------------
diff --git a/windows/bin/update b/windows/bin/update
index dc23c76..f3e8287 100644
--- a/windows/bin/update
+++ b/windows/bin/update
@@ -22,13 +22,13 @@
 var update = require('./lib/update');
 
 // check for help flag
-if (process.argv[2] == '--help' || process.argv[2] == '/?' || process.argv[2] == '-h' ||
-            process.argv[2] == 'help' || process.argv[2] == '-help' || process.argv[2] == '/help') {
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
     update.help();
 } else {
     update.run(process.argv).done(function () {
         console.log('Successfully updated windows project.');
     }, function (err) {
         console.error('Failed to check requirements due to', err);
+        process.exit(2);
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/CordovaApp.Store80.jsproj
----------------------------------------------------------------------
diff --git a/windows/template/CordovaApp.Store80.jsproj b/windows/template/CordovaApp.Store80.jsproj
index 075d999..e798fc0 100644
--- a/windows/template/CordovaApp.Store80.jsproj
+++ b/windows/template/CordovaApp.Store80.jsproj
@@ -88,7 +88,6 @@
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
   <PropertyGroup>
     <PreBuildEvent>
-      Powershell -ExecutionPolicy RemoteSigned Unblock-File '..\..\..\..\cordova\lib\ApplyPlatformConfig.ps1'; Powershell -File '..\..\..\..\cordova\lib\ApplyPlatformConfig.ps1' '..\..\..\..\';
     </PreBuildEvent>
   </PropertyGroup>
 </Project>

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/MyTemplate.vstemplate
----------------------------------------------------------------------
diff --git a/windows/template/MyTemplate.vstemplate b/windows/template/MyTemplate.vstemplate
deleted file mode 100644
index 362bbe3..0000000
--- a/windows/template/MyTemplate.vstemplate
+++ /dev/null
@@ -1,62 +0,0 @@
-<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
-<!--
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you 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.
--->
-  <TemplateData>
-    <Name>CordovaAppWin8</Name>
-    <Description>CordovaAppWin8</Description>
-    <ProjectType>JavaScript</ProjectType>
-    <ProjectSubType>
-    </ProjectSubType>
-    <SortOrder>1000</SortOrder>
-    <CreateNewFolder>true</CreateNewFolder>
-    <DefaultName>CordovaAppWin8</DefaultName>
-    <ProvideDefaultName>true</ProvideDefaultName>
-    <LocationField>Enabled</LocationField>
-    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
-    <Icon>__TemplateIcon.ico</Icon>
-  </TemplateData>
-  <TemplateContent>
-    <Project TargetFileName="CordovaApp.jsproj" File="CordovaApp.jsproj" ReplaceParameters="true">
-      <Folder Name="images" TargetFolderName="images">
-        <ProjectItem ReplaceParameters="false" TargetFileName="logo.png">logo.png</ProjectItem>
-        <ProjectItem ReplaceParameters="false" TargetFileName="smalllogo.png">smalllogo.png</ProjectItem>
-        <ProjectItem ReplaceParameters="false" TargetFileName="splashscreen.png">splashscreen.png</ProjectItem>
-        <ProjectItem ReplaceParameters="false" TargetFileName="storelogo.png">storelogo.png</ProjectItem>
-      </Folder>
-      <Folder Name="www" TargetFolderName="www">
-        <Folder Name="css" TargetFolderName="css">
-          <ProjectItem ReplaceParameters="true" TargetFileName="index.css">index.css</ProjectItem>
-        </Folder>
-        <Folder Name="img" TargetFolderName="img">
-          <ProjectItem ReplaceParameters="false" TargetFileName="logo.png">logo.png</ProjectItem>
-          <ProjectItem ReplaceParameters="false" TargetFileName="smalllogo.png">smalllogo.png</ProjectItem>
-          <ProjectItem ReplaceParameters="false" TargetFileName="splashscreen.png">splashscreen.png</ProjectItem>
-          <ProjectItem ReplaceParameters="false" TargetFileName="storelogo.png">storelogo.png</ProjectItem>
-        </Folder>
-        <Folder Name="js" TargetFolderName="js">
-          <ProjectItem ReplaceParameters="true" TargetFileName="index.js">index.js</ProjectItem>
-        </Folder>
-        <ProjectItem ReplaceParameters="true" TargetFileName="cordova.js">cordova.js</ProjectItem>
-        <ProjectItem ReplaceParameters="true" TargetFileName="index.html">index.html</ProjectItem>
-      </Folder>
-      <ProjectItem ReplaceParameters="false" TargetFileName="CordovaApp_TemporaryKey.pfx">CordovaApp_TemporaryKey.pfx</ProjectItem>
-      <ProjectItem ReplaceParameters="true" TargetFileName="package.appxmanifest">package.appxmanifest</ProjectItem>
-    </Project>
-  </TemplateContent>
-</VSTemplate>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/config.xml
----------------------------------------------------------------------
diff --git a/windows/template/config.xml b/windows/template/config.xml
index 96c7e05..558496c 100644
--- a/windows/template/config.xml
+++ b/windows/template/config.xml
@@ -20,4 +20,6 @@
 #
 -->
 <widget xmlns="http://www.w3.org/ns/widgets">
+    <preference name="windows-target-version" value="8.0" />
+    <preference name="windows-phone-target-version" value="8.1" />
 </widget>

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/build
----------------------------------------------------------------------
diff --git a/windows/template/cordova/build b/windows/template/cordova/build
index ad0c8cc..8fbceae 100644
--- a/windows/template/cordova/build
+++ b/windows/template/cordova/build
@@ -22,13 +22,13 @@
 var build = require('./lib/build'),
     args  = process.argv;
 
-// Support basic help commands
-if(args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
-                    args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
+// Handle help flag
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) {
     build.help();
 } else {
     build.run(args).done(null, function(err) {
-        console.error(err);
+        var errorMessage = (err && err.stack) ? err.stack : err;
+        console.error('ERROR: ' + errorMessage);
         process.exit(2);
     });
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/clean
----------------------------------------------------------------------
diff --git a/windows/template/cordova/clean b/windows/template/cordova/clean
index ce10f23..71877fe 100644
--- a/windows/template/cordova/clean
+++ b/windows/template/cordova/clean
@@ -21,12 +21,7 @@
 
 var clean = require('./lib/clean');
 
-// Usage support for when args are given
-if(process.argv.length > 2) {
-    clean.help();
-} else {
-    clean.run().done(null, function(err) {
-        console.error('ERROR: ' + err);
-        process.exit(2);
-    });
-}
+clean.run(process.argv).done(null, function(err) {
+    console.error('ERROR: ' + err);
+    process.exit(2);
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/ApplyPlatformConfig.ps1
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/ApplyPlatformConfig.ps1 b/windows/template/cordova/lib/ApplyPlatformConfig.ps1
index 8fdb026..c179d5a 100644
--- a/windows/template/cordova/lib/ApplyPlatformConfig.ps1
+++ b/windows/template/cordova/lib/ApplyPlatformConfig.ps1
@@ -75,8 +75,8 @@ Function UpdateManifest ($manifestFile)
       while ($version.Split(".").Length -lt 4) {
           $version = $version + ".0"
       }
+      $manifest.Package.Identity.Version = $version
   }
-  $manifest.Package.Identity.Version = $version
 
   # Sort capabilities elements
   $capabilities = $manifest.Package.Capabilities

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/ConfigParser.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/ConfigParser.js b/windows/template/cordova/lib/ConfigParser.js
new file mode 100644
index 0000000..31a53e6
--- /dev/null
+++ b/windows/template/cordova/lib/ConfigParser.js
@@ -0,0 +1,206 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          sub:true
+*/
+
+var et = require('elementtree'),
+    fs = require('fs');
+
+/** Wraps a config.xml file */
+function ConfigParser(path) {
+    this.path = path;
+    try {
+        var contents = fs.readFileSync(path, 'utf-8');
+        if(contents) {
+            //Windows is the BOM. Skip the Byte Order Mark.
+            contents = contents.substring(contents.indexOf('<'));
+        }
+        this.doc = new et.ElementTree(et.XML(contents));
+
+    } catch (e) {
+        console.error('Parsing '+path+' failed');
+        throw e;
+    }
+    var r = this.doc.getroot();
+    if (r.tag !== 'widget') {
+        throw new CordovaError(path + ' has incorrect root node name (expected "widget", was "' + r.tag + '")');
+    }
+}
+
+function getNodeTextSafe(el) {
+    return el && el.text && el.text.trim();
+}
+
+function findOrCreate(doc, name) {
+    var ret = doc.find(name);
+    if (!ret) {
+        ret = new et.Element(name);
+        doc.getroot().append(ret);
+    }
+    return ret;
+}
+
+ConfigParser.prototype = {
+    packageName: function(id) {
+        return this.doc.getroot().attrib['id'];
+    },
+    setPackageName: function(id) {
+        this.doc.getroot().attrib['id'] = id;
+    },
+    name: function() {
+        return getNodeTextSafe(this.doc.find('name'));
+    },
+    setName: function(name) {
+        var el = findOrCreate(this.doc, 'name');
+        el.text = name;
+    },
+    description: function() {
+        return this.doc.find('description').text.trim();
+    },
+    setDescription: function(text) {
+        var el = findOrCreate(this.doc, 'description');
+        el.text = text;
+    },
+    version: function() {
+        return this.doc.getroot().attrib['version'];
+    },
+    android_versionCode: function() {
+        return this.doc.getroot().attrib['android-versionCode'];
+    },
+    ios_CFBundleVersion: function() {
+        return this.doc.getroot().attrib['ios-CFBundleVersion'];
+    },
+    setVersion: function(value) {
+        this.doc.getroot().attrib['version'] = value;
+    },
+    author: function() {
+        return getNodeTextSafe(this.doc.find('author'));
+    },
+    getPreference: function(name) {
+        var preferences = this.doc.findall('preference');
+        var ret = null;
+        preferences.forEach(function (preference) {
+            // Take the last one that matches.
+            if (preference.attrib.name.toLowerCase() === name.toLowerCase()) {
+                ret = preference.attrib.value;
+            }
+        });
+        return ret;
+    },
+    /**
+     * Returns all resources for the platform specified.
+     * @param  {String} platform     The platform.
+     * @param {string}  resourceName Type of static resources to return.
+     *                               "icon" and "splash" currently supported.
+     * @return {Array}               Resources for the platform specified.
+     */
+    getStaticResources: function(platform, resourceName) {
+        var ret = [],
+            staticResources = [];
+        if (platform) { // platform specific icons
+            this.doc.findall('platform[@name=\'' + platform + '\']/' + resourceName).forEach(function(elt){
+                elt.platform = platform; // mark as platform specific resource
+                staticResources.push(elt);
+            });
+        }
+        // root level resources
+        staticResources = staticResources.concat(this.doc.findall(resourceName));
+        // parse resource elements
+        staticResources.forEach(function (elt) {
+            var res = {};
+            res.src = elt.attrib.src;
+            res.density = elt.attrib['density'] || elt.attrib['cdv:density'] || elt.attrib['gap:density'];
+            res.platform = elt.platform || null; // null means icon represents default icon (shared between platforms)
+            res.width = elt.attrib.width;
+            res.height = elt.attrib.height;
+
+            // default icon
+            if (!res.width && !res.height && !res.density) {
+                ret.defaultResource = res;
+            }
+            ret.push(res);
+        });
+
+        /**
+         * Returns resource with specified width and/or height.
+         * @param  {number} width Width of resource.
+         * @param  {number} height Height of resource.
+         * @return {Resource} Resource object or null if not found.
+         */
+        ret.getBySize = function(width, height) {
+            if (!width && !height){
+                throw 'One of width or height must be defined';
+            }
+            for (var idx in this){
+                var res = this[idx];
+                // If only one of width or height is not specified, use another parameter for comparation
+                // If both specified, compare both.
+                if ((!width || (width == res.width)) &&
+                    (!height || (height == res.height))){
+                    return res;
+                }
+            }
+            return null;
+        };
+
+        /**
+         * Returns resource with specified density.
+         * @param  {string} density Density of resource.
+         * @return {Resource}       Resource object or null if not found.
+         */
+        ret.getByDensity = function (density) {
+            for (var idx in this) {
+                if (this[idx].density == density) {
+                    return this[idx];
+                }
+            }
+            return null;
+        };
+
+        /** Returns default icons */
+        ret.getDefault = function() {
+            return ret.defaultResource;
+        };
+
+        return ret;
+    },
+
+    /**
+     * Returns all icons for specific platform.
+     * @param  {string} platform Platform name
+     * @return {Resource[]}      Array of icon objects.
+     */
+    getIcons: function(platform) {
+        return this.getStaticResources(platform, 'icon');
+    },
+
+    /**
+     * Returns all splash images for specific platform.
+     * @param  {string} platform Platform name
+     * @return {Resource[]}      Array of Splash objects.
+     */
+    getSplashScreens: function(platform) {
+        return this.getStaticResources(platform, 'splash');
+    }
+};
+
+module.exports = ConfigParser;

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/MSBuildTools.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/MSBuildTools.js b/windows/template/cordova/lib/MSBuildTools.js
new file mode 100644
index 0000000..e4d05e7
--- /dev/null
+++ b/windows/template/cordova/lib/MSBuildTools.js
@@ -0,0 +1,49 @@
+var Q     = require('Q'),
+    path  = require('path'),
+    exec  = require('./exec'),
+    spawn  = require('./spawn');
+
+function MSBuildTools (version, path) {
+    this.version = version;
+    this.path = path;
+}
+
+MSBuildTools.prototype.buildProject = function(projFile, buildType, buildarch) {
+    console.log("Building project: " + projFile);
+    console.log("\tConfiguration : " + buildType);
+    console.log("\tPlatform      : " + buildarch);
+
+    var args = ['/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal', '/nologo',
+    '/p:Configuration=' + buildType,
+    '/p:Platform=' + buildarch];
+
+    return spawn(path.join(this.path, 'msbuild'), [projFile].concat(args));
+}
+
+// returns full path to msbuild tools required to build the project and tools version
+module.exports.findAvailableVersion = function () {
+    var versions = ['12.0', '4.0'];
+
+    return Q.all(versions.map(checkMSBuildVersion)).then(function (versions) {
+        // select first msbuild version available, and resolve promise with it
+        var msbuildTools = versions[0] || versions[1];
+
+        return msbuildTools ? Q.resolve(msbuildTools) : Q.reject('MSBuild tools not found');
+    });
+};
+
+function checkMSBuildVersion(version) {
+    var deferred = Q.defer();
+
+    exec('reg query HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\' + version + ' /v MSBuildToolsPath').then(
+        function(output) {
+            // fetch msbuild path from 'reg' output
+            var path = /MSBuildToolsPath\s+REG_SZ\s+(.*)/i.exec(output);
+            if (path) {
+                deferred.resolve(new MSBuildTools(version, path[1]));
+            } else {
+                deferred.resolve(null); // not found
+            }
+        });
+    return deferred.promise;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/build.js b/windows/template/cordova/lib/build.js
index 5b82342..d1dc10b 100644
--- a/windows/template/cordova/lib/build.js
+++ b/windows/template/cordova/lib/build.js
@@ -21,59 +21,46 @@ var Q     = require('Q'),
     path  = require('path'),
     nopt  = require('nopt'),
     spawn = require('./spawn'),
-    utils = require('./utils');
+    utils = require('./utils'),
+    MSBuildTools = require('./MSBuildTools'),
+    ConfigParser = require('./ConfigParser');
 
+// Platform project root folder
 var ROOT = path.join(__dirname, '..', '..');
+var projFiles = {
+    phone: 'CordovaApp.Phone.jsproj',
+    store: 'CordovaApp.Store.jsproj',
+    store80: 'CordovaApp.Store80.jsproj'
+};
+// parsed nopt arguments
+var args;
+// build type (Release vs Debug)
+var buildType;
+// target chip architectures to build for
+var buildArchs;
+// MSBuild Tools available on this development machine
+var msbuild;
 
 // builds cordova-windows application with parameters provided.
 // See 'help' function for args list
 module.exports.run = function run (argv) {
-    // reject promise if project is not valid
     if (!utils.isCordovaProject(ROOT)){
-        return Q.reject("Could not find project at " + ROOT);
+        return Q.reject('Could not find project at ' + ROOT);
     }
 
-    // parse args
-    var args = nopt({"debug": Boolean, "release": Boolean, "archs": [String]}, {"-r": "--release"}, argv);
-   
-    // Validate args
-    if (args.debug && args.release) {
-        return Q.reject('Only one of "debug"/"release" options should be specified');
+    try {
+        // thows exception if something goes wrong
+        parseAndValidateArgs(argv);
+    } catch (error) {
+        return Q.reject(error);
     }
-    
-    // get build options/defaults
-    var buildType = args.release ? "release" : "debug",
-        buildArchs = args.archs ? args.archs.split(' ') : ["anycpu"];
-
-    // chain promises each for previous for each array member
-    return buildArchs.reduce(function(promise, arch) {
-        // support for "any cpu" specified with or without space
-        var buildarch = arch !== "anycpu" ? arch : "any cpu";
-        return promise.then(function() {
-            return utils.getMSBuild();
-        }).then(function(msbuild) {
-            console.log("\nBuilding Cordova Windows Project:");
-            console.log("\tConfiguration : " + buildType);
-            console.log("\tPlatform      : " + buildarch);
-            console.log("\tDirectory     : " + ROOT);
-            console.log("\tMSBuildToolsPath: " + msbuild.path);
-            
-            if (msbuild.version == '4.0') {
-                console.warn("\r\nWarning. Windows 8.1 and Windows Phone 8.1 target platforms are not supported on this development machine and will be skipped.");
-                console.warn("Please install OS Windows 8.1 and Visual Studio 2013 Update2 in order to build for Windows 8.1 and Windows Phone 8.1.\r\n");
-            }
-            var solution = msbuild.version == '4.0' ?
-                path.join(ROOT, 'CordovaApp.vs2012.sln') :
-                path.join(ROOT, 'CordovaApp.sln');
-
-            var args = [solution,
-                '/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal', '/nologo',
-                '/p:Configuration=' + buildType,
-                '/p:Platform=' + buildarch];
-            
-            return spawn(path.join(msbuild.path, 'msbuild'), args);
+
+    return MSBuildTools.findAvailableVersion().then(
+        function(msbuildTools) {
+            msbuild = msbuildTools;
+            console.log('MSBuildToolsPath: ' + msbuild.path);
+            return applyPlatformConfig().then(buildTargets);
         });
-    }, Q());
 };
 
 // help/usage function
@@ -93,3 +80,113 @@ module.exports.help = function help() {
     console.log("");
     process.exit(0);
 };
+
+function parseAndValidateArgs(argv) {
+    // parse and validate args
+    args = nopt({'debug': Boolean, 'release': Boolean, 'archs': [String],
+        'phone': Boolean, 'store': Boolean}, {'-r': '--release'}, argv);
+    // Validate args
+    if (args.debug && args.release) {
+        throw 'Only one of "debug"/"release" options should be specified';
+    }
+    if (args.phone && args.store) {
+        throw 'Only one of "phone"/"store" options should be specified';
+    }
+    
+    // get build options/defaults
+    buildType = args.release ? 'release' : 'debug';
+    buildArchs = args.archs ? args.archs.split(' ') : ['anycpu'];
+}
+
+function buildTargets() {
+
+    // filter targets to make sure they are supported on this development machine
+    var buildTargets = filterSupportedTargets(getBuildTargets(), msbuild);
+
+    var buildConfigs = [];
+
+    // collect all build configurations (pairs of project to build and target architecture)
+    buildTargets.forEach(function(buildTarget) {
+        buildArchs.forEach(function(buildArch) {
+            buildConfigs.push({target:buildTarget, arch: buildArch});
+        })
+    });
+
+    // run builds serially
+    return buildConfigs.reduce(function (promise, build) {
+         return promise.then(function () {
+            // support for "any cpu" specified with or without space
+            if (build.arch == 'any cpu') {
+                build.arch = 'anycpu';
+            }
+            // msbuild 4.0 requires .sln file, we can't build jsproj
+            if (msbuild.version == '4.0' && build.target == projFiles.store80) {
+                build.target = 'CordovaApp.vs2012.sln';
+            }
+            return msbuild.buildProject(path.join(ROOT, build.target), buildType,  build.arch);
+         });
+    }, Q()); 
+}
+
+function applyPlatformConfig() {
+    // run powershell ApplyPlatformConfig.ps1
+    return utils.getApplyPlatformConfigScript().then(function(ApplyPlatformConfigScript) {
+        return spawn('Powershell', ['-File', ApplyPlatformConfigScript, ROOT]);
+    });
+}
+
+function getBuildTargets() {
+    var config = new ConfigParser(path.join(ROOT, 'config.xml'));
+    var targets = [];
+    var noSwitches = !(args.phone || args.store);
+
+    if (args.store || noSwitches) { // if --store or no arg
+        var windowsTargetVersion = config.getPreference('windows-target-version')
+        switch(windowsTargetVersion) {
+        case '8':
+        case '8.0':
+            targets.push(projFiles.store80);
+            break;
+        case '8.1':
+            targets.push(projFiles.store);
+            break;
+        default:
+            throw new Error('Unsupported windows-target-version value: ' + windowsTargetVersion)
+        }
+    }
+
+    if (args.phone || noSwitches) { // if --phone or no arg
+        var windowsPhoneTargetVersion = config.getPreference('windows-phone-target-version')
+        switch(windowsPhoneTargetVersion) {
+        case '8.1':
+            targets.push(projFiles.phone);
+            break;
+        default:
+            throw new Error('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion)
+        }
+    }
+    return targets;
+}
+
+function filterSupportedTargets (targets) {
+    if (!targets || targets.length == 0) {
+        console.warn("\r\nNo build targets are specified.");
+        return [];
+    }
+
+    if (msbuild.version != '4.0') {
+        return targets;
+    }
+
+    // MSBuild 4.0 does not support Windows 8.1 and Windows Phone 8.1
+    var supportedTargets = targets.filter(function(target) {
+        return target != projFiles.store && target != projFiles.phone;
+    });
+
+    // unsupported targets have been detected
+    if (supportedTargets.length != targets.length) {
+        console.warn("\r\nWarning. Windows 8.1 and Windows Phone 8.1 target platforms are not supported on this development machine and will be skipped.");
+        console.warn("Please install OS Windows 8.1 and Visual Studio 2013 Update2 in order to build for Windows 8.1 and Windows Phone 8.1.\r\n");
+    }
+    return supportedTargets;
+}

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/clean.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/clean.js b/windows/template/cordova/lib/clean.js
index 672b675..edd40de 100644
--- a/windows/template/cordova/lib/clean.js
+++ b/windows/template/cordova/lib/clean.js
@@ -21,10 +21,13 @@ var Q     = require('q'),
     path  = require('path'),
     shell = require('shelljs');
 
+var ROOT = path.join(__dirname, '..', '..');
+
 // cleans the project, removes AppPackages and build folders.
-module.exports.run = function (platformpath) {
+module.exports.run = function (argv) {
+    var projectPath = ROOT;
     ['AppPackages', 'build'].forEach(function(dir) {
-        shell.rm('-rf', path.join(platformpath, dir));
+        shell.rm('-rf', path.join(projectPath, dir));
     });
     return Q.resolve();
 };
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/run.js b/windows/template/cordova/lib/run.js
index de220bd..ec1552c 100644
--- a/windows/template/cordova/lib/run.js
+++ b/windows/template/cordova/lib/run.js
@@ -22,6 +22,7 @@ var Q = require('q'),
     path  = require('path'),
     build = require('./build'),
     utils = require('./utils'),
+    ConfigParser = require('./ConfigParser'),
     packages = require('./package');
 
 var ROOT = path.join(__dirname, '..', '..');
@@ -34,8 +35,7 @@ module.exports.run = function (argv) {
     // parse args
     var args  = nopt({"debug": Boolean, "release": Boolean, "nobuild": Boolean,
         "device": Boolean, "emulator": Boolean, "target": String, "archs": String,
-        "phone": Boolean, "store": Boolean, "store80": Boolean
-    }, {"store81": "--store", "r" : "--release"}, argv);
+        "phone": Boolean, "store": Boolean}, {"r" : "--release"}, argv);
 
     // Validate args
     if (args.debug && args.release) {
@@ -44,16 +44,21 @@ module.exports.run = function (argv) {
     if ((args.device && args.emulator) || ((args.device || args.emulator) && args.target)) {
         return Q.reject('Only one of "device"/"emulator"/"target" options should be specified');
     }
-    if ((args.phone && args.store) || ((args.phone || args.store) && args.store80)) {
-        return Q.reject('Only one of "phone"/"store"/"store80" options should be specified');
+    if (args.phone && args.store) {
+        return Q.reject('Only one of "phone"/"store" options should be specified');
     }
 
     // Get build/deploy options
     var buildType    = args.release ? "release" : "debug",
         buildArchs   = args.archs ? args.archs.split(' ') : ["anycpu"],
-        projectType  = args.phone ? "phone" : args.store80 ? "store80" : "store",
+        projectType  = args.phone ? "phone" : "store",
         deployTarget = args.target ? args.target : args.device ? "device" : "emulator";
 
+    // for store switch we should correctly handle 8.0 and 8.1 version as per configuration
+    if (projectType == 'store' && getStoreTargetVersion() == '8.0') {
+        projectType = 'store80'
+    }
+
     // if --nobuild isn't specified then build app first
     var buildPackages = args.nobuild ? Q() : build.run(argv);
 
@@ -90,4 +95,19 @@ module.exports.help = function () {
     console.log("    run --emulator --debug");
     console.log("");
     process.exit(0);
-};
\ No newline at end of file
+};
+
+
+function getStoreTargetVersion() {
+    var config = new ConfigParser(path.join(ROOT, 'config.xml'));
+    var windowsTargetVersion = config.getPreference('windows-target-version')
+    switch(windowsTargetVersion) {
+    case '8':
+    case '8.0':
+        return '8.0'
+    case '8.1':
+        return '8.1'
+    default:
+        throw new Error('Unsupported windows-target-version value: ' + windowsTargetVersion)
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/lib/utils.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/utils.js b/windows/template/cordova/lib/utils.js
index 022024d..12282e7 100644
--- a/windows/template/cordova/lib/utils.js
+++ b/windows/template/cordova/lib/utils.js
@@ -24,7 +24,7 @@ var Q     = require('Q'),
     spawn = require('./spawn');
 
 // returns full path to msbuild tools required to build the project and tools version
-module.exports.getMSBuild = function () {
+module.exports.getMSBuildTools = function () {
     var versions = ['12.0', '4.0'];
     // create chain of promises, which returns specific msbuild version object
     // or null, if specific msbuild path not found in registry
@@ -55,7 +55,7 @@ module.exports.getAppStoreUtils = function () {
     if (!fs.existsSync (appStoreUtils)) {
         return Q.reject("Can't unblock AppStoreUtils script");
     }
-    console.log("Removing execution restrictions from AppStoreUtils...");
+    //console.log("Removing execution restrictions from AppStoreUtils...");
     return spawn('powershell', ['Unblock-File', module.exports.quote(appStoreUtils)]).then(function () {
         return Q.resolve(appStoreUtils);
     }).fail(function (err) {
@@ -63,6 +63,20 @@ module.exports.getAppStoreUtils = function () {
     });
 };
 
+// unblocks and returns path to ApplyPlatformConfig.ps1
+module.exports.getApplyPlatformConfigScript = function () {
+    var scriptPath = path.join(__dirname, 'ApplyPlatformConfig.ps1');
+    if (!fs.existsSync (scriptPath)) {
+        return Q.reject("Can't unblock ApplyPlatformConfig.ps1 script");
+    }
+    //console.log("Removing execution restrictions from ApplyPlatformConfig...");
+    return spawn('powershell', ['Unblock-File', module.exports.quote(scriptPath)]).then(function () {
+        return Q.resolve(scriptPath);
+    }).fail(function (err) {
+        return Q.reject(err);
+    });
+};
+
 // returns path to AppDeploy util from Windows Phone 8.1 SDK
 module.exports.getAppDeployUtils = function () {
     var appDeployUtils = path.join((process.env["ProgramFiles(x86)"] || process.env["ProgramFiles"]),

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/log.bat
----------------------------------------------------------------------
diff --git a/windows/template/cordova/log.bat b/windows/template/cordova/log.bat
index c1227f7..d23aeab 100644
--- a/windows/template/cordova/log.bat
+++ b/windows/template/cordova/log.bat
@@ -15,5 +15,5 @@
 :: specific language governing permissions and limitations
 :: under the License
 @ECHO OFF
-ECHO Sorry, logging is not supported for Windows Phone. 1>&2
+ECHO Sorry, logging is not supported for Windows. 1>&2
 EXIT /B 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/.npmignore
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/.npmignore b/windows/template/cordova/node_modules/elementtree/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/.npmignore
@@ -0,0 +1 @@
+node_modules

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/.travis.yml
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/.travis.yml b/windows/template/cordova/node_modules/elementtree/.travis.yml
new file mode 100644
index 0000000..6f27c96
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/.travis.yml
@@ -0,0 +1,10 @@
+language: node_js
+
+node_js:
+  - 0.6
+
+script: make test
+
+notifications:
+  email:
+    - tomaz+travisci@tomaz.me

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/CHANGES.md
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/CHANGES.md b/windows/template/cordova/node_modules/elementtree/CHANGES.md
new file mode 100644
index 0000000..83bd61b
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/CHANGES.md
@@ -0,0 +1,34 @@
+elementtree v0.1.5 (in development)
+
+* Fix a bug in the find() and findtext() method which could manifest itself
+  under some conditions.
+  [metagriffin]
+
+elementtree v0.1.4
+
+* Allow user to use namespaced attributes when using find* functions.
+  [Andrew Lunny]
+
+elementtree v0.1.3
+
+* Improve the output of text content in the tags (strip unnecessary line break
+  characters).
+
+[Darryl Pogue]
+
+elementtree v0.1.2
+
+ * Allow user to pass 'indent' option to ElementTree.write method. If this
+   option is specified (e.g. {'indent': 4}). XML will be pretty printed.
+   [Darryl Pogue, Tomaz Muraus]
+
+ * Bump sax dependency version.
+
+elementtree v0.1.1 - 2011-09-23
+
+ * Improve special character escaping.
+   [Ryan Phillips]
+
+elementtree v0.1.0 - 2011-09-05
+
+ * Initial release.

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/LICENSE.txt
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/LICENSE.txt b/windows/template/cordova/node_modules/elementtree/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/Makefile
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/Makefile b/windows/template/cordova/node_modules/elementtree/Makefile
new file mode 100644
index 0000000..ab7c4e0
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/Makefile
@@ -0,0 +1,21 @@
+TESTS := \
+	tests/test-simple.js
+
+
+
+PATH := ./node_modules/.bin:$(PATH)
+
+WHISKEY := $(shell bash -c 'PATH=$(PATH) type -p whiskey')
+
+default: test
+
+test:
+	NODE_PATH=`pwd`/lib/ ${WHISKEY} --scope-leaks --sequential --real-time --tests "${TESTS}"
+
+tap:
+	NODE_PATH=`pwd`/lib/ ${WHISKEY} --test-reporter tap --sequential --real-time --tests "${TESTS}"
+
+coverage:
+	NODE_PATH=`pwd`/lib/ ${WHISKEY} --sequential --coverage  --coverage-reporter html --coverage-dir coverage_html --tests "${TESTS}"
+
+.PHONY: default test coverage tap scope

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/NOTICE
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/NOTICE b/windows/template/cordova/node_modules/elementtree/NOTICE
new file mode 100644
index 0000000..28ad70a
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/NOTICE
@@ -0,0 +1,5 @@
+node-elementtree
+Copyright (c) 2011, Rackspace, Inc.
+
+The ElementTree toolkit is Copyright (c) 1999-2007 by Fredrik Lundh
+

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/README.md
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/README.md b/windows/template/cordova/node_modules/elementtree/README.md
new file mode 100644
index 0000000..8a7e710
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/README.md
@@ -0,0 +1,27 @@
+node-elementtree
+====================
+
+node-elementtree is a [Node.js](http://nodejs.org) XML parser and serializer based upon the [Python ElementTree v1.3](http://effbot.org/zone/element-index.htm) module.
+
+Installation
+====================
+
+    $ npm install elementtree
+    
+Using the library
+====================
+
+For the usage refer to the Python ElementTree library documentation - [http://effbot.org/zone/element-index.htm#usage](http://effbot.org/zone/element-index.htm#usage).
+
+Supported XPath expressions in `find`, `findall` and `findtext` methods are listed on [http://effbot.org/zone/element-xpath.htm](http://effbot.org/zone/element-xpath.htm).
+
+Build status
+====================
+
+[![Build Status](https://secure.travis-ci.org/racker/node-elementtree.png)](http://travis-ci.org/racker/node-elementtree)
+
+
+License
+====================
+
+node-elementtree is distributed under the [Apache license](http://www.apache.org/licenses/LICENSE-2.0.html).

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/lib/constants.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/lib/constants.js b/windows/template/cordova/node_modules/elementtree/lib/constants.js
new file mode 100644
index 0000000..b057faf
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/lib/constants.js
@@ -0,0 +1,20 @@
+/*
+ *  Copyright 2011 Rackspace
+ *
+ *  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.
+ *
+ */
+
+var DEFAULT_PARSER = 'sax';
+
+exports.DEFAULT_PARSER = DEFAULT_PARSER;

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/lib/elementpath.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/lib/elementpath.js b/windows/template/cordova/node_modules/elementtree/lib/elementpath.js
new file mode 100644
index 0000000..2e93f47
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/lib/elementpath.js
@@ -0,0 +1,343 @@
+/**
+ *  Copyright 2011 Rackspace
+ *
+ *  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.
+ *
+ */
+
+var sprintf = require('./sprintf').sprintf;
+
+var utils = require('./utils');
+var SyntaxError = require('./errors').SyntaxError;
+
+var _cache = {};
+
+var RE = new RegExp(
+  "(" +
+  "'[^']*'|\"[^\"]*\"|" +
+  "::|" +
+  "//?|" +
+  "\\.\\.|" +
+  "\\(\\)|" +
+  "[/.*:\\[\\]\\(\\)@=])|" +
+  "((?:\\{[^}]+\\})?[^/\\[\\]\\(\\)@=\\s]+)|" +
+  "\\s+", 'g'
+);
+
+var xpath_tokenizer = utils.findall.bind(null, RE);
+
+function prepare_tag(next, token) {
+  var tag = token[0];
+
+  function select(context, result) {
+    var i, len, elem, rv = [];
+
+    for (i = 0, len = result.length; i < len; i++) {
+      elem = result[i];
+      elem._children.forEach(function(e) {
+        if (e.tag === tag) {
+          rv.push(e);
+        }
+      });
+    }
+
+    return rv;
+  }
+
+  return select;
+}
+
+function prepare_star(next, token) {
+  function select(context, result) {
+    var i, len, elem, rv = [];
+
+    for (i = 0, len = result.length; i < len; i++) {
+      elem = result[i];
+      elem._children.forEach(function(e) {
+        rv.push(e);
+      });
+    }
+
+    return rv;
+  }
+
+  return select;
+}
+
+function prepare_dot(next, token) {
+  function select(context, result) {
+    var i, len, elem, rv = [];
+
+    for (i = 0, len = result.length; i < len; i++) {
+      elem = result[i];
+      rv.push(elem);
+    }
+
+    return rv;
+  }
+
+  return select;
+}
+
+function prepare_iter(next, token) {
+  var tag;
+  token = next();
+
+  if (token[1] === '*') {
+    tag = '*';
+  }
+  else if (!token[1]) {
+    tag = token[0] || '';
+  }
+  else {
+    throw new SyntaxError(token);
+  }
+
+  function select(context, result) {
+    var i, len, elem, rv = [];
+
+    for (i = 0, len = result.length; i < len; i++) {
+      elem = result[i];
+      elem.iter(tag, function(e) {
+        if (e !== elem) {
+          rv.push(e);
+        }
+      });
+    }
+
+    return rv;
+  }
+
+  return select;
+}
+
+function prepare_dot_dot(next, token) {
+  function select(context, result) {
+    var i, len, elem, rv = [], parent_map = context.parent_map;
+
+    if (!parent_map) {
+      context.parent_map = parent_map = {};
+
+      context.root.iter(null, function(p) {
+        p._children.forEach(function(e) {
+          parent_map[e] = p;
+        });
+      });
+    }
+
+    for (i = 0, len = result.length; i < len; i++) {
+      elem = result[i];
+
+      if (parent_map.hasOwnProperty(elem)) {
+        rv.push(parent_map[elem]);
+      }
+    }
+
+    return rv;
+  }
+
+  return select;
+}
+
+
+function prepare_predicate(next, token) {
+  var tag, key, value, select;
+  token = next();
+
+  if (token[1] === '@') {
+    // attribute
+    token = next();
+
+    if (token[1]) {
+      throw new SyntaxError(token, 'Invalid attribute predicate');
+    }
+
+    key = token[0];
+    token = next();
+
+    if (token[1] === ']') {
+      select = function(context, result) {
+        var i, len, elem, rv = [];
+
+        for (i = 0, len = result.length; i < len; i++) {
+          elem = result[i];
+
+          if (elem.get(key)) {
+            rv.push(elem);
+          }
+        }
+
+        return rv;
+      };
+    }
+    else if (token[1] === '=') {
+      value = next()[1];
+
+      if (value[0] === '"' || value[value.length - 1] === '\'') {
+        value = value.slice(1, value.length - 1);
+      }
+      else {
+        throw new SyntaxError(token, 'Ivalid comparison target');
+      }
+
+      token = next();
+      select = function(context, result) {
+        var i, len, elem, rv = [];
+
+        for (i = 0, len = result.length; i < len; i++) {
+          elem = result[i];
+
+          if (elem.get(key) === value) {
+            rv.push(elem);
+          }
+        }
+
+        return rv;
+      };
+    }
+
+    if (token[1] !== ']') {
+      throw new SyntaxError(token, 'Invalid attribute predicate');
+    }
+  }
+  else if (!token[1]) {
+    tag = token[0] || '';
+    token = next();
+
+    if (token[1] !== ']') {
+      throw new SyntaxError(token, 'Invalid node predicate');
+    }
+
+    select = function(context, result) {
+      var i, len, elem, rv = [];
+
+      for (i = 0, len = result.length; i < len; i++) {
+        elem = result[i];
+
+        if (elem.find(tag)) {
+          rv.push(elem);
+        }
+      }
+
+      return rv;
+    };
+  }
+  else {
+    throw new SyntaxError(null, 'Invalid predicate');
+  }
+
+  return select;
+}
+
+
+
+var ops = {
+  "": prepare_tag,
+  "*": prepare_star,
+  ".": prepare_dot,
+  "..": prepare_dot_dot,
+  "//": prepare_iter,
+  "[": prepare_predicate,
+};
+
+function _SelectorContext(root) {
+  this.parent_map = null;
+  this.root = root;
+}
+
+function findall(elem, path) {
+  var selector, result, i, len, token, value, select, context;
+
+  if (_cache.hasOwnProperty(path)) {
+    selector = _cache[path];
+  }
+  else {
+    // TODO: Use smarter cache purging approach
+    if (Object.keys(_cache).length > 100) {
+      _cache = {};
+    }
+
+    if (path.charAt(0) === '/') {
+      throw new SyntaxError(null, 'Cannot use absolute path on element');
+    }
+
+    result = xpath_tokenizer(path);
+    selector = [];
+
+    function getToken() {
+      return result.shift();
+    }
+
+    token = getToken();
+    while (true) {
+      var c = token[1] || '';
+      value = ops[c](getToken, token);
+
+      if (!value) {
+        throw new SyntaxError(null, sprintf('Invalid path: %s', path));
+      }
+
+      selector.push(value);
+      token = getToken();
+
+      if (!token) {
+        break;
+      }
+      else if (token[1] === '/') {
+        token = getToken();
+      }
+
+      if (!token) {
+        break;
+      }
+    }
+
+    _cache[path] = selector;
+  }
+
+  // Execute slector pattern
+  result = [elem];
+  context = new _SelectorContext(elem);
+
+  for (i = 0, len = selector.length; i < len; i++) {
+    select = selector[i];
+    result = select(context, result);
+  }
+
+  return result || [];
+}
+
+function find(element, path) {
+  var resultElements = findall(element, path);
+
+  if (resultElements && resultElements.length > 0) {
+    return resultElements[0];
+  }
+
+  return null;
+}
+
+function findtext(element, path, defvalue) {
+  var resultElements = findall(element, path);
+
+  if (resultElements && resultElements.length > 0) {
+    return resultElements[0].text;
+  }
+
+  return defvalue;
+}
+
+
+exports.find = find;
+exports.findall = findall;
+exports.findtext = findtext;

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/94dec04a/windows/template/cordova/node_modules/elementtree/lib/elementtree.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/node_modules/elementtree/lib/elementtree.js b/windows/template/cordova/node_modules/elementtree/lib/elementtree.js
new file mode 100644
index 0000000..b46268c
--- /dev/null
+++ b/windows/template/cordova/node_modules/elementtree/lib/elementtree.js
@@ -0,0 +1,598 @@
+/**
+ *  Copyright 2011 Rackspace
+ *
+ *  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.
+ *
+ */
+
+var sprintf = require('./sprintf').sprintf;
+
+var utils = require('./utils');
+var ElementPath = require('./elementpath');
+var TreeBuilder = require('./treebuilder').TreeBuilder;
+var get_parser = require('./parser').get_parser;
+var constants = require('./constants');
+
+var element_ids = 0;
+
+function Element(tag, attrib)
+{
+  this._id = element_ids++;
+  this.tag = tag;
+  this.attrib = {};
+  this.text = null;
+  this.tail = null;
+  this._children = [];
+
+  if (attrib) {
+    this.attrib = utils.merge(this.attrib, attrib);
+  }
+}
+
+Element.prototype.toString = function()
+{
+  return sprintf("<Element %s at %s>", this.tag, this._id);
+};
+
+Element.prototype.makeelement = function(tag, attrib)
+{
+  return new Element(tag, attrib);
+};
+
+Element.prototype.len = function()
+{
+  return this._children.length;
+};
+
+Element.prototype.getItem = function(index)
+{
+  return this._children[index];
+};
+
+Element.prototype.setItem = function(index, element)
+{
+  this._children[index] = element;
+};
+
+Element.prototype.delItem = function(index)
+{
+  this._children.splice(index, 1);
+};
+
+Element.prototype.getSlice = function(start, stop)
+{
+  return this._children.slice(start, stop);
+};
+
+Element.prototype.setSlice = function(start, stop, elements)
+{
+  var i;
+  var k = 0;
+  for (i = start; i < stop; i++, k++) {
+    this._children[i] = elements[k];
+  }
+};
+
+Element.prototype.delSlice = function(start, stop)
+{
+  this._children.splice(start, stop - start);
+};
+
+Element.prototype.append = function(element)
+{
+  this._children.push(element);
+};
+
+Element.prototype.extend = function(elements)
+{
+  this._children.concat(elements);
+};
+
+Element.prototype.insert = function(index, element)
+{
+  this._children[index] = element;
+};
+
+Element.prototype.remove = function(index, element)
+{
+  this._children = this._children.filter(function(e) {
+    /* TODO: is this the right way to do this? */
+    if (e._id === element._id) {
+      return false;
+    }
+    return true;
+  });
+};
+
+Element.prototype.getchildren = function() {
+  return this._children;
+};
+
+Element.prototype.find = function(path)
+{
+  return ElementPath.find(this, path);
+};
+
+Element.prototype.findtext = function(path, defvalue)
+{
+  return ElementPath.findtext(this, path, defvalue);
+};
+
+Element.prototype.findall = function(path, defvalue)
+{
+  return ElementPath.findall(this, path, defvalue);
+};
+
+Element.prototype.clear = function()
+{
+  this.attrib = {};
+  this._children = [];
+  this.text = null;
+  this.tail = null;
+};
+
+Element.prototype.get = function(key, defvalue)
+{
+  if (this.attrib[key] !== undefined) {
+    return this.attrib[key];
+  }
+  else {
+    return defvalue;
+  }
+};
+
+Element.prototype.set = function(key, value)
+{
+  this.attrib[key] = value;
+};
+
+Element.prototype.keys = function()
+{
+  return Object.keys(this.attrib);
+};
+
+Element.prototype.items = function()
+{
+  return utils.items(this.attrib);
+};
+
+/*
+ * In python this uses a generator, but in v8 we don't have em,
+ * so we use a callback instead.
+ **/
+Element.prototype.iter = function(tag, callback)
+{
+  var self = this;
+  var i, child;
+
+  if (tag === "*") {
+    tag = null;
+  }
+
+  if (tag === null || this.tag === tag) {
+    callback(self);
+  }
+
+  for (i = 0; i < this._children.length; i++) {
+    child = this._children[i];
+    child.iter(tag, function(e) {
+      callback(e);
+    });
+  }
+};
+
+Element.prototype.itertext = function(callback)
+{
+  this.iter(null, function(e) {
+    if (e.text) {
+      callback(e.text);
+    }
+
+    if (e.tail) {
+      callback(e.tail);
+    }
+  });
+};
+
+
+function SubElement(parent, tag, attrib) {
+  var element = parent.makeelement(tag, attrib);
+  parent.append(element);
+  return element;
+}
+
+function Comment(text) {
+  var element = new Element(Comment);
+  if (text) {
+    element.text = text;
+  }
+  return element;
+}
+
+function ProcessingInstruction(target, text)
+{
+  var element = new Element(ProcessingInstruction);
+  element.text = target;
+  if (text) {
+    element.text = element.text + " " + text;
+  }
+  return element;
+}
+
+function QName(text_or_uri, tag)
+{
+  if (tag) {
+    text_or_uri = sprintf("{%s}%s", text_or_uri, tag);
+  }
+  this.text = text_or_uri;
+}
+
+QName.prototype.toString = function() {
+  return this.text;
+};
+
+function ElementTree(element)
+{
+  this._root = element;
+}
+
+ElementTree.prototype.getroot = function() {
+  return this._root;
+};
+
+ElementTree.prototype._setroot = function(element) {
+  this._root = element;
+};
+
+ElementTree.prototype.parse = function(source, parser) {
+  if (!parser) {
+    parser = get_parser(constants.DEFAULT_PARSER);
+    parser = new parser.XMLParser(new TreeBuilder());
+  }
+
+  parser.feed(source);
+  this._root = parser.close();
+  return this._root;
+};
+
+ElementTree.prototype.iter = function(tag, callback) {
+  this._root.iter(tag, callback);
+};
+
+ElementTree.prototype.find = function(path) {
+  return this._root.find(path);
+};
+
+ElementTree.prototype.findtext = function(path, defvalue) {
+  return this._root.findtext(path, defvalue);
+};
+
+ElementTree.prototype.findall = function(path) {
+  return this._root.findall(path);
+};
+
+/**
+ * Unlike ElementTree, we don't write to a file, we return you a string.
+ */
+ElementTree.prototype.write = function(options) {
+  var sb = [];
+  options = utils.merge({
+    encoding: 'utf-8',
+    xml_declaration: null,
+    default_namespace: null,
+    method: 'xml'}, options);
+
+  if (options.xml_declaration !== false) {
+    sb.push("<?xml version='1.0' encoding='"+options.encoding +"'?>\n");
+  }
+
+  if (options.method === "text") {
+    _serialize_text(sb, self._root, encoding);
+  }
+  else {
+    var qnames, namespaces, indent, indent_string;
+    var x = _namespaces(this._root, options.encoding, options.default_namespace);
+    qnames = x[0];
+    namespaces = x[1];
+
+    if (options.hasOwnProperty('indent')) {
+      indent = 0;
+      indent_string = new Array(options.indent + 1).join(' ');
+    }
+    else {
+      indent = false;
+    }
+
+    if (options.method === "xml") {
+      _serialize_xml(function(data) {
+        sb.push(data);
+      }, this._root, options.encoding, qnames, namespaces, indent, indent_string);
+    }
+    else {
+      /* TODO: html */
+      throw new Error("unknown serialization method "+ options.method);
+    }
+  }
+
+  return sb.join("");
+};
+
+var _namespace_map = {
+    /* "well-known" namespace prefixes */
+    "http://www.w3.org/XML/1998/namespace": "xml",
+    "http://www.w3.org/1999/xhtml": "html",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
+    "http://schemas.xmlsoap.org/wsdl/": "wsdl",
+    /* xml schema */
+    "http://www.w3.org/2001/XMLSchema": "xs",
+    "http://www.w3.org/2001/XMLSchema-instance": "xsi",
+    /* dublic core */
+    "http://purl.org/dc/elements/1.1/": "dc",
+};
+
+function register_namespace(prefix, uri) {
+  if (/ns\d+$/.test(prefix)) {
+    throw new Error('Prefix format reserved for internal use');
+  }
+
+  if (_namespace_map.hasOwnProperty(uri) && _namespace_map[uri] === prefix) {
+    delete _namespace_map[uri];
+  }
+
+  _namespace_map[uri] = prefix;
+}
+
+
+function _escape(text, encoding, isAttribute, isText) {
+  if (text) {
+    text = text.toString();
+    text = text.replace(/&/g, '&amp;');
+    text = text.replace(/</g, '&lt;');
+    text = text.replace(/>/g, '&gt;');
+    if (!isText) {
+        text = text.replace(/\n/g, '&#xA;');
+        text = text.replace(/\r/g, '&#xD;');
+    }
+    if (isAttribute) {
+      text = text.replace(/"/g, '&quot;');
+    }
+  }
+  return text;
+}
+
+/* TODO: benchmark single regex */
+function _escape_attrib(text, encoding) {
+  return _escape(text, encoding, true);
+}
+
+function _escape_cdata(text, encoding) {
+  return _escape(text, encoding, false);
+}
+
+function _escape_text(text, encoding) {
+  return _escape(text, encoding, false, true);
+}
+
+function _namespaces(elem, encoding, default_namespace) {
+  var qnames = {};
+  var namespaces = {};
+
+  if (default_namespace) {
+    namespaces[default_namespace] = "";
+  }
+
+  function encode(text) {
+    return text;
+  }
+
+  function add_qname(qname) {
+    if (qname[0] === "{") {
+      var tmp = qname.substring(1).split("}", 2);
+      var uri = tmp[0];
+      var tag = tmp[1];
+      var prefix = namespaces[uri];
+
+      if (prefix === undefined) {
+        prefix = _namespace_map[uri];
+        if (prefix === undefined) {
+          prefix = "ns" + Object.keys(namespaces).length;
+        }
+        if (prefix !== "xml") {
+          namespaces[uri] = prefix;
+        }
+      }
+
+      if (prefix) {
+        qnames[qname] = sprintf("%s:%s", prefix, tag);
+      }
+      else {
+        qnames[qname] = tag;
+      }
+    }
+    else {
+      if (default_namespace) {
+        throw new Error('cannot use non-qualified names with default_namespace option');
+      }
+
+      qnames[qname] = qname;
+    }
+  }
+
+
+  elem.iter(null, function(e) {
+    var i;
+    var tag = e.tag;
+    var text = e.text;
+    var items = e.items();
+
+    if (tag instanceof QName && qnames[tag.text] === undefined) {
+      add_qname(tag.text);
+    }
+    else if (typeof(tag) === "string") {
+      add_qname(tag);
+    }
+    else if (tag !== null && tag !== Comment && tag !== ProcessingInstruction) {
+      throw new Error('Invalid tag type for serialization: '+ tag);
+    }
+
+    if (text instanceof QName && qnames[text.text] === undefined) {
+      add_qname(text.text);
+    }
+
+    items.forEach(function(item) {
+      var key = item[0],
+          value = item[1];
+      if (key instanceof QName) {
+        key = key.text;
+      }
+
+      if (qnames[key] === undefined) {
+        add_qname(key);
+      }
+
+      if (value instanceof QName && qnames[value.text] === undefined) {
+        add_qname(value.text);
+      }
+    });
+  });
+  return [qnames, namespaces];
+}
+
+function _serialize_xml(write, elem, encoding, qnames, namespaces, indent, indent_string) {
+  var tag = elem.tag;
+  var text = elem.text;
+  var items;
+  var i;
+
+  var newlines = indent || (indent === 0);
+  write(Array(indent + 1).join(indent_string));
+
+  if (tag === Comment) {
+    write(sprintf("<!--%s-->", _escape_cdata(text, encoding)));
+  }
+  else if (tag === ProcessingInstruction) {
+    write(sprintf("<?%s?>", _escape_cdata(text, encoding)));
+  }
+  else {
+    tag = qnames[tag];
+    if (tag === undefined) {
+      if (text) {
+        write(_escape_text(text, encoding));
+      }
+      elem.iter(function(e) {
+        _serialize_xml(write, e, encoding, qnames, null, newlines ? indent + 1 : false, indent_string);
+      });
+    }
+    else {
+      write("<" + tag);
+      items = elem.items();
+
+      if (items || namespaces) {
+        items.sort(); // lexical order
+
+        items.forEach(function(item) {
+          var k = item[0],
+              v = item[1];
+
+            if (k instanceof QName) {
+              k = k.text;
+            }
+
+            if (v instanceof QName) {
+              v = qnames[v.text];
+            }
+            else {
+              v = _escape_attrib(v, encoding);
+            }
+            write(sprintf(" %s=\"%s\"", qnames[k], v));
+        });
+
+        if (namespaces) {
+          items = utils.items(namespaces);
+          items.sort(function(a, b) { return a[1] < b[1]; });
+
+          items.forEach(function(item) {
+            var k = item[1],
+                v = item[0];
+
+            if (k) {
+              k = ':' + k;
+            }
+
+            write(sprintf(" xmlns%s=\"%s\"", k, _escape_attrib(v, encoding)));
+          });
+        }
+      }
+
+      if (text || elem.len()) {
+        if (text && text.toString().match(/^\s*$/)) {
+            text = null;
+        }
+
+        write(">");
+        if (!text && newlines) {
+          write("\n");
+        }
+
+        if (text) {
+          write(_escape_text(text, encoding));
+        }
+        elem._children.forEach(function(e) {
+          _serialize_xml(write, e, encoding, qnames, null, newlines ? indent + 1 : false, indent_string);
+        });
+
+        if (!text && indent) {
+          write(Array(indent + 1).join(indent_string));
+        }
+        write("</" + tag + ">");
+      }
+      else {
+        write(" />");
+      }
+    }
+  }
+
+  if (newlines) {
+    write("\n");
+  }
+}
+
+function parse(source, parser) {
+  var tree = new ElementTree();
+  tree.parse(source, parser);
+  return tree;
+}
+
+function tostring(element, options) {
+  return new ElementTree(element).write(options);
+}
+
+exports.PI = ProcessingInstruction;
+exports.Comment = Comment;
+exports.ProcessingInstruction = ProcessingInstruction;
+exports.SubElement = SubElement;
+exports.QName = QName;
+exports.ElementTree = ElementTree;
+exports.ElementPath = ElementPath;
+exports.Element = function(tag, attrib) {
+  return new Element(tag, attrib);
+};
+
+exports.XML = function(data) {
+  var et = new ElementTree();
+  return et.parse(data);
+};
+
+exports.parse = parse;
+exports.register_namespace = register_namespace;
+exports.tostring = tostring;


Mime
View raw message