You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/05/23 23:58:05 UTC
[08/50] Add WP7 and WP8 platform files.
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/cordova.js b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/cordova.js
new file mode 100644
index 0000000..6778e2b
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/cordova.js
@@ -0,0 +1,14 @@
+var VERSION='2.5.0';
+var scripts = document.getElementsByTagName('script');
+var cordovaPath = scripts[scripts.length - 1].src.replace('cordova.js', 'cordova-'+VERSION+'.js');
+
+document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>');
+
+function backHome() {
+ if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
+ navigator.app.backHistory();
+ }
+ else {
+ window.history.go(-1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/events/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/events/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/events/index.html
new file mode 100644
index 0000000..2c7e8ba
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/events/index.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ function interceptBackbutton() {
+ eventOutput("Back button intercepted");
+ }
+ function interceptMenubutton() {
+ eventOutput("Menu button intercepted");
+ }
+ function interceptSearchbutton() {
+ eventOutput("Search button intercepted");
+ }
+ function interceptResume() {
+ eventOutput("Resume event intercepted");
+ }
+ function interceptPause() {
+ eventOutput("Pause event intercepted");
+ }
+ function interceptOnline() {
+ eventOutput("Online event intercepted");
+ }
+ function interceptOffline() {
+ eventOutput("Offline event intercepted");
+ }
+
+ var eventOutput = function(s) {
+ var el = document.getElementById("results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ eventOutput("deviceready event: "+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Events</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="results"></span>
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="document.addEventListener('backbutton', interceptBackbutton, false);">Intercept backbutton</div>
+ <div class="btn large" onclick="document.removeEventListener('backbutton', interceptBackbutton, false);">Stop intercept of backbutton</div>
+ <div class="btn large" onclick="document.addEventListener('menubutton', interceptMenubutton, false);">Intercept menubutton</div>
+ <div class="btn large" onclick="document.removeEventListener('menubutton', interceptMenubutton, false);">Stop intercept of menubutton</div>
+ <div class="btn large" onclick="document.addEventListener('searchbutton', interceptSearchbutton, false);">Intercept searchbutton</div>
+ <div class="btn large" onclick="document.removeEventListener('searchbutton', interceptSearchbutton, false);">Stop intercept of searchbutton</div>
+ <div class="btn large" onclick="document.addEventListener('resume', interceptResume, false);">Intercept resume</div>
+ <div class="btn large" onclick="document.removeEventListener('resume', interceptResume, false);">Stop intercept of resume</div>
+ <div class="btn large" onclick="document.addEventListener('pause', interceptPause, false);">Intercept pause</div>
+ <div class="btn large" onclick="document.removeEventListener('pause', interceptPause, false);">Stop intercept of pause</div>
+ <div class="btn large" onclick="document.addEventListener('online', interceptOnline, false);">Intercept online</div>
+ <div class="btn large" onclick="document.removeEventListener('online', interceptOnline, false);">Stop intercept of online</div>
+ <div class="btn large" onclick="document.addEventListener('offline', interceptOffline, false);">Intercept offline</div>
+ <div class="btn large" onclick="document.removeEventListener('offline', interceptOffline, false);">Stop intercept of offline</div>
+
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/index.html
new file mode 100644
index 0000000..e7a77e0
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/index.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="main.js"></script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+ <h1>Apache Cordova Tests</h1>
+ <div id="info">
+ <h4>Platform: <span id="platform"> </span></h4>
+ <h4>Version: <span id="version"> </span></h4>
+ <h4>UUID: <span id="uuid"> </span></h4>
+ <h4>Name: <span id="name"> </span></h4>
+ <h4>Width: <span id="width"> </span>, Height: <span id="height">
+ </span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <a href="autotest/index.html" class="btn large">Automatic Test</a>
+ <a href="accelerometer/index.html" class="btn large">Accelerometer</a>
+ <a href="audio/index.html" class="btn large">Audio Play/Record</a>
+ <a href="battery/index.html" class="btn large">Battery</a>
+ <a href="camera/index.html" class="btn large">Camera</a>
+ <a href="compass/index.html" class="btn large">Compass</a>
+ <a href="contacts/index.html" class="btn large">Contacts</a>
+ <a href="events/index.html" class="btn large">Events</a>
+ <a href="location/index.html" class="btn large">Location</a>
+ <a href="misc/index.html" class="btn large">Misc Content</a>
+ <a href="network/index.html" class="btn large">Network</a>
+ <a href="notification/index.html" class="btn large">Notification</a>
+ <a href="sql/index.html" class="btn large">Web SQL</a>
+ <a href="storage/index.html" class="btn large">Local Storage</a>
+ <a href="execbenchmark/index.html" class="btn large">Benchmark exec()</a>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/location/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/location/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/location/index.html
new file mode 100644
index 0000000..8b1e681
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/location/index.html
@@ -0,0 +1,147 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ //-------------------------------------------------------------------------
+ // Location
+ //-------------------------------------------------------------------------
+ var watchLocationId = null;
+
+ /**
+ * Start watching location
+ */
+ var watchLocation = function(geo) {
+ console.log("watchLocation()");
+
+ // Success callback
+ var success = function(p){
+ console.log('watch location success');
+ setLocationDetails(p);
+ };
+
+ // Fail callback
+ var fail = function(e){
+ console.log("watchLocation fail callback with error code "+e);
+ stopLocation(geo);
+ };
+
+ // Get location
+ watchLocationId = geo.watchPosition(success, fail, {enableHighAccuracy: true});
+ setLocationStatus("Running");
+ };
+
+ /**
+ * Stop watching the location
+ */
+ var stopLocation = function(geo) {
+ setLocationStatus("Stopped");
+ if (watchLocationId) {
+ geo.clearWatch(watchLocationId);
+ watchLocationId = null;
+ }
+ };
+
+ /**
+ * Get current location
+ */
+ var getLocation = function(geo, opts) {
+ console.log("getLocation()");
+
+ // Stop location if running
+ stopLocation(geo);
+
+ // Success callback
+ var success = function(p){
+ console.log('get location success');
+ setLocationDetails(p);
+ setLocationStatus("Done");
+ };
+
+ // Fail callback
+ var fail = function(e){
+ console.log("getLocation fail callback with error code "+e.code);
+ setLocationStatus("Error: "+e.code);
+ };
+
+ // Get location
+ geo.getCurrentPosition(success, fail, opts || {enableHighAccuracy: true}); //, {timeout: 10000});
+ setLocationStatus("Retrieving location...");
+
+ };
+
+ /**
+ * Set location status
+ */
+ var setLocationStatus = function(status) {
+ document.getElementById('location_status').innerHTML = status;
+ };
+var setLocationDetails = function(p) {
+var date = (new Date(p.timestamp));
+ document.getElementById('latitude').innerHTML = p.coords.latitude;
+ document.getElementById('longitude').innerHTML = p.coords.longitude;
+ document.getElementById('altitude').innerHTML = p.coords.altitude;
+ document.getElementById('accuracy').innerHTML = p.coords.accuracy;
+ document.getElementById('heading').innerHTML = p.coords.heading;
+ document.getElementById('speed').innerHTML = p.coords.speed;
+ document.getElementById('altitude_accuracy').innerHTML = p.coords.altitudeAccuracy;
+ document.getElementById('timestamp').innerHTML = date.toDateString() + " " + date.toTimeString();
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Location</h1>
+ <div id="info">
+ <b>Status:</b> <span id="location_status">Stopped</span>
+ <table width="100%">
+ <tr><td><b>Latitude:</b></td><td id="latitude"> </td></tr>
+ <tr><td><b>Longitude:</b></td><td id="longitude"> </td></tr>
+ <tr><td><b>Altitude:</b></td><td id="altitude"> </td></tr>
+ <tr><td><b>Accuracy:</b></td><td id="accuracy"> </td></tr>
+ <tr><td><b>Heading:</b></td><td id="heading"> </td></tr>
+ <tr><td><b>Speed:</b></td><td id="speed"> </td></tr>
+ <tr><td><b>Altitude Accuracy:</b></td><td id="altitude_accuracy"> </td></tr>
+ <tr><td><b>Time:</b></td><td id="timestamp"> </td></tr>
+ </table>
+ </div>
+ <h2>Action</h2>
+ <h3>Use Built-in WebView navigator.geolocation</h3>
+ <a href="javascript:" class="btn large" onclick="getLocation(navigator.geolocation);">Get Location</a>
+ <a href="javascript:" class="btn large" onclick="watchLocation(navigator.geolocation);">Start Watching Location</a>
+ <a href="javascript:" class="btn large" onclick="stopLocation(navigator.geolocation);">Stop Watching Location</a>
+ <a href="javascript:" class="btn large" onclick="getLocation(navigator.geolocation, {maximumAge:30000});">Get Location Up to 30 Seconds Old</a>
+ <h3>USe Cordova Geolocation Plugin</h3>
+ <a href="javascript:" class="btn large" onclick="getLocation(cordova.require('cordova/plugin/geolocation'));">Get Location</a>
+ <a href="javascript:" class="btn large" onclick="watchLocation(cordova.require('cordova/plugin/geolocation'));">Start Watching Location</a>
+ <a href="javascript:" class="btn large" onclick="stopLocation(cordova.require('cordova/plugin/geolocation'));">Stop Watching Location</a>
+ <a href="javascript:" class="btn large" onclick="getLocation(cordova.require('cordova/plugin/geolocation'), {maximumAge:30000});">Get Location Up to 30 Seconds Old</a>
+ <h2> </h2><a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/main.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/main.js b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/main.js
new file mode 100644
index 0000000..ae447aa
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/main.js
@@ -0,0 +1,140 @@
+var deviceInfo = function() {
+ document.getElementById("platform").innerHTML = device.platform;
+ document.getElementById("version").innerHTML = device.version;
+ document.getElementById("uuid").innerHTML = device.uuid;
+ document.getElementById("name").innerHTML = device.name;
+ document.getElementById("width").innerHTML = screen.width;
+ document.getElementById("height").innerHTML = screen.height;
+ document.getElementById("colorDepth").innerHTML = screen.colorDepth;
+};
+
+var getLocation = function() {
+ var suc = function(p) {
+ alert(p.coords.latitude + " " + p.coords.longitude);
+ };
+ var locFail = function() {
+ };
+ navigator.geolocation.getCurrentPosition(suc, locFail);
+};
+
+var beep = function() {
+ navigator.notification.beep(2);
+};
+
+var vibrate = function() {
+ navigator.notification.vibrate(0);
+};
+
+function roundNumber(num) {
+ var dec = 3;
+ var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+ return result;
+}
+
+var accelerationWatch = null;
+
+function updateAcceleration(a) {
+ document.getElementById('x').innerHTML = roundNumber(a.x);
+ document.getElementById('y').innerHTML = roundNumber(a.y);
+ document.getElementById('z').innerHTML = roundNumber(a.z);
+}
+
+var toggleAccel = function() {
+ if (accelerationWatch !== null) {
+ navigator.accelerometer.clearWatch(accelerationWatch);
+ updateAcceleration({
+ x : "",
+ y : "",
+ z : ""
+ });
+ accelerationWatch = null;
+ } else {
+ var options = {};
+ options.frequency = 1000;
+ accelerationWatch = navigator.accelerometer.watchAcceleration(
+ updateAcceleration, function(ex) {
+ alert("accel fail (" + ex.name + ": " + ex.message + ")");
+ }, options);
+ }
+};
+
+var preventBehavior = function(e) {
+ e.preventDefault();
+};
+
+function dump_pic(data) {
+ var viewport = document.getElementById('viewport');
+ console.log(data);
+ viewport.style.display = "";
+ viewport.style.position = "absolute";
+ viewport.style.top = "10px";
+ viewport.style.left = "10px";
+ document.getElementById("test_img").src = "data:image/jpeg;base64," + data;
+}
+
+function fail(msg) {
+ alert(msg);
+}
+
+function show_pic() {
+ navigator.camera.getPicture(dump_pic, fail, {
+ quality : 50
+ });
+}
+
+function close() {
+ var viewport = document.getElementById('viewport');
+ viewport.style.position = "relative";
+ viewport.style.display = "none";
+}
+
+// This is just to do this.
+function readFile() {
+ navigator.file.read('/sdcard/phonegap.txt', fail, fail);
+}
+
+function writeFile() {
+ navigator.file.write('foo.txt', "This is a test of writing to a file",
+ fail, fail);
+}
+
+function contacts_success(contacts) {
+ alert(contacts.length
+ + ' contacts returned.'
+ + (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted)
+ : ''));
+}
+
+function get_contacts() {
+ var obj = new ContactFindOptions();
+ obj.filter = "";
+ obj.multiple = true;
+ obj.limit = 5;
+ navigator.service.contacts.find(
+ [ "displayName", "name" ], contacts_success,
+ fail, obj);
+}
+
+var networkReachableCallback = function(reachability) {
+ // There is no consistency on the format of reachability
+ var networkState = reachability.code || reachability;
+
+ var currentState = {};
+ currentState[NetworkStatus.NOT_REACHABLE] = 'No network connection';
+ currentState[NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK] = 'Carrier data connection';
+ currentState[NetworkStatus.REACHABLE_VIA_WIFI_NETWORK] = 'WiFi connection';
+
+ confirm("Connection type:\n" + currentState[networkState]);
+};
+
+function check_network() {
+ navigator.network.isReachable("www.mobiledevelopersolutions.com",
+ networkReachableCallback, {});
+}
+
+function init() {
+ // the next line makes it impossible to see Contacts on the HTC Evo since it
+ // doesn't have a scroll button
+ // document.addEventListener("touchmove", preventBehavior, false);
+ document.addEventListener("deviceready", deviceInfo, true);
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/master.css
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/master.css b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/master.css
new file mode 100644
index 0000000..2408052
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/master.css
@@ -0,0 +1,136 @@
+ body {
+ background:#222 none repeat scroll 0 0;
+ color:#666;
+ font-family:Helvetica;
+ font-size:72%;
+ line-height:1.5em;
+ margin:0;
+ border-top:1px solid #393939;
+ }
+
+ #info{
+ background:#ffa;
+ border: 1px solid #ffd324;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ clear:both;
+ margin:15px 6px 0;
+ width:295px;
+ padding:4px 0px 2px 10px;
+ }
+
+ #info > h4{
+ font-size:.95em;
+ margin:5px 0;
+ }
+
+ #stage.theme{
+ padding-top:3px;
+ }
+
+ /* Definition List */
+ #stage.theme > dl{
+ padding-top:10px;
+ clear:both;
+ margin:0;
+ list-style-type:none;
+ padding-left:10px;
+ overflow:auto;
+ }
+
+ #stage.theme > dl > dt{
+ font-weight:bold;
+ float:left;
+ margin-left:5px;
+ }
+
+ #stage.theme > dl > dd{
+ width:45px;
+ float:left;
+ color:#a87;
+ font-weight:bold;
+ }
+
+ /* Content Styling */
+ #stage.theme > h1, #stage.theme > h2, #stage.theme > p{
+ margin:1em 0 .5em 13px;
+ }
+
+ #stage.theme > h1{
+ color:#eee;
+ font-size:1.6em;
+ text-align:center;
+ margin:0;
+ margin-top:15px;
+ padding:0;
+ }
+
+ #stage.theme > h2{
+ clear:both;
+ margin:0;
+ padding:3px;
+ font-size:1em;
+ text-align:center;
+ }
+
+ /* Stage Buttons */
+ #stage.theme .btn{
+ border: 1px solid #555;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align:center;
+ display:block;
+ float:left;
+ background:#444;
+ width:150px;
+ color:#9ab;
+ font-size:1.1em;
+ text-decoration:none;
+ padding:1.2em 0;
+ margin:3px 0px 3px 5px;
+ }
+
+ #stage.theme .large{
+ width:308px;
+ padding:1.2em 0;
+ }
+
+ #stage.theme .wide{
+ width:100%;
+ padding:1.2em 0;
+ }
+
+ #stage.theme .backBtn{
+ border: 1px solid #555;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align:center;
+ display:block;
+ float:right;
+ background:#666;
+ width:75px;
+ color:#9ab;
+ font-size:1.1em;
+ text-decoration:none;
+ padding:1.2em 0;
+ margin:3px 5px 3px 5px;
+ }
+
+ #stage.theme .input{
+ border: 1px solid #555;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align:center;
+ display:block;
+ float:light;
+ background:#888;
+ color:#9cd;
+ font-size:1.1em;
+ text-decoration:none;
+ padding:1.2em 0;
+ margin:3px 0px 3px 5px;
+ }
+
+ #stage.theme .numeric{
+ width:100%;
+ }
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/index.html
new file mode 100644
index 0000000..697cb10
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/index.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ function roundNumber(num) {
+ var dec = 3;
+ var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
+ return result;
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Display Other Content</h1>
+ <div id="info">
+ </div>
+ <h2>Action</h2>
+ <div class="btn large" onclick="document.location='tel:5551212';" >Call 411</div>
+ <a href="mailto:bob@abc.org?subject=My Subject&body=This is the body.%0D%0ANew line." class="btn large">Send Mail</a>
+ <a href="sms:5125551234?body=The SMS message." class="btn large">Send SMS</a>
+ <a href="http://www.google.com" class="btn large">Load Web Site</a>
+ <!-- Need new URL -->
+ <!-- a href="http://handle.library.cornell.edu/control/authBasic/authTest/" class="btn large">Basic Auth: test/this</a -->
+ <a href="page2.html" hrefbad="page2.html?me=test" class="btn large">Load another PhoneGap page</a>
+ <h2>Android Only</h2>
+ <a href="geo:0,0?q=11400 Burnet Rd, Austin, TX" class="btn large">Map IBM</a>
+ <a href="market://search?q=google" class="btn large">Search Android market</a>
+ <a href="content://media/external/images/media" class="btn large">View image app</a>
+
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/page2.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/page2.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/page2.html
new file mode 100644
index 0000000..22026fc
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/misc/page2.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../main.js"></script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+ <h1>Page2 App</h1>
+ <h2>This is page 2 of a PhoneGap app</h2>
+ <div id="info">
+ <h4>Platform: <span id="platform"> </span></h4>
+ <h4>Version: <span id="version"> </span></h4>
+ <h4>UUID: <span id="uuid"> </span></h4>
+ <h4>Name: <span id="name"> </span></h4>
+ <h4>Width: <span id="width"> </span>, Height: <span id="height">
+ </span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <div ><button class="backBtn" onclick="backHome();">Back</button></div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/network/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/network/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/network/index.html
new file mode 100644
index 0000000..0b2204b
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/network/index.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ var eventOutput = function(s) {
+ var el = document.getElementById("results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+ function printNetwork() {
+ eventOutput("Current network connection type is: " + navigator.network.connection.type);
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ eventOutput("Network Connection is: " + navigator.network.connection.type);
+ document.addEventListener('online', function() { eventOutput('Online event, connection is: ' + navigator.network.connection.type); }, false);
+ document.addEventListener('offline', function() { eventOutput('Offline event, connection is: ' + navigator.network.connection.type); }, false);
+
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: Cordova did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Network Events and State</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="results"></span>
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="printNetwork();">Show Network Connection</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/notification/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/notification/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/notification/index.html
new file mode 100644
index 0000000..e5c0d17
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/notification/index.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ //-------------------------------------------------------------------------
+ // Notifications
+ //-------------------------------------------------------------------------
+
+ var beep = function(){
+ navigator.notification.beep(3);
+ };
+
+ var vibrate = function(){
+ navigator.notification.vibrate(1000);
+ };
+
+ var alertDialog = function(message, title, button) {
+ console.log("alertDialog()");
+ navigator.notification.alert(message,
+ function(){
+ console.log("Alert dismissed.");
+ },
+ title, button);
+ console.log("After alert");
+ };
+
+ var confirmDialog = function(message, title, buttons) {
+ navigator.notification.confirm(message,
+ function(r) {
+ console.log("You selected " + r);
+ alert("You selected " + (buttons.split(","))[r-1]);
+ },
+ title,
+ buttons);
+ };
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Notifications and Dialogs</h1>
+ <div id="info">
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="beep();">Beep</div>
+ <div class="btn large" onclick="vibrate();">Vibrate</div>
+ <div class="btn large" onclick="alertDialog('You pressed alert.', 'Alert Dialog', 'Continue');">Alert Dialog</div>
+ <div class="btn large" onclick="confirmDialog('You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe');">Confirm Dialog</div>
+ <div class="btn large" onclick="alert('You pressed alert.');">Built-in Alert Dialog</div>
+ <div class="btn large" onclick="confirm('You selected confirm');">Built-in Confirm Dialog</div>
+ <div class="btn large" onclick="prompt('This is a prompt.', 'Default value');">Built-in Prompt Dialog</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/sql/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/sql/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/sql/index.html
new file mode 100644
index 0000000..116f8d1
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/sql/index.html
@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ //-------------------------------------------------------------------------
+ // HTML5 Database
+ //-------------------------------------------------------------------------
+ var db;
+ var callDatabase = function() {
+ db = openDatabase("mydb", "1.0", "PhoneGap Demo", 20000);
+ if (db === null) {
+ databaseOutput("Database could not be opened.");
+ return;
+ }
+ databaseOutput("Database opened.");
+ db.transaction(function (tx) {
+ tx.executeSql('DROP TABLE IF EXISTS DEMO');
+ tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)', [],
+ function(tx,results) { console.log("Created table"); },
+ function(tx,err) { alert("Error creating table: "+err.message); });
+ tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")', [],
+ function(tx,results) { console.log("Insert row1 success"); },
+ function(tx,err) { alert("Error adding 1st row: "+err.message); });
+ tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")', [],
+ function(tx,results) { console.log("Insert row2 success"); },
+ function(tx,err) { alert("Error adding 2nd row: "+err.message); });
+ databaseOutput("Data written to DEMO table.");
+ console.log("Data written to DEMO table.");
+
+ tx.executeSql('SELECT * FROM DEMO', [], function (tx, results) {
+ var len = results.rows.length;
+ var text = "DEMO table: " + len + " rows found.<br>";
+ text = text + "<table border='1'><tr><td>Row</td><td>Data</td></tr>";
+ for (var i=0; i<len; i++){
+ text = text + "<tr><td>" + i + "</td><td>" + results.rows.item(i).id + ", " + results.rows.item(i).data + "</td></tr>";
+ }
+ text = text + "</table>";
+ databaseOutput(text);
+ }, function(tx, err) {
+ alert("Error processing SELECT * SQL: "+err.message);
+ });
+ tx.executeSql('SELECT ID FROM DEMO', [], function (tx, results) {
+ var len = results.rows.length;
+ var text = "DEMO table: " + len + " rows found.<br>";
+ text = text + "<table border='1'><tr><td>Row</td><td>Data</td></tr>";
+ for (var i=0; i<len; i++){
+ text = text + "<tr><td>" + i + "</td><td>" + results.rows.item(i).id + "</td></tr>";
+ }
+ text = text + "</table>";
+ databaseOutput(text);
+ }, function(tx, err) {
+ alert("Error processing SELECT ID SQL: "+err.message);
+ });
+
+ },
+ function(err) {
+ console.log("Transaction failed: " + err.message);
+ });
+
+
+ };
+
+ var readDatabase = function() {
+ if (!db) {
+ db = openDatabase("mydb", "1.0", "PhoneGap Demo", 20000);
+ if (db === null) {
+ databaseOutput("Database could not be opened.");
+ return;
+ }
+ }
+ db.transaction(function (tx) {
+ tx.executeSql('SELECT * FROM DEMO WHERE id=2', [], function (tx, results) {
+ var len = results.rows.length;
+ var text = "DEMO table: " + len + " rows found.<br>";
+ text = text + "<table border='1'><tr><td>Row</td><td>Data</td></tr>";
+ for (var i=0; i<len; i++){
+ text = text + "<tr><td>" + i + "</td><td>" + results.rows.item(i).id + ", " + results.rows.item(i).data + "</td></tr>";
+ }
+ text = text + "</table>";
+ databaseOutput(text);
+ }, function(tx, err) {
+ alert("Error processing SELECT * WHERE id=2 SQL: "+err.message);
+ });
+ });
+ }
+
+ var databaseOutput = function(s) {
+ var el = document.getElementById("database_results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>HTML5 Database</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="database_results"></span>
+ </div>
+ <h2>Action</h2>
+ <div class="btn large" onclick="callDatabase();">Create, Add, Read Database</div>
+ <div class="btn large" onclick="readDatabase();">Read Database</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/MobileSpecUnitTests/www/storage/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/MobileSpecUnitTests/www/storage/index.html b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/storage/index.html
new file mode 100644
index 0000000..85a0dbd
--- /dev/null
+++ b/lib/cordova-wp8/tests/MobileSpecUnitTests/www/storage/index.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Local Storage</h1>
+ <div id="info">
+ You have run this app <span id="count">an untold number of</span> time(s).
+ </div>
+
+ <script>
+ if (!localStorage.pageLoadCount) {
+ localStorage.pageLoadCount = 0;
+ }
+ localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
+ document.getElementById('count').textContent = localStorage.pageLoadCount;
+ </script>
+
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tests/README.md
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tests/README.md b/lib/cordova-wp8/tests/README.md
new file mode 100644
index 0000000..d095927
--- /dev/null
+++ b/lib/cordova-wp8/tests/README.md
@@ -0,0 +1,7 @@
+Tests Have Moved
+===
+
+Tests now live in the MobileSpec repo at:
+https://github.com/apache/cordova-mobile-spec
+
+You will need to create a new project, and add the mobile-spec files to it to run the tests.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/buildjs.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/buildjs.bat b/lib/cordova-wp8/tooling/scripts/buildjs.bat
new file mode 100644
index 0000000..28d2423
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/buildjs.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\buildjs.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/buildjs.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/buildjs.js b/lib/cordova-wp8/tooling/scripts/buildjs.js
new file mode 100644
index 0000000..78e213c
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/buildjs.js
@@ -0,0 +1,214 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ //Sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ //Sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ //Sub folder for full project
+ FULL_PATH = TEMPLATES_PATH + '\\full',
+ CUSTOM_PATH = TEMPLATES_PATH + '\\custom',
+ //Sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ //Subfolder containing example project
+ EXAMPLE_PATH = '\\example',
+ //Git Repositories
+ CORDOVA_JS = "https://git-wip-us.apache.org/repos/asf/cordova-js.git",
+ // get version
+ VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
+ BUILD_DESTINATION;
+
+function Log(msg) {
+ WScript.StdOut.WriteLine(msg);
+}
+
+// help function
+function Usage()
+{
+ Log("");
+ Log("This Script builds the given virsion of cordova.js and injects it into this or the given cordova-wp8 ");
+ Log("");
+ Log("Usage: buildjs [ Version PathTOCordovaWP8 ]");
+ Log(" Version : The version of cordova.js to build (must already be tagged)");
+ Log(" PathTOCordovaWP8 : The path to the cordova directory where the new cordova.js will go.");
+ Log("examples:");
+ Log(" buildjs 2.5.0rc1 //Puts cordova-2.5.0rc1 as the cordova.js in the current working directory");
+ Log(" buildjs 2.4.0 C:\\Users\\anonymous\\Desktop\\cordova-wp8 //Puts cordova-2.4.0.js in the given directory");
+ Log(" buildjs //Builds the version of cordova.js from the root folder and adds it to the working directory repo");
+ Log("");
+}
+
+// returns the contents of a file
+function read(filename) {
+ //Log('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ Log('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ WScript.sleep(100);
+ }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+ //Log("Command: " + command);
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ //Wait a little bit so we're not super looping
+ WScript.sleep(100);
+ //Print any stdout output from the script
+ if(!oShell.StdOut.AtEndOfStream) {
+ var line = oShell.StdOut.ReadLine();
+ Log(line);
+ }
+ }
+ //Check to make sure our scripts did not encounter an error
+ if(!oShell.StdErr.AtEndOfStream)
+ {
+ var err_line = oShell.StdErr.ReadAll();
+ WScript.StdErr.WriteLine(err_line);
+ WScript.Quit(1);
+ }
+}
+
+function build_js(path)
+{
+ if(fso.FolderExists(path + '\\temp'))
+ {
+ fso.DeleteFolder(path + '\\temp', true);
+ }
+ fso.CreateFolder(path + '\\temp');
+ wscript_shell.CurrentDirectory = path + '\\temp';
+
+ Log('\tCloning js tagged with ' + VERSION + '...');
+ exec('%comspec% /c git clone ' + CORDOVA_JS + ' && cd cordova-js && git fetch && git checkout ' + VERSION );
+ if(!fso.FolderExists(path + '\\temp\\cordova-js'))
+ {
+ WScript.StdErr.WriteLine("ERROR: Failed to clone cordova-js. Aborting...");
+ WScript.Quit(1);
+ }
+ wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js';
+ Log("Building Cordova.js...");
+
+ exec_verbose('%comspec% /c jake build');
+ if(!fso.FolderExists(path + '\\temp\\cordova-js\\pkg'))
+ {
+ WScript.StdErr.WriteLine("ERROR: Failed to build cordova-js. Aborting...");
+ WScript.Quit(1);
+ }
+
+ //copy the javascript wherever it needs to go.
+ wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js\\pkg';
+ exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova-' + VERSION + '.js');
+ exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + FULL_PATH + '\\www\\cordova-' + VERSION + '.js');
+ exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + CUSTOM_PATH + '\\www\\cordova-' + VERSION + '.js');
+ exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova-' + VERSION + '.js');
+
+ //TODO: Delete old cordova.js (done in reversion.js)
+
+ Log("SUCESS");
+}
+
+function set_path(some_arg)
+{
+ if(some_arg.indexOf('-p:')!= -1)
+ {
+ var path = some_arg.split('-p:')[1];
+ if(fso.FolderExists(path) && fso.FolderExists(path + '\\tooling'))
+ {
+ BUILD_DESTINATION = path;
+ return true;
+ }
+ else
+ {
+ Log("ERROR: The given path is not a cordova-wp8 repo, or");
+ Log(" does not exist. If your trying to reversion a");
+ Log(" cordova repo other then this one, please provide");
+ Log(" it's path in the form: -p:C:\\Path\\to\\repo");
+ WScript.Quit(1);
+ }
+
+ }
+ return false;
+}
+
+Log("");
+
+if(args.Count() > 1)
+{
+ set_path(args(1));
+}
+
+if(args.Count() > 0)
+{
+ //Support help flags
+ if(args(0).indexOf("--help") > -1 ||
+ args(0).indexOf("/?") > -1 )
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+
+ if(args(0).match(/(\d+)[.](\d+)[.](\d+)(rc\d)?/))
+ {
+ VERSION = args(0);
+ if(args.Count() == 1)
+ {
+ BUILD_DESTINATION = ROOT;
+ }
+ }
+ else if(set_path(arg(0))) {} //do nothing
+ else
+ {
+ Log("The provided version number is invalid, please provide");
+ Log(" a version number in the format Major.Minor.Fix[rc#]");
+ Usage();
+ WScript.Quit(1);
+ }
+}
+else
+{
+ BUILD_DESTINATION = ROOT;
+}
+
+//If we haven't quit by here, build the damn javascript!
+Log("Creating js for " + BUILD_DESTINATION);
+build_js(BUILD_DESTINATION);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/dist.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/dist.bat b/lib/cordova-wp8/tooling/scripts/dist.bat
new file mode 100644
index 0000000..a1c0e1d
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/dist.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\dist.js" %* //nologo
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/dist.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/dist.js b/lib/cordova-wp8/tooling/scripts/dist.js
new file mode 100644
index 0000000..9dd93e6
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/dist.js
@@ -0,0 +1,202 @@
+/*
+ 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.
+*/
+
+
+/*************************************************/
+/**************** REQUIREMENTS *****************/
+/*************************************************/
+/*
+Paths:
+ - path to git.exe -> C:\msysgit\bin
+ - path to msbuild -> C:\Windows\Microsoft.NET\Framework\v4.0.30319
+Famework
+ - .NET 4.0
+ - Windows phone SDKs
+
+
+/************ Globals ********/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+//Replace root directory or create new directory?
+var REPLACE = false;
+
+//Set up directory structure of current release
+ //arguments passed in
+var args = WScript.Arguments,
+ //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ // tooling scripts
+ SCRIPTS = '\\tooling\\scripts';
+ //Get version number
+ VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
+
+//Destination to build to
+var BUILD_DESTINATION;
+//current script that is running
+var current_script = "dist";
+
+
+/*************************************************/
+/**************** FUNCTIONS ********************/
+/*************************************************/
+
+function Log(msg) {
+ WScript.StdOut.WriteLine(msg);
+}
+
+// help function
+function Usage()
+{
+ Log("");
+ Log("This is a command line tool for building new releases. It will package a new release");
+ Log(" of a cordova-wp8 project, reversioning it to match the VERSION file in the root directory.");
+ Log("Usage: dist [ <NEW_PATH_FOR_BUILD> | -f ] ");
+ Log(" -f : force tool to reversion the current repositoy.");
+ Log(" <NEW_PATH_FOR_BUILD> : path to create the new reversioned repositoy in.");
+ Log("");
+}
+
+
+// returns the contents of a file
+function read(filename) {
+ //WScript.Echo('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ Log('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+ Log("Command: " + command);
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ //Wait a little bit so we're not super looping
+ WScript.sleep(100);
+ //Print any stdout output from the script
+ if(!oShell.StdOut.AtEndOfStream) {
+ var line = oShell.StdOut.ReadLine();
+ Log(line);
+ }
+ }
+ //Check to make sure our scripts did not encounter an error
+ if(!oShell.StdErr.AtEndOfStream)
+ {
+ var err_line = oShell.StdErr.ReadAll();
+ WScript.StdErr.WriteLine(err_line);
+ WScript.StdErr.WriteLine("ERROR: Could not complete distribution, failed while running: " + current_script);
+ WScript.Quit(1);
+ }
+}
+
+function space()
+{
+ Log("");
+ Log("*****************************************************");
+ Log("");
+}
+
+
+/*************************************************/
+/************** MAIN SCRIPT ********************/
+/*************************************************/
+
+if(REPLACE)
+{
+ BUILD_DESTINATION = ROOT;
+}
+else if(args.Count() > 0)
+{
+ if(args(0) == '-f') {
+ REPLACE = true;
+ BUILD_DESTINATION = ROOT;
+ } else {
+ BUILD_DESTINATION = args(0);
+ //Support help flags
+ if(BUILD_DESTINATION.indexOf("--help") > -1 ||
+ BUILD_DESTINATION.indexOf("/?") > -1 )
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+ }
+
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
+
+
+/*************************************************/
+/****************** Step 1 *********************/
+/*************************************************/
+/** - Copy source code to new directory **/
+/*************************************************/
+if (!REPLACE) {
+ current_script = "new.js";
+ exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + ' //nologo');
+ space();
+}
+
+/*************************************************/
+/****************** Step 2 *********************/
+/*************************************************/
+/** - Retag everything with new version numbers **/
+/** - Delete any generated files and cordova.js **/
+/** - Rebuild dll **/
+/*************************************************/
+current_script = "reversion.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\reversion.js ' + VERSION + ' //nologo');
+space();
+
+/*************************************************/
+/****************** Step 3 *********************/
+/*************************************************/
+/** - Download tagged version of cordova.js **/
+/** - build cordova.js **/
+/** - windows.cordova.js -> templates + example **/
+/*************************************************/
+current_script = "buildjs.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
+space();
+
+/*************************************************/
+/****************** Step 5 *********************/
+/*************************************************/
+/** - Build templates **/
+/** - Zip templates **/
+/** - inject into Visual Studio **/
+/*************************************************/
+current_script = "package.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\package.js //nologo');
+space();
+Log("Distribution Complete.");
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/new.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/new.bat b/lib/cordova-wp8/tooling/scripts/new.bat
new file mode 100644
index 0000000..cb08e2e
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/new.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\new.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/new.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/new.js b/lib/cordova-wp8/tooling/scripts/new.js
new file mode 100644
index 0000000..7462965
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/new.js
@@ -0,0 +1,151 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ //Sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ //Sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ //Subfolder containing example project
+ EXAMPLE_PATH = '\\example';
+// git repo for cordova-wp8
+var CORDOVA_WP8 = 'https://git-wip-us.apache.org/repos/asf/cordova-wp8.git';
+//Destination to build to
+var BUILD_DESTINATION;
+// pull the project down from github?
+var GET_NEW = false;
+
+// help function
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: new [ PathToDestinationFolder ]");
+ WScript.StdOut.WriteLine(" PathToDestinationFolder : Folder you wish to be created for a new cordova-wp8 repo");
+ WScript.StdOut.WriteLine("examples:");
+ WScript.StdOut.WriteLine(" new C:\\Users\\anonymous\\Desktop\\cordova-wp8");
+ WScript.StdOut.WriteLine("");
+}
+
+// returns the contents of a file
+function read(filename) {
+ //WScript.StdOut.WriteLine('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdErr.WriteLine('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ WScript.sleep(100);
+ }
+}
+
+function copy_to(path)
+{
+ //Copy everything over to BUILD_DESTINATION
+ var dest = shell.NameSpace(path);
+ WScript.StdOut.WriteLine("Copying files to build directory...");
+
+ /** copy by file instead? (just what we need)**/
+ dest.CopyHere(ROOT + "\\bin", 4|20);
+ dest.CopyHere(ROOT + EXAMPLE_PATH, 4|20); //Should mostly be copied from standalone
+ dest.CopyHere(ROOT + FRAMEWORK_PATH, 4|20);
+ dest.CopyHere(ROOT + TEMPLATES_PATH, 4|20);
+ dest.CopyHere(ROOT + "\\tests", 4|20);
+ dest.CopyHere(ROOT + "\\tooling", 4|20);
+ dest.CopyHere(ROOT + "\\.gitignore", 4|20);
+ dest.CopyHere(ROOT + "\\LICENSE", 4|20);
+ dest.CopyHere(ROOT + "\\NOTICE", 4|20);
+ dest.CopyHere(ROOT + "\\README.md", 4|20);
+ dest.CopyHere(ROOT + "\\VERSION", 4|20);
+}
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+ if(fso.FolderExists(args(0)))
+ {
+ WScript.StdErr.WriteLine("The given directory already exists!");
+ Usage();
+ WScript.Quit(1);
+ }
+ else
+ {
+ BUILD_DESTINATION = args(0);
+
+ }
+
+ if(!GET_NEW) {
+
+ if(fso.FolderExists(BUILD_DESTINATION))
+ {
+ WScript.StdErr.WriteLine("The given directory already exists!");
+ Usage();
+ WScript.Quit(1);
+ }
+ else
+ {
+ BUILD_DESTINATION = args(0);
+ }
+
+ // set up file structure
+ fso.CreateFolder(BUILD_DESTINATION);
+ // copy nessisary files
+ copy_to(BUILD_DESTINATION);
+ }
+ else
+ {
+ wscript_shell.CurrentDirectory = arg(0) + '\\..';
+ BUILD_DESTINATION = wscript_shell.CurrentDirectory + '\\cordova-wp8';
+
+ WScript.StdOut.WriteLine('Cloning cordova-wp8 from git, build destination now ' + BUILD_DESTINATION);
+ if(fso.FolderExists(BUILD_DESTINATION))
+ {
+ WScript.StdErr.WriteLine("Could not clone cordova-wp8 from git because it's directory already exists!");
+ WScript.Quit(1);
+ }
+
+ exec('git clone ' + CORDOVA_WP8); //git fetch --tags && git checkout?
+
+ }
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/package.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/package.bat b/lib/cordova-wp8/tooling/scripts/package.bat
new file mode 100644
index 0000000..c00551e
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/package.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\package.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/package.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/package.js b/lib/cordova-wp8/tooling/scripts/package.js
new file mode 100644
index 0000000..57a7340
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/package.js
@@ -0,0 +1,213 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ // root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ // sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ // sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ // sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ // subfolder containing example project
+ EXAMPLE_PATH = '\\example',
+ // get version number
+ VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
+ BASE_VERSION = VERSION.split('rc', 1) + ".0";
+
+// destination directory to package
+var BUILD_DESTINATION;
+// add templates to visual studio?
+var ADD_TO_VS = false;
+// build the dll?
+var BUILD_DLL = false;
+
+function Log(msg) { WScript.StdOut.WriteLine(msg); }
+
+// help function
+function Usage()
+{
+ Log("");
+ Log("Usage: package [ PathToCordovaWP8 ]");
+ Log(" PathToCordovaWP8 : Cordova-wp8 repo you wish to package for release");
+ Log("examples:");
+ Log(" package C:\\Users\\anonymous\\Desktop\\cordova-wp8");
+ Log(" package // packages current cordova directory");
+ Log("");
+}
+
+// returns the contents of a file
+function read(filename) {
+ //Log('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ Log('ERROR: Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ WScript.sleep(100);
+ }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+ Log("Command: " + command);
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ //Wait a little bit so we're not super looping
+ WScript.sleep(100);
+ //Print any stdout output from the script
+ if(!oShell.StdOut.AtEndOfStream) {
+ var line = oShell.StdOut.ReadLine();
+ Log(line);
+ }
+ }
+ //Check to make sure our scripts did not encounter an error
+ if(!oShell.StdErr.AtEndOfStream)
+ {
+ var err_line = oShell.StdErr.ReadAll();
+ WScript.StdErr.WriteLine(err_line);
+ WScript.Quit(1);
+ }
+}
+
+// packages templates into .zip
+function package_templates()
+{
+ Log("Creating template .zip files ...");
+
+ var template_path = BUILD_DESTINATION + '\\CordovaWP8_' + VERSION.replace(/\./g, '_') + '.zip';
+ if(fso.FileExists(template_path))
+ {
+ fso.DeleteFile(template_path);
+ }
+
+ exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate ' + BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
+ exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templateIcon.png ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png');
+ exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
+ exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + STANDALONE_PATH);
+
+ exec_verbose('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + template_path + ' ' + BUILD_DESTINATION + STANDALONE_PATH + '\\');
+
+
+ if(ADD_TO_VS)
+ {
+ var template_dir = wscript_shell.ExpandEnvironmentStrings("%USERPROFILE%") + '\\Documents\\Visual Studio 2012\\Templates\\ProjectTemplates';
+ if(fso.FolderExists(template_dir ))
+ {
+ dest = shell.NameSpace(template_dir);
+ dest.CopyHere(template_path, 4|20);
+ }
+ else
+ {
+ Log("WARNING: Could not find template directory in Visual Studio,\n you can manually copy over the template .zip files.");
+ }
+ }
+}
+
+// builds the new cordova dll and copys it to the full template (only done because of the version referance in Device.cs)
+function build_dll()
+{
+ Log("Packaging .dll ...");
+ // move to framework directory
+ wscript_shell.CurrentDirectory = BUILD_DESTINATION + FRAMEWORK_PATH;
+ // build .dll in Release
+ exec_verbose('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber=' + BASE_VERSION);
+ //Check if file dll was created
+ if(!fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+ {
+ WScript.StdErr.WriteLine('ERROR: MSBuild failed to create .dll.');
+ WScript.Quit(1);
+ }
+
+ Log("SUCESS");
+}
+
+// delete any unnessisary files when finished
+function cleanUp() {
+
+ if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate')) {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg')) {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png')) {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png');
+ }
+ //Add any other cleanup here
+}
+
+
+Log("");
+
+if(args.Count() > 0)
+{
+ //Support help flags
+ if(args(0).indexOf("--help") > -1 ||
+ args(0).indexOf("/?") > -1 )
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+
+ if(fso.FolderExists(args(0)) && fso.FolderExists(args(0) + '\\tooling'))
+ {
+ BUILD_DESTINATION = args(0);
+ }
+ else
+ {
+ Log("ERROR: The given directory is not a cordova-wp8 repo.");
+ Usage();
+ WScript.Quit(1);
+
+ }
+}
+else
+{
+ BUILD_DESTINATION = ROOT;
+}
+
+// build dll for full template
+if (BUILD_DLL) {
+ build_dll();
+}
+
+// build/package the templates
+package_templates(BUILD_DESTINATION);
+
+cleanUp();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/reversion.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/reversion.bat b/lib/cordova-wp8/tooling/scripts/reversion.bat
new file mode 100644
index 0000000..b35ab08
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/reversion.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\reversion.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/reversion.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/reversion.js b/lib/cordova-wp8/tooling/scripts/reversion.js
new file mode 100644
index 0000000..a726817
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/reversion.js
@@ -0,0 +1,280 @@
+/*
+ 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.
+*/
+
+
+/************ Globals ********/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+//Get new version from git or build off this version?
+var GET_NEW = false;
+
+//Set up directory structure of current release
+ //arguments passed in
+var args = WScript.Arguments,
+ //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ //Sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ //Sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ //Sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ //Subfolder containing example project
+ EXAMPLE_PATH = '\\example',
+ //Path to cordovalib folder, containing source for .dll
+ CORDOVA_LIB = STANDALONE_PATH + '\\cordovalib',
+ //Get version number
+ VERSION='',
+ BASE_VERSION = '';
+
+//Destination to build to
+var BUILD_DESTINATION;
+
+// help function
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: reversion [ Version PathTOCordovaWP8 ]");
+ WScript.StdOut.WriteLine(" Version : The new version for codova-wp8");
+ WScript.StdOut.WriteLine(" PathTOCordovaWP8 : The path to the cordova directory being reversioned.");
+ WScript.StdOut.WriteLine("examples:");
+ WScript.StdOut.WriteLine(" reversion 2.5.0rc1 //Reversions the current working directory");
+ WScript.StdOut.WriteLine(" reversion 2.5.0 C :\\Users\\anonymous\\Desktop\\cordova-wp8");
+ WScript.StdOut.WriteLine("");
+}
+
+var ForReading = 1, ForWriting = 2, ForAppending = 8;
+var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
+
+// returns the contents of a file
+function read(filename) {
+ //WScript.Echo('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdErr.WriteLine('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// writes the contents to the specified file
+function write(filename, contents) {
+ var f=fso.OpenTextFile(filename, ForWriting, TristateTrue);
+ f.Write(contents);
+ f.Close();
+}
+
+// replaces the matches of regexp with replacement
+function replaceInFile(filename, regexp, replacement) {
+ //WScript.Echo("Replaceing with "+replacement+ " in:");
+ var text = read(filename).replace(regexp,replacement);
+ //WScript.Echo(text);
+ write(filename,text);
+}
+
+// executes a commmand in the shell
+function exec(command) {
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ WScript.sleep(100);
+ }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+ //WScript.StdOut.WriteLine("Command: " + command);
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status === 0) {
+ //Wait a little bit so we're not super looping
+ WScript.sleep(100);
+ //Print any stdout output from the script
+ if(!oShell.StdOut.AtEndOfStream) {
+ var line = oShell.StdOut.ReadLine();
+ WScript.StdOut.WriteLine(line);
+ }
+ }
+ //Check to make sure our scripts did not encounter an error
+ if(!oShell.StdErr.AtEndOfStream)
+ {
+ var err_line = oShell.StdErr.ReadAll();
+ WScript.StdErr.WriteLine(err_line);
+ WScript.Quit(1);
+ }
+}
+
+function updateVersionNumbers() {
+ WScript.StdOut.WriteLine("Updating version numbers....");
+ var version_regex = /(\d+)[.](\d+)[.](\d+)(rc\d)?/;
+ replaceInFile(BUILD_DESTINATION + '\\VERSION', version_regex, VERSION);
+ // replace assembaly versions in framework
+ var framework_regex = /Description\(\"(\d+)[.](\d+)[.](\d+)(rc\d)?\"\)\]/; //Will match ("x.x.x[rcx]")]
+ replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex, "Description(\"" + VERSION + "\")]");
+ framework_regex = /Version\(\"(\d+)[.](\d+)[.](\d+)[.](\d+)\"\)\]/g;
+ replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex, "Version(\"" + BASE_VERSION + "\")]");
+
+ // update standalone project
+ exec('%comspec% /c copy /Y /V ' + BUILD_DESTINATION + "\\VERSION " + BUILD_DESTINATION + STANDALONE_PATH + "\\VERSION");
+ var cordova_regex = /cordova-(\d+)[.](\d+)[.](\d+)(rc\d)?/g; //Matches *first* cordova-x.x.x[rcx] (just ad g at end to make global)
+ replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\CordovaAppProj.csproj', cordova_regex, "cordova-" + VERSION);
+ replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\www\\index.html', cordova_regex, "cordova-" + VERSION);
+ version_regex = /return\s*\"(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches return "x.x.x[rcx]
+
+ WScript.StdOut.WriteLine("path = " + BUILD_DESTINATION + CORDOVA_LIB + '\\Plugins\\Device.cs');
+ replaceInFile(BUILD_DESTINATION + CORDOVA_LIB + '\\..\\Plugins\\Device.cs', version_regex, "return \"" + VERSION);
+
+ // update example proj
+ replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\CordovaExample.csproj', cordova_regex, "cordova-" + VERSION);
+ version_regex = /VERSION\s*\=\s*\'(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches VERSION = x.x.x[rcx]
+ replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\cordova-current.js', version_regex, "VERSION = \'" + VERSION);
+
+ // update template discription
+ version_regex = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?\s*Windows/g; //Matches version: x.x.x[rcx]
+ replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\description.txt', version_regex, "Cordova " + VERSION + " Windows");
+
+ // update .vstemplate files for the template zips.
+ var name_regex = /CordovaWP8[_](\d+)[_](\d+)[_](\d+)(rc\d)?/g;
+ var discript_regex = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?/;
+
+ replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', name_regex, 'CordovaWP8_' + VERSION.replace(/\./g, '_'));
+ replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', discript_regex, "Cordova " + VERSION);
+ replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', cordova_regex, "cordova-" + VERSION);
+}
+
+// delete all cordova.js and generated files (templates) from old version numbers
+function cleanup()
+{
+ WScript.StdOut.WriteLine("Cleanup");
+ // remove old template .zip files
+ if(fso.FileExists(BUILD_DESTINATION + '\\*.zip'))
+ {
+ fso.DeleteFile(BUILD_DESTINATION + '\\*.zip');
+ }
+ // remove any generated framework files
+ if(fso.FolderExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin'))
+ {
+ fso.DeleteFolder(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin');
+ }
+ if(fso.FolderExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\obj'))
+ {
+ fso.DeleteFolder(BUILD_DESTINATION + FRAMEWORK_PATH + '\\obj');
+ }
+ // remove any generated CordovaDeploy
+ if(fso.FolderExists(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\bin'))
+ {
+ fso.DeleteFolder(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\bin');
+ }
+ if(fso.FolderExists(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\obj'))
+ {
+ fso.DeleteFolder(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\obj');
+ }
+ //remove old template .zip files
+ WScript.Echo(BUILD_DESTINATION);
+ var root_folder = shell.NameSpace(BUILD_DESTINATION + '\\').Items();
+ for(var i = 0; i < root_folder.Count; i++)
+ {
+ if(root_folder.Item(i).Name.match(/CordovaWP8[_](\d+)[_](\d+)[_](\d+)(rc\d)?/))
+ {
+ fso.DeleteFile(BUILD_DESTINATION + '\\' + root_folder.Item(i).Name);
+ }
+ }
+ // remove old cordova.js
+ var example_www = shell.NameSpace(BUILD_DESTINATION + EXAMPLE_PATH + '\\www').Items();
+ for(i = 0; i < example_www.Count; i++)
+ {
+ if(example_www.Item(i).Name.match(/cordova\-(\d+)[.](\d+)[.](\d+)(rc\d)?[.]js/))
+ {
+ fso.DeleteFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\' + example_www.Item(i).Name);
+ }
+ }
+
+ var standalone_www = shell.NameSpace(BUILD_DESTINATION + STANDALONE_PATH + '\\www').Items();
+ for(i = 0; i < standalone_www.Count; i++)
+ {
+ if(standalone_www.Item(i).Name.match(/cordova\-(\d+)[.](\d+)[.](\d+)(rc\d)?[.]js/))
+ {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\www\\' + standalone_www.Item(i).Name);
+ }
+ }
+}
+
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 1)
+{
+ if(fso.FolderExists(args(1)) && fso.FolderExists(args(1) + '\\tooling'))
+ {
+ BUILD_DESTINATION = args(1);
+ }
+ else
+ {
+ WScript.StdErr.WriteLine("The given path is not a cordova-wp8 repo, if");
+ WScript.StdErr.WriteLine(" your trying to reversion a cordova-wp8 repo");
+ WScript.StdErr.WriteLine(" other then this one, please provide its path.");
+ Usage();
+ WScript.Quit(1);
+ }
+}
+
+if(args.Count() > 0)
+{
+ //Support help flags
+ if(args(0).indexOf("--help") > -1 ||
+ args(0).indexOf("/?") > -1 )
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+
+ if(args(0).match(/(\d+)[.](\d+)[.](\d+)(rc\d)?/))
+ {
+ VERSION = args(0);
+ BASE_VERSION = VERSION.split('rc', 1) + ".0";
+ if(args.Count() < 2)
+ {
+ BUILD_DESTINATION = ROOT;
+ }
+ // remove old cordova.js files and any generated files
+ cleanup();
+ // update version numbers
+ updateVersionNumbers();
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("The version number is invalid, please provide");
+ WScript.StdOut.WriteLine(" a version number in the format Major.Minor.Fix[rc#]");
+ Usage();
+ WScript.Quit(1);
+ }
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fea2dd2/lib/cordova-wp8/tooling/scripts/win-zip.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/win-zip.js b/lib/cordova-wp8/tooling/scripts/win-zip.js
new file mode 100644
index 0000000..7a79f43
--- /dev/null
+++ b/lib/cordova-wp8/tooling/scripts/win-zip.js
@@ -0,0 +1,43 @@
+/*
+ * Script for zipping the contents of a directory.
+ */
+
+// get commman line arguments
+var objArgs = WScript.Arguments;
+var zipPath = objArgs(0);
+var sourcePath = objArgs(1);
+
+
+// create empty ZIP file and open for adding
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+var file = fso.CreateTextFile(zipPath, true);
+
+// create twenty-two byte "fingerprint" for .zip
+file.write("PK");
+file.write(String.fromCharCode(5));
+file.write(String.fromCharCode(6));
+file.write('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0');
+file.Close();
+
+// open .zip foder and copy contents of sourcePath
+var objShell = new ActiveXObject("shell.application");
+var zipFolder = objShell.NameSpace(zipPath);
+var sourceItems = objShell.NameSpace(sourcePath).items();
+if (zipFolder !== null) {
+ zipFolder.CopyHere(sourceItems, 4|20|16);
+ var maxTime = 5000;
+ while(zipFolder.items().Count < sourceItems.Count)
+ {
+ maxTime -= 100;
+ if(maxTime > 0 ) {
+ WScript.Sleep(100);
+ }
+ else {
+ WScript.StdErr.WriteLine('Failed to create .zip file.');
+ break;
+ }
+ }
+}
+else {
+ WScript.StdErr.WriteLine('Failed to create .zip file.');
+}
\ No newline at end of file