cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [11/30] New filenames.Url aliases.(New AppBundle plugin needed).Desc cont below Android has a bug where the web view will not throw intercept events if you are navigating to a location that matches a filename in your bundle. Thus in order to support url
Date Thu, 23 May 2013 20:03:34 GMT
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/cdvah_js/libs/q.min.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/libs/q.min.js b/www/cdvah_js/libs/q.min.js
new file mode 100644
index 0000000..7a27b9a
--- /dev/null
+++ b/www/cdvah_js/libs/q.min.js
@@ -0,0 +1,19 @@
+(function(k){"function"===typeof bootstrap?bootstrap("promise",k):"object"===typeof exports?module.exports=k():"function"===typeof define&&define.amd?define(k):"undefined"!==typeof ses?ses.ok()&&(ses.makeQ=k):Q=k()})(function(){function k(a){var b=Function.call;return function(){return b.apply(a,arguments)}}function L(a,b){b.stack&&("object"===typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(M))&&(a.stack=N(a.stack)+"\n"+M+"\n"+N(b.stack))}function N(a){for(var a=a.split("\n"),b=[],d=0;d<a.length;++d){var j=
+a[d],c;if(c=/at .+ \((.*):(\d+):\d+\)/.exec(j)){var g=c[2];c=c[1]===O&&g>=aa&&g<=ba}else c=!1;!c&&!(-1!==j.indexOf("(module.js:")||-1!==j.indexOf("(node.js:"))&&b.push(j)}return b.join("\n")}function P(){if(Error.captureStackTrace){var a,b,d=Error.prepareStackTrace;Error.prepareStackTrace=function(d,c){a=c[1].getFileName();b=c[1].getLineNumber()};Error().stack;Error.prepareStackTrace=d;O=a;return b}}function c(a){return p(a)}function i(){function a(a){b&&(j=p(a),t(b,function(a,b){l(function(){j.promiseDispatch.apply(j,
+b)})},void 0),d=b=void 0)}var b=[],d=[],j,e=C(i.prototype),g=C(m.prototype);g.promiseDispatch=function(a,c,g){var e=h(arguments);b?(b.push(e),"when"===c&&g[1]&&d.push(g[1])):l(function(){j.promiseDispatch.apply(j,e)})};g.valueOf=function(){if(b)return g;var a=o(j);u(a)&&(j=a);return a};Error.captureStackTrace&&0<c.longStackJumpLimit&&(Error.captureStackTrace(g,i),g.stack=g.stack.substring(g.stack.indexOf("\n")+1));e.promise=g;e.resolve=a;e.fulfill=function(b){a(D(b))};e.reject=function(b){a(n(b))};
+e.notify=function(a){b&&t(d,function(b,d){l(function(){d(a)})},void 0)};return e}function m(a,b,d,c,e){void 0===b&&(b=function(a){return n(Error("Promise does not support operation: "+a))});var g=C(m.prototype);g.promiseDispatch=function(d,c,j){var e;try{e=a[c]?a[c].apply(g,j):b.call(g,c,j)}catch(f){e=n(f)}d&&d(e)};d&&(g.valueOf=d);e&&(g.exception=c);return g}function o(a){return u(a)?a.valueOf():a}function u(a){return a&&"function"===typeof a.promiseDispatch}function E(a){return a&&"function"===
+typeof a.then}function F(a){return!E(o(a))}function R(a){a=o(a);return u(a)&&"exception"in a}function n(a){var b=m({when:function(b){if(b){var c=ca(G,this);-1!==c&&(v.splice(c,1),G.splice(c,1))}return b?b(a):this}},function(){return n(a)},function(){return this},a,!0);!S&&("undefined"!==typeof window&&!window.Touch&&window.console)&&console.log("Should be empty:",v);S=!0;G.push(b);v.push(a);return b}function D(a){return m({when:function(){return a},get:function(b){return a[b]},set:function(b,d){a[b]=
+d},"delete":function(b){delete a[b]},post:function(b,d){return null===b||void 0===b?a.apply(void 0,d):a[b].apply(a,d)},apply:function(b,d){return a.apply(b,d)},keys:function(){return da(a)}},void 0,function(){return a})}function p(a){if(u(a))return a;a=o(a);if(E(a)){var b=a,d=i();l(function(){try{b.then(d.resolve,d.reject,d.notify)}catch(a){d.reject(a)}});return d.promise}return D(a)}function f(a,b,d,j){function e(a){try{return"function"===typeof b?b(a):a}catch(d){return n(d)}}function g(a){if("function"===
+typeof d){L(a,k);try{return d(a)}catch(b){return n(b)}}return n(a)}var f=i(),h=!1,k=p(a);l(function(){k.promiseDispatch(function(a){h||(h=!0,f.resolve(e(a)))},"when",[function(a){h||(h=!0,f.resolve(g(a)))}])});k.promiseDispatch(void 0,"when",[void 0,function(a){var b,d=!1;try{b="function"===typeof j?j(a):a}catch(e){if(d=!0,c.onerror)c.onerror(e);else throw e;}d||f.notify(b)}]);return f.promise}function T(a,b,d){return f(a,function(a){return A(a).then(function(a){return b.apply(void 0,a)},d)},d)}function w(a,
+b,d){var c=i();l(function(){p(a).promiseDispatch(c.resolve,b,d)});return c.promise}function q(a){return function(b){var d=h(arguments,1);return w(b,a,d)}}function U(a,b){var d=h(arguments,2);return H(a,b,d)}function r(a,b){return w(a,"apply",[void 0,b])}function I(a){var b=h(arguments,1);return r(a,b)}function A(a){return f(a,function(a){var d=0,c=i();t(a,function(e,g,h){F(g)?a[h]=o(g):(++d,f(g,function(e){a[h]=e;0===--d&&c.resolve(a)},c.reject))},void 0);0===d&&c.resolve(a);return c.promise})}function V(a,
+b){return f(a,void 0,b)}var aa=P(),O,W=function(){},l;if("undefined"!==typeof process)l=process.nextTick;else if("function"===typeof setImmediate)l="undefined"!==typeof window?setImmediate.bind(window):setImmediate;else{var X=function(){--s;if(++J>=x){J=0;x*=4;for(var a=y&&Math.min(y-1,x);s<a;)++s,B()}for(;y;)--y,z=z.next,a=z.task,z.task=void 0,a();J=0},z={task:void 0,next:null},Y=z,x=2,s=0,y=0,J=0,B;l=function(a){Y=Y.next={task:a,next:null};s<++y&&s<x&&(++s,B())};if("undefined"!==typeof MessageChannel){var Z=
+new MessageChannel;Z.port1.onmessage=X;B=function(){Z.port2.postMessage(0)}}else B=function(){setTimeout(X,0)}}var h=k(Array.prototype.slice),t=k(Array.prototype.reduce||function(a,b){var d=0,c=this.length;if(1===arguments.length){do{if(d in this){b=this[d++];break}if(++d>=c)throw new TypeError;}while(1)}for(;d<c;d++)d in this&&(b=a(b,this[d],d));return b}),ca=k(Array.prototype.indexOf||function(a){for(var b=0;b<this.length;b++)if(this[b]===a)return b;return-1}),$=k(Array.prototype.map||function(a,
+b){var d=this,c=[];t(d,function(e,g,f){c.push(a.call(b,g,f,d))},void 0);return c}),C=Object.create||function(a){function b(){}b.prototype=a;return new b},ea=k(Object.prototype.hasOwnProperty),da=Object.keys||function(a){var b=[],d;for(d in a)ea(a,d)&&b.push(d);return b},fa=k(Object.prototype.toString),K;K="undefined"!==typeof ReturnValue?ReturnValue:function(a){this.value=a};c.longStackJumpLimit=1;var M="From previous event:";c.nextTick=l;c.defer=i;i.prototype.makeNodeResolver=function(){var a=this;
+return function(b,d){b?a.reject(b):2<arguments.length?a.resolve(h(arguments,1)):a.resolve(d)}};c.promise=function(a){var b=i();I(a,b.resolve,b.reject,b.notify).fail(b.reject);return b.promise};c.makePromise=m;m.prototype.then=function(a,b,d){return f(this,a,b,d)};m.prototype.thenResolve=function(a){return f(this,function(){return a})};m.prototype.thenReject=function(a){return f(this,function(){throw a;})};t("isFulfilled isRejected isPending dispatch when spread get put set del delete post send invoke keys fapply fcall fbind all allResolved timeout delay catch finally fail fin progress done nfcall nfapply nfbind denodeify nbind ncall napply nbind npost nsend ninvoke nodeify".split(" "),
+function(a,b){m.prototype[b]=function(){return c[b].apply(c,[this].concat(h(arguments)))}},void 0);m.prototype.toSource=function(){return this.toString()};m.prototype.toString=function(){return"[object Promise]"};c.nearer=o;c.isPromise=u;c.isPromiseAlike=E;c.isPending=function(a){return!F(a)&&!R(a)};c.isFulfilled=F;c.isRejected=R;var G=[],v=[],S;if("undefined"!==typeof process&&process.on)process.on("exit",function(){for(var a=0;a<v.length;a++){var b=v[a];b&&"undefined"!==typeof b.stack?console.warn("Unhandled rejected promise:",
+b.stack):console.warn("Unhandled rejected promise (no stack):",b)}});c.reject=n;c.fulfill=D;c.resolve=p;c.master=function(a){return m({isDef:function(){}},function(b,d){return w(a,b,d)},function(){return o(a)})};c.when=f;c.spread=T;c.async=function(a){return function(){function b(a,b){var h;try{h=d[a](b)}catch(i){return"[object StopIteration]"===fa(i)||i instanceof K?i.value:n(i)}return f(h,c,e)}var d=a.apply(this,arguments),c=b.bind(b,"send"),e=b.bind(b,"throw");return c()}};c["return"]=function(a){throw new K(a);
+};c.promised=function(a){return function(){return T([this,A(arguments)],function(b,d){return a.apply(b,d)})}};c.dispatch=w;c.dispatcher=q;c.get=q("get");c.set=q("set");c["delete"]=c.del=q("delete");var H=c.post=q("post");c.send=U;c.invoke=U;c.fapply=r;c["try"]=I;c.fcall=I;c.fbind=function(a){var b=h(arguments,1);return function(){var d=b.concat(h(arguments));return w(a,"apply",[this,d])}};c.keys=q("keys");c.all=A;c.allResolved=function(a){return f(a,function(a){a=$(a,p);return f(A($(a,function(a){return f(a,
+W,W)})),function(){return a})})};c["catch"]=c.fail=V;c.progress=function(a,b){return f(a,void 0,void 0,b)};c["finally"]=c.fin=function(a,b){return f(a,function(a){return f(b(),function(){return a})},function(a){return f(b(),function(){return n(a)})})};c.done=function(a,b,d,j){var e=function(b){l(function(){L(b,a);if(c.onerror)c.onerror(b);else throw b;})},b=b||d||j?f(a,b,d,j):a;"object"===typeof process&&(process&&process.domain)&&(e=process.domain.bind(e));V(b,e)};c.timeout=function(a,b){var d=i(),
+c=setTimeout(function(){d.reject(Error("Timed out after "+b+" ms"))},b);f(a,function(a){clearTimeout(c);d.resolve(a)},function(a){clearTimeout(c);d.reject(a)},d.notify);return d.promise};c.delay=function(a,b){void 0===b&&(b=a,a=void 0);var d=i();f(a,void 0,void 0,d.notify);setTimeout(function(){d.resolve(a)},b);return d.promise};c.nfapply=function(a,b){var d=h(b),c=i();d.push(c.makeNodeResolver());r(a,d).fail(c.reject);return c.promise};c.nfcall=function(a){var b=h(arguments,1),d=i();b.push(d.makeNodeResolver());
+r(a,b).fail(d.reject);return d.promise};c.nfbind=function(a){var b=h(arguments,1);return function(){var d=b.concat(h(arguments)),c=i();d.push(c.makeNodeResolver());r(a,d).fail(c.reject);return c.promise}};c.denodeify=c.nfbind;c.nbind=function(a,b){var d=h(arguments,2);return function(){var c=d.concat(h(arguments)),e=i();c.push(e.makeNodeResolver());r(function(){return a.apply(b,arguments)},c).fail(e.reject);return e.promise}};c.npost=function(a,b,d){var d=h(d||[]),c=i();d.push(c.makeNodeResolver());
+H(a,b,d).fail(c.reject);return c.promise};c.nsend=function(a,b){var c=h(arguments,2),f=i();c.push(f.makeNodeResolver());H(a,b,c).fail(f.reject);return f.promise};c.ninvoke=c.nsend;c.nodeify=function(a,b){if(b)a.then(function(a){l(function(){b(null,a)})},function(a){l(function(){b(a)})});else return a};var ba=P();return c});

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/cdvah_views/add.html
----------------------------------------------------------------------
diff --git a/www/cdvah_views/add.html b/www/cdvah_views/add.html
new file mode 100644
index 0000000..902c46d
--- /dev/null
+++ b/www/cdvah_views/add.html
@@ -0,0 +1,17 @@
+<form name="addForm" ng-controller="AddCtrl">
+    <label for="inputAppName">Enter the App Name</label><br />
+    <input type="text" name="appName" ng-model="appName" ng-pattern="/^[\w ]*$/" ng-maxlength="64" required />
+    <span ng-show="addForm.appName.$error.required">Required</span>
+    <span ng-show="addForm.appName.$error.pattern">Invalid characters used</span>
+    <span ng-show="addForm.appName.$error.maxlength">Too long</span>
+    <br />
+
+    <input type="radio" ng-model="appSource" name="appSource" value="pattern" ng-init="appPatternChecked=true; appSource='pattern'" ng-checked="appPatternChecked" />
+        <label for="inputAppPattern">Enter the URL to a file</label><br />
+        <input id="inputAppPattern" type="text" name="appSourcePattern" ng-model="appSourcePattern" ng-disabled="!appPatternChecked" ng-required="appPatternChecked" />
+        <span ng-show="addForm.appSourcePattern.$error.required">Required</span>
+        <br />
+    <button ng-click="addApp(appName, appSource, appSourcePattern)" ng-disabled="!(addForm.$valid)">Add</button>
+    <br />
+    <a href="#/">Back To Main Menu</a>
+</form>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/cdvah_views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah_views/list.html b/www/cdvah_views/list.html
new file mode 100644
index 0000000..b73f196
--- /dev/null
+++ b/www/cdvah_views/list.html
@@ -0,0 +1,12 @@
+<ul>
+	<li ng-repeat="app in appsList"> 
+        <p>{{app.Name}}</p>
+        <p>Installed on: {{app.Installed}}</p>
+        <button ng-click="launchApp(app.Name)">Launch</button>
+		<button ng-click="updateApp(app.Name)">Update</button>
+		<button ng-click="removeApp(app.Name)">Remove</button>
+	</li>
+</ul>
+<button ng-click="loadAppsList()">Reload Apps List</button>
+<br />
+<a href="#/add">Add new App</a>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/contextMenu.html
----------------------------------------------------------------------
diff --git a/www/contextMenu.html b/www/contextMenu.html
deleted file mode 100644
index c1e04fc..0000000
--- a/www/contextMenu.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!-- Keep stylesheet as a part of the html as this file gets injected into the app -->
-<style>
-#__cordovaappharness_contextMenu_div
-{
-    position: fixed;
-    left : 0px;
-    top : 0px;
-    z-index: 2000;
-    background-color:rgba(0,0,0,0.75);
-    width: 100%;
-    height: 100%;
-    display: none;
-}
-#__cordovaappharness_contextMenu_div p
-{
-    color: white;
-    text-align: center;
-}
-#__cordovaappharness_contextMenu_div ul
-{
-    list-style-type: none;
-    margin-left: 20%;
-    margin-right: 20%;
-    padding: 0;
-    width: 60%;
-}
-#__cordovaappharness_contextMenu_div li
-{
-    margin-bottom: 0.5cm;
-}
-#__cordovaappharness_contextMenu_div li, #__cordovaappharness_contextMenu_div button
-{
-    width: 100%;
-    height: 1cm;
-}
-</style>
-<div id="__cordovaappharness_contextMenu_div">
-    <p>Tap Anywhere to Close</p>
-    <ul>
-        <li>
-            <a href="app-bundle:///index.html#/?updateLastLaunched=true"><button>Update</button></a>
-        </li>
-        <li>
-            <a href="app-bundle:///index.html#/?lastLaunched=true"><button>Restart</button></a>
-        </li>
-        <li>
-            <button id="__cordovaappharness_contextMenu_firebug_button">Firebug</button>
-        </li>
-        <li>
-            <a href="app-bundle:///index.html"><button>Back to Main Menu</button></a>
-        </li>
-    </ul>
-</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
deleted file mode 100644
index f48fc97..0000000
--- a/www/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>Cordova App Harness</title>
-        <script type="text/javascript" src="cordova.js"></script>
-        <script type="text/javascript" src="js/libs/q.min.js"></script>
-        <script type="text/javascript" src="js/libs/angular.min.js"></script>
-        <script type="text/javascript" src="js/app.js"></script>
-        <script type="text/javascript" src="js/AppConstants.js"></script>
-        <script type="text/javascript" src="js/ResourcesLoader.js"></script>
-        <script type="text/javascript" src="js/AppsService.js"></script>
-        <script type="text/javascript" src="js/KnownExtensionDownloader.js"></script>
-        <script type="text/javascript" src="js/CdvhPackageHandler.js"></script>
-        <script type="text/javascript" src="js/ListCtrl.js"></script>
-        <script type="text/javascript" src="js/AddCtrl.js"></script>
-    </head>
-    <body ng-app="CordovaAppHarness" ng-view>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/AddCtrl.js
----------------------------------------------------------------------
diff --git a/www/js/AddCtrl.js b/www/js/AddCtrl.js
deleted file mode 100644
index 09a1c50..0000000
--- a/www/js/AddCtrl.js
+++ /dev/null
@@ -1,24 +0,0 @@
-(function(){
-    "use strict";
-    /* global myApp */
-    myApp.controller("AddCtrl", ["$scope", "AppsService", function ($scope, AppsService) {
-
-        $scope.addApp = function(appName, appSource, appSourcePattern) {
-            if(appSource === "pattern") {
-                if(!appSourcePattern) {
-                    alert("Url not specified");
-                    return;
-                }
-
-                AppsService.addAppFromPattern(appName, appSourcePattern)
-                .then(function() {
-                    alert("Successfully installed");
-                }, function(error) {
-                    console.error(error);
-                    alert("Unable to add application because: \n" + JSON.stringify(error));
-                });
-            }
-        };
-    }]);
-
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/AppConstants.js
----------------------------------------------------------------------
diff --git a/www/js/AppConstants.js b/www/js/AppConstants.js
deleted file mode 100644
index 81f8b4d..0000000
--- a/www/js/AppConstants.js
+++ /dev/null
@@ -1,12 +0,0 @@
-(function() {
-    var TEMP_DIRECTORY = "cordova_app_harness_tempDir/";
-    var INSTALL_DIRECTORY = "cordova_app_harness_installed_apps/";
-    var APPS_JSON = "cordova_app_harness_installed_apps/apps.json";
-    var METADATA_JSON = "cordova_app_harness_installed_apps/metadata.json";
-
-    /* global myApp */
-    myApp.value("TEMP_DIRECTORY", TEMP_DIRECTORY);
-    myApp.value("INSTALL_DIRECTORY", INSTALL_DIRECTORY);
-    myApp.value("APPS_JSON", APPS_JSON);
-    myApp.value("METADATA_JSON", METADATA_JSON);
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/AppsService.js
----------------------------------------------------------------------
diff --git a/www/js/AppsService.js b/www/js/AppsService.js
deleted file mode 100644
index 8868c07..0000000
--- a/www/js/AppsService.js
+++ /dev/null
@@ -1,253 +0,0 @@
-(function() {
-    "use strict";
-    /* global myApp */
-    myApp.factory("AppsService", [ "ResourcesLoader", "INSTALL_DIRECTORY", "TEMP_DIRECTORY", "APPS_JSON", "METADATA_JSON", function(ResourcesLoader, INSTALL_DIRECTORY, TEMP_DIRECTORY, APPS_JSON, METADATA_JSON) {
-
-        var platformId = cordova.require("cordova/platform").id;
-        // downloaders that know how to download from certain patterns.
-        // Eg: The KnownExtensionDownloader MAY know how to download from any uri's that end in known extensions
-        var downloadHandlers = [];
-        // handlers that have registered to unpack certain extensions during the installation of an app
-        var extensionHandlers = {};
-
-        function grabExtensionFromUri(uri) {
-            var lastSegment = uri.split("#")[0].split("?")[0].split("/").pop();
-            var dotLocation = lastSegment.lastIndexOf(".");
-            var extension = (dotLocation !== -1)? lastSegment.substring(dotLocation + 1) : "";
-            return extension;
-        }
-
-        function addNewAppFromPattern(appName, appSourcePattern) {
-            var _fullFilePath;
-
-            return ResourcesLoader.deleteDirectory(INSTALL_DIRECTORY + appName)
-            .then(function(){
-                for(var i = 0; i < downloadHandlers.length; i++){
-                    if(downloadHandlers[i].handler.canHandleSourcePattern(appSourcePattern)){
-                        return downloadHandlers[i].handler.downloadFromPattern(appName, appSourcePattern, TEMP_DIRECTORY);
-                    }
-                }
-                throw new Error("App Harness does not know how to install an app from the pattern: " + appSourcePattern);
-            })
-            .then(function(fullFilePath){
-                _fullFilePath = fullFilePath;
-                return ResourcesLoader.ensureDirectoryExists(INSTALL_DIRECTORY + appName);
-            })
-            .then(function(directoryPath){
-                var extension = grabExtensionFromUri(appSourcePattern);
-                if(!extensionHandlers[extension]) {
-                    throw new Error("No handler for extension " + extension + " found");
-                }
-                return extensionHandlers[extension].extractPackageToDirectory(_fullFilePath, directoryPath);
-            })
-            .then(function(){
-                return registerApp(appName, "pattern", appSourcePattern);
-            });
-        }
-
-        function registerApp(appName, appSource, appSourcePattern) {
-            return ResourcesLoader.readJSONFileContents(APPS_JSON)
-            .then(function(result){
-                result.installedApps = result.installedApps || [];
-                result.installedApps.push({
-                    "Name" :  appName,
-                    "Source" : appSource,
-                    "Data" : appSourcePattern
-                    "Installed" : (new Date()).toLocaleString()
-                });
-                return ResourcesLoader.writeJSONFileContents(APPS_JSON, result);
-            });
-        }
-
-        function cleanPath(path){
-            if(path.indexOf("file://") === 0){
-                path = path.substring("file://".length);
-            }
-            // remove trailing slash
-            return (path.substring(path.length - 1) === "/") ? path.substring(0, path.length - 1) : path;
-        }
-
-        function getAppStartPageFromConfig(configFile, appBaseDirectory) {
-            configFile = cleanPath(configFile);
-            appBaseDirectory = cleanPath(appBaseDirectory);
-
-            return ResourcesLoader.readFileContents(configFile)
-            .then(function(contents){
-                if(!contents) {
-                    throw new Error("Config file is empty. Unable to find a start page for your app.");
-                } else {
-                    var startLocation = appBaseDirectory + "/index.html";
-                    var parser = new DOMParser();
-                    var xmlDoc = parser.parseFromString(contents, "text/xml");
-                    var els = xmlDoc.getElementsByTagName("content");
-
-                    if(els.length > 0) {
-                        // go through all "content" elements looking for the "src" attribute in reverse order
-                        for(var i = els.length - 1; i >= 0; i--) {
-                            var el = els[i];
-                            var srcValue = el.getAttribute("src");
-                            if(srcValue) {
-                                // Relative url's only currently
-                                startLocation = appBaseDirectory + "/" + srcValue;
-                                break;
-                            }
-                        }
-                    }
-
-                    return startLocation;
-                }
-            });
-        }
-
-        function removeApp(appName){
-            var entry;
-            return ResourcesLoader.ensureDirectoryExists(APPS_JSON)
-            .then(function() {
-                return ResourcesLoader.readJSONFileContents(APPS_JSON);
-            })
-            .then(function(result){
-                result.installedApps = result.installedApps || [];
-
-                for(var i = 0; i < result.installedApps.length; i++){
-                    if(result.installedApps[i].Name === appName) {
-                        entry = result.installedApps.splice(i, 1)[0];
-                        break;
-                    }
-                }
-
-                if(!entry) {
-                    throw new Error("The app " + appName + " was not found.");
-                }
-
-                return ResourcesLoader.writeJSONFileContents(APPS_JSON, result);
-            })
-            .then(function(){
-                return ResourcesLoader.deleteDirectory(INSTALL_DIRECTORY + appName);
-            })
-            .then(function(){
-                return entry;
-            });
-        }
-
-        return {
-            //return promise with the array of apps
-            getAppsList : function(getFullEntries) {
-                return ResourcesLoader.ensureDirectoryExists(APPS_JSON)
-                .then(function() {
-                    return ResourcesLoader.readJSONFileContents(APPS_JSON);
-                })
-                .then(function(result){
-                    result.installedApps = result.installedApps || [];
-                    var newAppsList = [];
-
-                    for(var i = 0; i < result.installedApps.length; i++){
-                        if(getFullEntries) {
-                            newAppsList.push(result.installedApps[i]);
-                        } else {
-                            newAppsList.push(result.installedApps[i].Name);
-                        }
-                    }
-
-                    return newAppsList;
-                });
-            },
-
-            launchApp : function(appName) {
-                return ResourcesLoader.readJSONFileContents(METADATA_JSON)
-                .then(function(settings){
-                    settings = settings || {};
-                    settings.lastLaunched = appName;
-                    return ResourcesLoader.writeJSONFileContents(METADATA_JSON, settings);
-                })
-                .then(function(){
-                    return ResourcesLoader.getFullFilePath(INSTALL_DIRECTORY + appName);
-                })
-                .then(function(appLocation) {
-                    var appPlatformLocation = cleanPath(appLocation) + "/" + platformId;
-                    return getAppStartPageFromConfig(appPlatformLocation + "/config.xml", appPlatformLocation + "/www/");
-                })
-                .then(function(startLocation) {
-                    //ensure we use a file uri
-                    if(startLocation.search("file://") !== 0){
-                        startLocation = "file://" + startLocation;
-                    }
-                    window.location = startLocation;
-                });
-            },
-
-            addAppFromPattern : function(appName, appSourcePattern) {
-                return this.getAppsList(false /* App names only */)
-                .then(function(appsList){
-                    if(appsList.indexOf(appName) !== -1) {
-                        throw new Error("An app with this name already exists");
-                    }
-                    return addNewAppFromPattern(appName, appSourcePattern);
-                });
-            },
-
-            uninstallApp : function(appName) {
-                return removeApp(appName);
-            },
-
-            getLastRunApp : function() {
-                return ResourcesLoader.readJSONFileContents(METADATA_JSON)
-                .then(function(settings){
-                    if(!settings || !settings.lastLaunched) {
-                        throw new Error("No App has been launched yet");
-                    }
-                    return settings.lastLaunched;
-                });
-            },
-
-            registerPatternDownloader : function(handler, priority){
-                if(!handler) {
-                    throw new Error("Expected handler");
-                }
-                if(typeof(handler.canHandleSourcePattern) !== "function") {
-                    throw new Error("Expected function for bool handler.canHandleSourcePattern(string pattern) to exist");
-                }
-                if(typeof(handler.downloadFromPattern) !== "function") {
-                    throw new Error("Expected function for (string fullFilePath or QPromise) handler.downloadFromPattern(string appName, string pattern, string tempDirectory) to exist");
-                }
-                if(!priority) {
-                    // Assign a default priority
-                    priority = 500;
-                }
-                var i = 0;
-                var objToInsert = { "priority" : priority, "handler" : handler };
-                for(i = 0; i < downloadHandlers.length; i++){
-                    if(downloadHandlers[i].priority > objToInsert.priority) {
-                        break;
-                    }
-                }
-                downloadHandlers.splice(i, 0, objToInsert);
-            },
-
-            registerPackageHandler : function(extension, handler) {
-                if(!extension) {
-                    throw new Error("Expcted extension");
-                }
-                if(!handler || typeof(handler.extractPackageToDirectory) !== "function") {
-                    throw new Error("Expected function for void handler.extractPackageToDirectory(string fullFilePath, string directoryPath) to exist");
-                }
-                if(handler[extension]) {
-                    throw new Error("Handler already exists for the extension: " + extension);
-                }
-                extensionHandlers[extension] = handler;
-            },
-
-            updateApp : function(appName){
-                return removeApp(appName)
-                .then(function(entry){
-                    if(entry.Source === "pattern") {
-                        return addNewAppFromPattern(entry.Name, entry.Data);
-                    }
-                });
-            },
-
-            getKnownExtensions : function() {
-                return Object.keys(extensionHandlers);
-            }
-        };
-    }]);
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/CdvhPackageHandler.js
----------------------------------------------------------------------
diff --git a/www/js/CdvhPackageHandler.js b/www/js/CdvhPackageHandler.js
deleted file mode 100644
index 212cd4b..0000000
--- a/www/js/CdvhPackageHandler.js
+++ /dev/null
@@ -1,60 +0,0 @@
-(function(){
-    "use strict";
-    /* global myApp */
-    myApp.run(["AppsService", "ResourcesLoader", function(AppsService, ResourcesLoader){
-
-        var platformId = cordova.require("cordova/platform").id;
-
-        function copyFile(startUrl, targetLocation){
-            /************ Begin Work around for File system bug ************/
-            if(targetLocation.indexOf("file://") === 0) {
-                targetLocation = targetLocation.substring("file://".length);
-            }
-            /************ End Work around for File system bug **************/
-            return ResourcesLoader.xhrGet(startUrl)
-            .then(function(xhr){
-                return ResourcesLoader.ensureDirectoryExists(targetLocation)
-                .then(function(){
-                    return ResourcesLoader.writeFileContents(targetLocation, xhr.responseText);
-                });
-            });
-        }
-
-        var appendScript = function() {
-            console.log("Injecting menu script");
-            var contextScript = document.createElement("script");
-            contextScript.setAttribute("type","text/javascript");
-            contextScript.setAttribute("src", "app-bundle:///js/ContextMenu.js");
-            document.getElementsByTagName("head")[0].appendChild(contextScript);
-        };
-
-        AppsService.registerPackageHandler("cdvh", {
-            extractPackageToDirectory : function (fileName, outputDirectory){
-                var dataToAppend = "\n(" + appendScript.toString() + ")();";
-                var platformDirectory = outputDirectory + "/" + platformId + "/www/";
-                var cordovaFile = platformDirectory + "cordova.js";
-                var pluginsFile = platformDirectory + "cordova_plugins.json";
-
-                // We need to
-                // 1) Modify the cordova.js file
-                // 2) Copy the cordova_plugins.json we have, as the app that is being installed may have other plugins included which aren't in the harness.
-                // If we allow unavailable plugins to be included in this file, the plugin initialiser breaks
-                return ResourcesLoader.extractZipFile(fileName, outputDirectory)
-                .then(function(){
-                    return ResourcesLoader.doesFileExist(cordovaFile);
-                })
-                .then(function(fileExists){
-                    if(fileExists){
-                        return Q.all([
-                            ResourcesLoader.appendFileContents(cordovaFile, dataToAppend),
-                            copyFile("app-bundle:///cdvh_files/www/cordova_plugins.json", pluginsFile)
-                        ]);
-                    } else {
-                        throw new Error("The package does not seem to have the files required for the platform: " + platformId);
-                    }
-                });
-            }
-        });
-
-    }]);
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/ContextMenu.js
----------------------------------------------------------------------
diff --git a/www/js/ContextMenu.js b/www/js/ContextMenu.js
deleted file mode 100644
index 239a76c..0000000
--- a/www/js/ContextMenu.js
+++ /dev/null
@@ -1,84 +0,0 @@
-(function () {
-
-    function initialise() {
-        var contextHTMLUrl = "app-bundle:///contextMenu.html";
-        var xhr = new window.XMLHttpRequest();
-        xhr.onreadystatechange=function()
-        {
-            if (xhr.readyState==4 && xhr.status==200)
-            {
-                var stringifiedHtml = xhr.responseText;
-                onInject(stringifiedHtml);
-            }
-        };
-        // retrieve the context menu
-        xhr.open("GET", contextHTMLUrl, true);
-        xhr.send();
-
-        loadFirebug(false);
-        attachErrorListener();
-    }
-
-    function onInject(stringifiedHtml) {
-
-        document.body.innerHTML += stringifiedHtml;
-
-        var contextDiv = "__cordovaappharness_contextMenu_div";
-        var showFirebugButton = "__cordovaappharness_contextMenu_firebug_button";
-
-        // Setup the listeners to toggle the context menu
-        document.addEventListener("touchmove", function (event) {
-            if(event.touches.length >= 3) {
-                document.getElementById(contextDiv).style.display = "inline";
-            }
-        }, false);
-
-        document.getElementById(contextDiv).onclick = function() {
-            document.getElementById(contextDiv).style.display = "none";
-        };
-
-        var firstTime = true;
-        document.getElementById(showFirebugButton).onclick = function(){
-            try {
-                if(firstTime){
-                    console.warn("Note that messages logged to the console at the app startup may not be visible here.");
-                    console.warn("Do not use the close button on Firebug. Your console logs will be cleared. Use minimize instead.");
-                    firstTime = false;
-                }
-                window.Firebug.chrome.open();
-            } catch(e) {
-                // hack - FirebugLite appears to have several bugs. One of which is - open firebug, user shuts down FirebugLite through the UI.
-                // FirebugLite is now in a bad state of neither being usable or removable. Any calls to open throw an error.
-                // The following lines removes the flags that FirebugLite looks for manually and makes it think it has not loaded it yet
-                // Then FirebugLite is loaded into the page again
-                // This hack should be revisited when FirebugLite moves from version 1.4
-                // Either the hack won't be needed anymore or the hack should be checked too see if it still works.
-                var el = document.getElementById("FirebugLite");
-                if(el) {
-                    el.setAttribute("id", "");
-                }
-                delete console.firebuglite;
-                loadFirebug(true);
-            }
-        };
-    }
-
-    function loadFirebug(startOpened){
-        var el = document.createElement("script");
-        el.setAttribute("id", "FirebugLite");
-        el.setAttribute("src", "https://getfirebug.com/firebug-lite.js");
-        el.setAttribute("FirebugLite", "4");
-        el.innerHTML = el.innerHTML = "{ debug : false, startOpened : "  + startOpened + ", showIconWhenHidden : false, saveCommandLineHistory : true, saveCookies : false }";
-        document.head.appendChild(el);
-    }
-
-    // FirebugLite doesn't catch errors from window.onerror like desktop browser's dev tools do. So we add it manually.
-    function attachErrorListener(){
-        window.onerror = function(msg, url, line) {
-            console.error("Error: " + msg + " on line: " +  line + " in file: " + url);
-        };
-    }
-
-    initialise();
-})();
-

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/KnownExtensionDownloader.js
----------------------------------------------------------------------
diff --git a/www/js/KnownExtensionDownloader.js b/www/js/KnownExtensionDownloader.js
deleted file mode 100644
index cec413a..0000000
--- a/www/js/KnownExtensionDownloader.js
+++ /dev/null
@@ -1,43 +0,0 @@
-(function(){
-    "use strict";
-    /* global myApp */
-    myApp.run(["AppsService", "ResourcesLoader", function(AppsService, ResourcesLoader){
-
-        function isUri(pattern){
-            var regexUri = /^(?:([a-z0-9+.-]+:\/\/)((?:(?:[a-z0-9-._~!$&'()*+,;=:]|%[0-9A-F]{2})*)@)?((?:[a-z0-9-._~!$&'()*+,;=]|%[0-9A-F]{2})*)(:(?:\d*))?(\/(?:[a-z0-9-._~!$&'()*+,;=:@\/]|%[0-9A-F]{2})*)?|([a-z0-9+.-]+:)(\/?(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})+(?:[a-z0-9-._~!$&'()*+,;=:@\/]|%[0-9A-F]{2})*)?)(\?(?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*)?(#(?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*)?$/i;
-            var ret = (pattern.search(regexUri) !== -1);
-            return ret;
-        }
-
-        function grabExtensionFromUri(uri) {
-            var lastSegment = uri.split("#")[0].split("?")[0].split("/").pop();
-            var dotLocation = lastSegment.lastIndexOf(".");
-            var extension = (dotLocation !== -1)? lastSegment.substring(dotLocation + 1) : "";
-            return extension;
-        }
-
-        // Note the priority given has no meaning in and of itself. It is used solely to compare if any other component has higher priority.
-        AppsService.registerPatternDownloader({
-            canHandleSourcePattern : function (pattern) {
-                var canHandle = false;
-                if(isUri(pattern)) {
-                    var currentExtension = grabExtensionFromUri(pattern);
-                    if(currentExtension) {
-                        var knownExtensions = AppsService.getKnownExtensions();
-                        if(knownExtensions.indexOf(currentExtension) !== -1){
-                            canHandle = true;
-                        }
-                    }
-                }
-                return canHandle;
-            },
-
-            downloadFromPattern : function (appName, pattern, tempDirectory) {
-                var extension = grabExtensionFromUri(pattern);
-                var fileName = tempDirectory + appName + "." + extension;
-                return ResourcesLoader.downloadFromUrl(pattern, fileName);
-            }
-        }, 500 /* assign a priority */);
-
-    }]);
-})();

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/js/ListCtrl.js b/www/js/ListCtrl.js
deleted file mode 100644
index d906f7c..0000000
--- a/www/js/ListCtrl.js
+++ /dev/null
@@ -1,94 +0,0 @@
-(function(){
-    "use strict";
-    /* global myApp */
-    myApp.controller("ListCtrl", [ "$scope", "$routeParams", "AppsService", function ($scope, $routeParams, AppsService) {
-
-        $scope.appsList = [];
-
-        function initialise() {
-            if($routeParams.lastLaunched) {
-                return AppsService.getLastRunApp()
-                .then(AppsService.launchApp, function(e){
-                    e = e || {};
-                    console.error("Error launching last run app: " + e.message);
-                    alert("Error launching last run app. Please try again.");
-                });
-            }
-            else if($routeParams.updateLastLaunched) {
-                var app;
-                // updating may take a while so we show the apps list like we normally do
-                return $scope.loadAppsList(true)
-                .then(AppsService.getLastRunApp)
-                .then(function(_app){
-                    app = _app;
-                    return AppsService.updateApp(app);
-                })
-                .then(function(){
-                    return AppsService.launchApp(app);
-                }, function(e){
-                    e = e || {};
-                    console.error("Error updating last run app: " + e.message);
-                    alert("Error updating last run app. Please try again.");
-                });
-            }
-            else {
-                return $scope.loadAppsList(true);
-            }
-        }
-
-        $scope.loadAppsList = function(callApply) {
-            return AppsService.getAppsList(true /* get full information about the app */)
-            .then(function(newAppsList){
-                newAppsList.sort(function(a, b){
-                    if(a.Name < b.Name) {
-                        return -1;
-                    } else if(a.Name > b.Name) {
-                        return 1;
-                    }
-                    return 0;
-                });
-                //clear the old apps list
-                $scope.appsList.splice(0, $scope.appsList.length);
-                angular.extend($scope.appsList, newAppsList);
-                if(callApply) {
-                    $scope.$apply();
-                }
-            }, function(error){
-                var str = "There was an error retrieving the apps list";
-                console.error(str + JSON.stringify(error));
-                alert(str);
-            });
-        };
-
-        $scope.launchApp = function(app){
-            return AppsService.launchApp(app)
-            .then(null, function(error){
-                console.error("Error during loading of app " + app + ": " + error);
-                alert("Something went wrong during the loading of the app. Please try again.");
-            });
-        };
-
-        $scope.updateApp = function(app) {
-            return AppsService.updateApp(app)
-            .then(function(){
-                alert("Updated successfully");
-            }, function(error){
-                console.error("Error during updating of app " + app + ": " + error);
-                alert("Something went wrong during the updating of the app. Please try again.");
-            });
-        };
-
-        $scope.removeApp = function(app) {
-            var shouldUninstall = confirm("Are you sure you want to uninstall " + app + "?");
-            if(shouldUninstall) {
-                return AppsService.uninstallApp(app)
-                .then(function() { $scope.loadAppsList(true); }, function(error){
-                    console.error("Error during uninstall of app " + app + ": " + error);
-                    alert("Something went wrong during the uninstall of the app. Please try again.");
-                });
-            }
-        };
-
-        document.addEventListener("deviceready", initialise, false);
-    }]);
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/ResourcesLoader.js
----------------------------------------------------------------------
diff --git a/www/js/ResourcesLoader.js b/www/js/ResourcesLoader.js
deleted file mode 100644
index 8aa52a9..0000000
--- a/www/js/ResourcesLoader.js
+++ /dev/null
@@ -1,404 +0,0 @@
-(function() {
-    "use strict";
-
-    /* global myApp */
-    myApp.factory("ResourcesLoader", [ "$window", function ($window) {
-        var fs;
-        var initialised = false;
-
-        function initialiseFileSystem() {
-            var deferred = Q.defer();
-
-            if(!initialised) {
-
-                var failedFileSystemLookUp = function (error) {
-                    var errorString = "An error occurred while reading the file system.";
-                    if(error) {
-                        errorString += " " + JSON.stringify(error);
-                    }
-                    deferred.reject(new Error(errorString));
-                };
-
-                var success = function(_fs) {
-                    fs = _fs;
-                    initialised = true;
-                    deferred.resolve(fs);
-                };
-
-                try {
-                    $window.requestFileSystem($window.LocalFileSystem.PERSISTENT, 0, success, failedFileSystemLookUp);
-                } catch (e) {
-                    failedFileSystemLookUp(e);
-                }
-            } else {
-                deferred.resolve(fs);
-            }
-
-            return deferred.promise;
-        }
-
-        //promise returns full path to downloaded file
-        function downloadFromUrl(url, fullFilePath) {
-            var deferred = Q.defer();
-
-            try {
-                var downloadFail = function(error) {
-                    var str = "There was an error while downloading the file " + JSON.stringify(error);
-                    deferred.reject(new Error(str));
-                };
-
-                var downloadSuccess = function(fileEntry) {
-                    deferred.resolve(fileEntry.fullPath);
-                };
-
-                var fileTransfer = new $window.FileTransfer();
-                var uri = encodeURI(url);
-                fileTransfer.download(uri, fullFilePath, downloadSuccess, downloadFail);
-            } catch(e) {
-                deferred.reject(new Error(e));
-            } finally {
-                return deferred.promise;
-            }
-        }
-
-        function trim(str) {
-            return str && str.replace(/^\s+|\s+$/g, "");
-        }
-
-        function fixFilePath(path) {
-            if(path && path.indexOf("file://") === 0) {
-                path = path.substring("file://".length);
-            }
-            return path;
-        }
-
-        //promise returns the directory entry
-        function getDirectoryEntry(directoryName) {
-            var deferred = Q.defer();
-
-            try {
-                var errorWhileGettingDirectoryEntry = function(error) {
-                    var str = "There was an error while getting the directory entry for directory " + directoryName + " " + JSON.stringify(error);
-                    deferred.reject(new Error(str));
-                };
-                var success = function(directoryEntry) {
-                    deferred.resolve(directoryEntry);
-                };
-                fs.root.getDirectory(directoryName, {create: true, exclusive: false}, success, errorWhileGettingDirectoryEntry);
-            } catch(e) {
-                deferred.reject(new Error(e));
-            } finally {
-                return deferred.promise;
-            }
-        }
-
-        //promise returns the file entry
-        function getFileEntry(fileName, createFlag) {
-            var deferred = Q.defer();
-
-            try {
-                var errorWhileGettingFileEntry = function(error) {
-                    var str = "There was an error while getting the file entry for file " + fileName + " " + JSON.stringify(error);
-                    deferred.reject(new Error(str));
-                };
-                var success = function(fileEntry) {
-                    deferred.resolve(fileEntry);
-                };
-                // !! - ensures a boolean value
-                fs.root.getFile(fileName, {create: !!createFlag, exclusive: false}, success, errorWhileGettingFileEntry);
-            } catch(e) {
-                deferred.reject(new Error(e));
-            } finally {
-                return deferred.promise;
-            }
-        }
-
-        //promise returns the file
-        function getFile(fileName) {
-            return getFileEntry(fileName, true  /* create */).
-            then(function(fileEntry){
-                var deferred = Q.defer();
-
-                try {
-                    var errorWhileGettingFile = function(error) {
-                        var str = "There was an error while getting the file for file " + fileName + " " + JSON.stringify(error);
-                        deferred.reject(new Error(str));
-                    };
-
-                    fileEntry.file(deferred.resolve, errorWhileGettingFile);
-                } catch(e) {
-                    deferred.reject(new Error(e));
-                } finally {
-                    return deferred.promise;
-                }
-            });
-        }
-
-        function truncateToDirectoryPath(path) {
-            //remove the filename if it exists
-            var lastLevelIndex = path.search(/[\w ]+(\.[\w ]+)+$/g);
-            if(lastLevelIndex !== -1) {
-                path = path.substring(0, lastLevelIndex);
-            }
-            return path;
-        }
-
-        function getPathSegments(path){
-            //truncate leading and trailing slashes
-            if(path.charAt(0) === "/"){
-                path = path.substring(1);
-            }
-            if(path.charAt(path.length - 1) === "/"){
-                path = path.substring(0, path.length - 1);
-            }
-            var segments = path.split("/");
-            return segments;
-        }
-
-        function ensureSingleDirectoryExists(directory){
-            var deferred = Q.defer();
-
-            var gotDirEntry = function(dirEntry) {
-                deferred.resolve(dirEntry.fullPath);
-            };
-
-            var failedToGetDirEntry = function(error) {
-                var str = "There was an error checking the directory: " + directory + " " + JSON.stringify(error);
-                deferred.reject(new Error(str));
-            };
-
-            fs.root.getDirectory(directory, {create: true, exclusive: false}, gotDirEntry, failedToGetDirEntry);
-            return deferred.promise;
-        }
-
-        function writeToFile(fileName, contents, append) {
-            return getFileEntry(fileName, true)
-            .then(function(fileEntry){
-                var deferred = Q.defer();
-
-                var errorGettingFileWriter = function(error) {
-                    var str = "There was an error writing the file." + JSON.stringify(error);
-                    deferred.reject(new Error(str));
-                };
-
-                var gotFileWriter = function(writer) {
-                    writer.onwrite = deferred.resolve;
-                    writer.onerror = function(evt) {
-                        deferred.reject(new Error(evt));
-                    };
-                    if(append){
-                        writer.seek(writer.length);
-                    }
-                    writer.write(contents);
-                };
-                fileEntry.createWriter(gotFileWriter, errorGettingFileWriter);
-                return deferred.promise;
-            });
-        }
-
-        return {
-            doesFileExist : function(fileName){
-                return initialiseFileSystem()
-                .then(function(){
-                    return getFileEntry(fileName, false /* create */);
-                })
-                .then(function(){
-                    return true;
-                }, function(){
-                    return false;
-                });
-            },
-
-            // returns a promise with a full path to the dir
-            ensureDirectoryExists : function(directory) {
-                return initialiseFileSystem()
-                .then(function(){
-                    directory = truncateToDirectoryPath(directory);
-                    directory = fixFilePath(directory);
-                    var segments = getPathSegments(directory);
-                    var currentDir = directory.charAt(0) === "/"? "/" : "";
-                    var promiseArr = [];
-                    while(segments.length !== 0) {
-                        currentDir +=  segments.shift() + "/";
-                        promiseArr.push(ensureSingleDirectoryExists(currentDir));
-                    }
-                    return Q.all(promiseArr);
-                })
-                .then(function(paths){
-                    return paths[paths.length - 1];
-                });
-            },
-
-            // promise returns full path to file
-            getFullFilePath : function(filePath) {
-                return initialiseFileSystem()
-                .then(function(){
-                    var deferred = Q.defer();
-
-                    // Use the file's parent folder to get the full path
-                    var directory = filePath;
-                    var fileName = "";
-
-                    //remove the filename if it exists
-                    var lastLevelIndex = directory.search(/\/[\w ]+\.[\w ]+$/g);
-                    if(lastLevelIndex !== -1) {
-                        directory = filePath.substring(0, lastLevelIndex);
-                        fileName = filePath.substring(lastLevelIndex + 1);
-                    }
-
-                    //we need the directory name w.r.t the root, so remove any slashes in the beginning
-                    if(directory.charAt(0) === "/") {
-                        directory = directory.substring(1);
-                    }
-
-                    var gotFullPath = function(dirEntry) {
-                        var fullFilePath = dirEntry.fullPath + "/" + fileName;
-                        deferred.resolve(fullFilePath);
-                    };
-
-                    var failedToGetFullPath = function(error) {
-                        var str = "There was an error getting the full path of file: " + filePath + " " + JSON.stringify(error);
-                        deferred.reject(new Error(str));
-                    };
-
-                    fs.root.getDirectory(directory, {create: true, exclusive: false}, gotFullPath, failedToGetFullPath);
-                    return deferred.promise;
-                });
-            },
-
-            // returns a promise with a full path to the downloaded file
-            downloadFromUrl : function(url, filePath) {
-                var self = this;
-                return initialiseFileSystem()
-                .then(function(){
-                    return self.ensureDirectoryExists(filePath);
-                })
-                .then(function(){
-                    return self.getFullFilePath(filePath);
-                })
-                .then(function(fullFilePath){
-                    return downloadFromUrl(url, fullFilePath);
-                });
-            },
-
-            //returns a promise with the contents of the file
-            readFileContents : function(fileName) {
-                return initialiseFileSystem()
-                .then(function(){
-                    return getFile(fileName);
-                })
-                .then(function(file){
-                    var deferred = Q.defer();
-
-                    var reader = new $window.FileReader();
-                    reader.onload = function(evt) {
-                        var text = evt.target.result;
-                        deferred.resolve(text);
-                    };
-                    reader.onerror = function(evt) {
-                        deferred.reject(new Error(evt));
-                    };
-                    reader.readAsText(file);
-
-                    return deferred.promise;
-                });
-            },
-
-            //returns a promise with the json contents of the file
-            readJSONFileContents : function(fileName) {
-                return this.readFileContents(fileName)
-                .then(function (text) {
-                    text = trim(text);
-                    var resultJson = {};
-                    if(text) {
-                        resultJson = JSON.parse(text);
-                    }
-                    return resultJson;
-                });
-            },
-
-            //returns a promise when file is written
-            writeFileContents : function(fileName, contents) {
-                return initialiseFileSystem()
-                .then(function(){
-                    return writeToFile(fileName, contents, false /* append */);
-                });
-            },
-
-            //returns a promise when file is appended
-            appendFileContents : function(fileName, contents) {
-                return initialiseFileSystem()
-                .then(function(){
-                    return writeToFile(fileName, contents, true /* append */);
-                });
-            },
-
-            //returns a promise when json file is written
-            writeJSONFileContents : function(fileName, contents) {
-                var stringContents;
-                if(typeof contents === "string") {
-                    stringContents = contents;
-                } else {
-                    stringContents = JSON.stringify(contents);
-                }
-                return this.writeFileContents(fileName, stringContents);
-            },
-
-            deleteDirectory : function(directoryName) {
-                return initialiseFileSystem()
-                .then(function(){
-                    return getDirectoryEntry(directoryName);
-                })
-                .then(function(dirEntry){
-                    var deferred = Q.defer();
-                    var failedToDeleteDirectory = function(error) {
-                        var str = "There was an error deleting the directory: " + directoryName + " " + JSON.stringify(error);
-                        deferred.reject(new Error(str));
-                    };
-                    dirEntry.removeRecursively(deferred.resolve, failedToDeleteDirectory);
-                    return deferred.promise;
-                });
-            },
-
-            extractZipFile : function(fileName, outputDirectory){
-                var deferred = Q.defer();
-
-                //will throw an exception if the zip plugin is not loaded
-                try {
-                    var onZipDone = function(returnCode) {
-                        if(returnCode !== 0) {
-                            deferred.reject(new Error("Something went wrong during the unzipping of: " + fileName));
-                        } else {
-                            deferred.resolve();
-                        }
-                    };
-
-                    /* global zip */
-                    zip.unzip(fileName, outputDirectory, onZipDone);
-                } catch(e) {
-                    deferred.reject(e);
-                } finally {
-                    return deferred.promise;
-                }
-            },
-
-            xhrGet : function(url) {
-                var deferred = Q.defer();
-                var xhr = new XMLHttpRequest();
-                xhr.onreadystatechange = function() {
-                    if (xhr.readyState === 4) {
-                        if(xhr.status === 200) {
-                            deferred.resolve(xhr);
-                        } else {
-                            deferred.reject("XHR return status: " + xhr.statusText);
-                        }
-                    }
-                };
-                xhr.open("GET", url, true);
-                xhr.send();
-                return deferred.promise;
-            }
-        };
-    }]);
-
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/771f02b2/www/js/app.js
----------------------------------------------------------------------
diff --git a/www/js/app.js b/www/js/app.js
deleted file mode 100644
index 962571e..0000000
--- a/www/js/app.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var myApp = angular.module("CordovaAppHarness", []);
-myApp.config(["$routeProvider", function($routeProvider){
-    $routeProvider.when("/", {
-        templateUrl: "views/list.html",
-        controller: "ListCtrl"
-    });
-    $routeProvider.when("/add", {
-        templateUrl: "views/add.html",
-        controller: "AddCtrl"
-    });
-}]);
\ No newline at end of file


Mime
View raw message